jackinthebox11 Posted March 24, 2009 Share Posted March 24, 2009 Hi, I am trying to make a little script here. This is what I have so far: index.php <?php include("$page.html") ?> So when you type something in the address bar like: "site.com/index.php?page=downloads" The page will display the downloads.html. That parts fine. But what I want to know is how can I restrict the pages that this allows? Like only let "downloads, home, and contact us" pages be available? Any and all help appreciated, Thanks -Jack Quote Link to comment Share on other sites More sharing options...
FaT3oYCG Posted March 24, 2009 Share Posted March 24, 2009 sore the information on the pages in a database and then reference them by id instead of name that way the user will only see the id of the page being displayed, take a look at this it works in the way im explaining http://www.gming-network.ath.cx/phpcms/ Quote Link to comment Share on other sites More sharing options...
POG1 Posted March 24, 2009 Share Posted March 24, 2009 include_once('page/'.(isset($_GET['page']) AND ctype_alnum($_GET['page']) AND file_exsists('pages/'.$_GET['page'].'.php') AND in_array($_GET['page'],array('downloads','home','contactus')) ?$_GET['page']:'index').'.php'); Not perfect but its a start. Quote Link to comment Share on other sites More sharing options...
Yesideez Posted March 24, 2009 Share Posted March 24, 2009 switch ($_REQUEST['page']) { case 'games':$pagefile='games.php';break; case 'demos':$pagefile='demos.php';break; case 'contact':$pagefile='contact.php';break; default:$pagefile='index.php'; } That will only let the chosen ones through - anything else and index.php is used. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.