Code: Select all
<?php
$thefile = "$page.php";
include($thefile);
?>Moderator: General Moderators
Code: Select all
<?php
$thefile = "$page.php";
include($thefile);
?>Code: Select all
include($_GETї'page'].'php');Code: Select all
$page = (empty($_GETї'page']) ? 'mainpage' : $_GETї'goto']);Code: Select all
$approved = array('mainpage','page423,'other','somepage');Code: Select all
if (in_array($page,$approved) && file_exists($page.'.php');
{
//this is where you insert the page
include($_GETї'page'].'php');
}
else
{
//include a file with an error
include('404.html');
}Code: Select all
include($_GETї'page'].'php');Short answer is, no. And why would you want to URL to be domain.com all the time...Supremacy wrote:wouldent it be more easy just to make a frameset on top of the site??
that way the url allways says http://www.your-domain.com ?
I have just asked your script to run a script in an entirely different directory and its effects may be devastating.
Phenom wrote: and then check if it exists in the approved list
Code: Select all
if (in_array($page,$approved) && file_exists($page.'.php'); { //this is where you insert the page include($_GETї'page'].'php'); } else { //include a file with an error include('404.html'); }
It's REALLY nice when your working with subdomains, that way you can hide your pages.Phenom wrote:Short answer is, no. And why would you want to URL to be domain.com all the time...Supremacy wrote:wouldent it be more easy just to make a frameset on top of the site??
that way the url allways says http://www.your-domain.com ?