<?
//inc.php
//Use this var for your pages:
$page[1] = "here.php";
$page[2] = "here1.php";
$page[3] = "here2.php";
$page[4] = "here3.php";
?>
<?
//there.php
//includes the pages
include('inc.php')
//gets the variable from the query string
$pageid = @$HTTP_GET_VARS['pageid'];
//checks to see if the query string exsists
if(!$pageid)
{
echo "error";
exit();
}
$address = $page[$pageid];
header('Location:' . $address . '');
?>
Originally posted by spec
once again I would recommend using ids
here we go
Create a include file called inc.php
PHP:<? //inc.php //Use this var for your pages: $page[1] = "here.php"; $page[2] = "here1.php"; $page[3] = "here2.php"; $page[4] = "here3.php"; ?>
Then create your parser
Say the URL is this:
http://www.here.com/there.php?pageid=1
here would be your parser:
PHP:<? //there.php //includes the pages include('inc.php') //gets the variable from the query string $pageid = @$HTTP_GET_VARS['pageid']; //checks to see if the query string exsists if(!$pageid) { echo "error"; exit(); } $address = $page[$pageid]; header('Location:' . $address . ''); ?>
the only problem with this code is if you enter an invalid pageid it will produce an error
<?
//inc.php
//Use this var for your pages:
/*these are your pages change here1.php (and all the rest of the heres to what your pages are
*/
$page[1] = "test.html";
$page[2] = "here1.php";
$page[3] = "here2.php";
$page[4] = "here3.php";
?>
<?
//there.php
//includes the pages
include('inc.php')
//gets the variable from the query string
$pageid = @$HTTP_GET_VARS['pageid'];
//checks to see if the query string exsists
if(!$pageid)
{
echo "error";
exit();
}
$address = $page[$pageid];
header('Location:' . $address . '');
?>
<?
//there.php
//includes the pages
include('inc.php');
//gets the variable from the query string
$pageid = @$HTTP_GET_VARS['pageid'];
//checks to see if the query string exsists
if(!$pageid)
{
echo "error";
exit();
}
$address = $page[$pageid];
header('Location:' . $address . '');
?>