Ranger56
07-08-2005, 05:53 AM
How does the whole
"www.site.com/pages.php?page=blahblah.php"
Work instead of
"www.site./blahblah.php"
?
"www.site.com/pages.php?page=blahblah.php"
Work instead of
"www.site./blahblah.php"
?
|
||||
Page names.Ranger56 07-08-2005, 05:53 AM How does the whole "www.site.com/pages.php?page=blahblah.php" Work instead of "www.site./blahblah.php" ? Kurashu 07-08-2005, 05:59 AM By including the file. Here's a quick function I whipped up that should work. <?php function loadPage($name, $pages) { if(isset($name) && isset($pages) && is_array($pages)) { if(isset($pages[$name])) { require_once $pages[$key]; return true; } } return false; } ?> You would use it like this: //URL: www.example.net/?page=news $pages = array('news' => 'index.php', 'about' => 'about.php'); //etc if(isset($_GET['page'])) { if(!(loadPage($_GET['page'], $pages) || $pages[$_GET['page']] === substr($_SERVER['PHP_SELF'], 1))) { echo 'Error'; } } Ranger56 07-08-2005, 06:06 AM Hmm...I'll try to figure that out... |
| |||
EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum