light-angel Posted July 3, 2008 Share Posted July 3, 2008 i have found this script <?Php // Define our array of allowed $_GET values $pass = array('main','ts','guides','news','hublist'); // If the page is allowed, include it: if (in_array($_GET['page'], $pass)) { include ($_SERVER['DOCUMENT_ROOT'] . 'hubs/' . $_GET['page'] . '.php'); } // This will load the default page: elseif (!isset($_GET['page'])) { include ($_SERVER['DOCUMENT_ROOT'] . '/main.php'); } // If the page is not allowed, send them to an error page: else { // This send the 404 header header("HTTP/1.0 404 Not Found"); // This includes the error page include ($_SERVER['DOCUMENT_ROOT'] . '/error.php'); } ?> but when i put thin the link like www.mydomain.com/index.php?p=guides i just keep getting up the main page and the others wont load can some one help me plz Link to comment https://forums.phpfreaks.com/topic/113075-solved-indexphp-names/ Share on other sites More sharing options...
ag3nt42 Posted July 3, 2008 Share Posted July 3, 2008 why don't you just use.. if(!(isset($_GET['page']))){$P='';}else{$P=$_GET['page'];} if($P=='guides') { echo("<META http-equiv='refresh' content='0;URL=http://www.mydomain.com/hubs/guides.php'>"); } you could use a switch statement if you have alot of pages.. switch ($P) { guides: echo ("<META http-equiv='refresh' content='0;URL=http://www.mydomain.com/hubs/guides.php'>"); break; //Stop leak into next case. news: echo "Number 2"; break; ts: echo "Number 3"; break; main: echo "Number 4"; } Link to comment https://forums.phpfreaks.com/topic/113075-solved-indexphp-names/#findComment-580804 Share on other sites More sharing options...
TransmogriBenno Posted July 3, 2008 Share Posted July 3, 2008 1. The URL www.mydomain.com/index.php?p=guides is wrong, p= and page= are not the same thing. 2. Are the files that you want to load in the subdirectory "hubs"? Link to comment https://forums.phpfreaks.com/topic/113075-solved-indexphp-names/#findComment-580806 Share on other sites More sharing options...
ag3nt42 Posted July 3, 2008 Share Posted July 3, 2008 1. The URL www.mydomain.com/index.php?p=guides is wrong, p= and page= are not the same thing. 2. Are the files that you want to load in the subdirectory "hubs"? ooh good call i did not even notice it was jus p= Link to comment https://forums.phpfreaks.com/topic/113075-solved-indexphp-names/#findComment-580810 Share on other sites More sharing options...
light-angel Posted July 3, 2008 Author Share Posted July 3, 2008 no all the files for that are in the hubs dir i did try it and get this error Parse error: syntax error, unexpected T_STRING, expecting T_CASE or T_DEFAULT or '}' in /home/asgards1/www/hubs/index1.php on line 5 Link to comment https://forums.phpfreaks.com/topic/113075-solved-indexphp-names/#findComment-580813 Share on other sites More sharing options...
DarkWater Posted July 3, 2008 Share Posted July 3, 2008 Use what you already have, but go to ?page=guides instead of ?p=guides. Link to comment https://forums.phpfreaks.com/topic/113075-solved-indexphp-names/#findComment-580817 Share on other sites More sharing options...
light-angel Posted July 3, 2008 Author Share Posted July 3, 2008 thank you for ya help on this Link to comment https://forums.phpfreaks.com/topic/113075-solved-indexphp-names/#findComment-580820 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.