Including pages with $_GET
<p>I want url's like index.php?showuser=512, index.php?shownews=317 for pages i get content from db... and for regular pages index.php?page=about and so on WITHOUT mod-rewrite.</p>

<p>Invision Power Board has urls like this. I have looked through their code but I can't figure out how they do it.</p>

<p>I could do it like this:</p>

<pre><code>if (ctype_digit($_GET['shownews'])) include('shownews.php'); 
elseif (ctype_digit($_GET['showuser'])) include('showuser.php');

// regular pages
elseif ($_GET['page'] == 'about') include('about.php');
elseif ($_GET['page'] == 'help') include('help.php'); 
elseif ($_GET['page'] == 'login') include('login.php');
</code></pre>

<p>But this feels too messy.
Just curious how IPB does this. Is there a better way do to this? WITHOUT any mod-rewrite. Any one know? I doubt they do it like the above.</p>

<p>I can't do:</p>

<pre><code>if (preg_match('/^[a-z0-9]+$/', $_GET['page'])) include('$_GET['page']');
</code></pre>

<p>Then I would get links like index.php?showuser&amp;id=512 and that I dont like. (i know its not safe just showing the princip)</p>

<p>I like it this way, it's not the best but i like it so please be quiet about template engines, frameworks etc. Just be kind and answer my question... I just want to know how IPB does this.</p>

<p>Thanks
Tomek</p>
