eccoti il tup script...
se devi aggiungere altre cartelle:
in $dir=array() aggiungi la directory in cui si trovano i files
in $cat=array() aggiungi la chiamata es.: luink.php?chiamata=pagina
mi raccomando solo rispetta gli ordini degli elementi tra i due array
no l'ho provata... sappimi dire
Codice PHP:
<?php
// 2-variables Page Include PHP-script
// Version 1.1
// By [url="http://www.epleweb.tk"][url]www.epleweb.tk[/url][/url]
$mainpage = "./news/show_news.php"; /* Main page that is included if neither cat1 nor cat2 is defined in the URL */
$fileext = ".php"; /* File extension for all pages and tutorials. ".php" by default */
$error404 = "<center>[b]<font size='/2'/>Errore 404</font>[/b]
</center>
Errore 404 ;OOO;!</p>"; /* Error message displayed when a page doesn't exist */
// CONFIGURATION
$dir1 = "./news"; /* The directory where all the pages for category 1 are */
$dir2 = "./sezioni"; /* The directory where all the pages for category 2 are */
$dir3 = "./immagini";
$dir4 = "./commenti";
$dir5 = "./amici";
$dir=array("./news","./sezioni","./images","./comments","./friends");
/* Change the word inside the [' and the '] as you like. I.e ['page'] or ['id'] or ['section'] or whatever */
$cat=Array("news","id","image","comments","friends");
// END OF CONFIGURATION
// If cat1 is defined in the URL:
foreach ($cat as $key=>$page)
{
if (isset($_GET[$key]) && !empty($_GET[$key])
{
$cat1=$_GET[$key];
$flag=1;
$n=0;
foreach($cat as $val)
{
if ($val==$key)
$index=$n;
else
$n++;
}
$cat1 = stripslashes(strip_tags($cat1));
$forbidden1 = ereg("../", $cat1);
$forbidden2 = ereg("/", $cat1);
$forbidden3 = ereg("../", $cat1);
$includepath= $dir[$n] . "/" . $cat1 . $fileext;
if ($forbidden1 || $forbidden2 || $forbidden3)
{
echo "<center><h2>Errore 404</h2>
</center>";
echo "
Errore 404 ;OOO;!</p>";
}
else
{
if (@fopen("$includepath", "r"))
{
include ("$includepath");
}
else
{
if (!(@fopen("$includepath", "r")))
{
echo "$error404";
}
}
}
break;
}
}
// If no category is defined in the URL:
if (!isset($flag))
{
include ("$mainpage");
}
?>