Ever wanted to learn how to do that? Loading pages through the index?
Well I will teach you how to do it a good way, fast and secure.
Dated: 2008-02-20 20:53:43
Re: Loading pages like index.php?page=staffThe method I use is :// if no parameter passed to index.php then show the default page (default.php)// otherwise show the selected article (articleX_content.php// List accepted input parameters$ACCEPT_FILE['page1'] = 'page1.php';$ACCEPT_FILE['page2'] = 'page2.php';// get php version to see which method to use to parse imput variables$php_ver = phpversion();$php_ver = explode(".", $php_ver);$phpver = "$php_ver[0]$php_ver[1]";if ($phpver >= 41) {$page = $_GET['page'];} else {$page = $HTTP_GET_VARS['page'];}$pagename = $ACCEPT_FILE[$page]; // if no input variable show the default page otherwise show selected pageif (!isSet($pagename)) $pagename = "default.php"; // default fileinclude("$pagename"); //// Example of how to conditionally include extra stuff only on certain pages//// If we wanted to show some user action buttons (e.g. print, email, pdf, etc) immediatly after// the page1.php contents then we could use the foillowing code :// if (($pagename) == "page1.php") include("page_user_actions.php");
Sent by:
ParadroidDated: 2005-11-14 21:27:42
Re: Loading pages like index.php?page=staffhey, don't foregett about using some good functions;)
if($_GET['act']==books){
include('books.php');
}
if($_GET['act']==NULL){
die("lamo-hacker go away :)")
}
if(strlen($_GET['act']) => 100){
die("veeeeeeery long query")
}
else{
die("Page unexists");
}
Sent by:
Slayter2