I just noticed that you edited your last post. When do you want to include one page and when do you want to include more than one file (additional get parameter or certain combination of get parameters) ?
I think it might help if you describe the application a little bit (and what type of data the different includes like page,id and x contain).
I have some code that includes just one page but it needs some tweaking if you want to include more than one page:
<?PHP
// valid pages
$arrValidPages = array("page"=>array("page1","page2","page3"),
"id"=>array("id1","id2","id3"),
"x"=>array("x1","x2","x3"));
// base paths
$arrBasePath = array('page'=>'', 'id'=>'id/', 'x'=>'id/x/');
// include order from least to most important
// we need this since we want to just include one file
// and want to know which one to include if more than one
// get parameters are specified. The true/false values
// are triggers to check if the given key/page is mandatory
$arrGetOrder = array('page'=>true,'id'=>true,'x'=>false);
// set default values for extension,error page and page to include
$strExt = '.php';
$strError = '404.shtml';
$strIncFile = $strError;
// now check the get parameters
foreach ($arrGetOrder as $key => $value) {
if (isset($_GET[$key])) {
// file to include
$strFile = $arrBasePath[$key].$_GET[$key].$strExt;
// get parameter set, check if it is valid
if (in_array($_GET[$key],$arrValidPages[$key]) && is_file($strFile)) {
// valid page
$strIncFile = $strFile;
} else {
// invalid page, show error page
$strIncFile = $strError;
break;
}
} else if ($value === true) {
// get parameter not set but mandatory, show error page
$strIncFile = $strError;
break;
}
}
require_once($strIncFile);
?>
Thomas