[thelist] Including file using $page

Raoul Snyman raoul.snyman at saturnlaboratories.co.za
Mon Sep 1 15:27:18 CDT 2008

On Sunday 31 August 2008 01:14:50 Rae wrote:
> How do I define $page so that it pulls the appropriate page from within
> my pages/ directory.  I've seen the outcome used in the url such as:
> http://www.somesite.com/index.php?page=somepage


> And is this the best way to achieve this?  Any help is appreciated!

Not really. This opens you up to security attacks. You'll want to first 
sanitise your input before handing it to your include.

What you might want to do in addition to that sanitising, is to use Apache's 
URL rewriting to achieve a site that looks like:


But actually runs:


This is really only security by obscurity from a security point of view (which 
is bad), but it does generate nice clean urls that are both search engine and 
people friendly.

You can find out more about URL rewriting on Apache's site:


Raoul Snyman, B.Tech IT (Software Engineering)
Saturn Laboratories
m: 082 550 3754
e: raoul.snyman at saturnlaboratories.co.za
w: www.saturnlaboratories.co.za
b: blog.saturnlaboratories.co.za

More information about the thelist mailing list