xD, lo sapevo di scrivere arabo xDDD...
Comunque mi serviva un robo del genere:
link.php?id=ciao o simile...
Il codice che uso io mi permette di fare ciò, ma i file devono stare tutti in un'unica cartella... Ecco lo script:
Codice PHP:
<?php
// 2-variables Page Include PHP-script
// Version 1.1
// By [url]www.epleweb.tk[/url]
// 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 */
$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 */
/* Change the word inside the [' and the '] as you like. I.e ['page'] or ['id'] or ['section'] or whatever */
$cat1 = $_GET['news']; /* Example: [url]http://www.dot.com/index.php?cat1=mypage[/url] */
$cat2 = $_GET['id']; /* Example: [url]http://www.dot.com/index.php?cat2=mypage[/url] */
// END OF CONFIGURATION
// If cat1 is defined in the URL:
if (isset($cat1)) {
$cat1 = stripslashes(strip_tags($cat1));
$forbidden1 = ereg("\.\./", $cat1);
$forbidden2 = ereg("/", $cat1);
$forbidden3 = ereg("\.\./", $cat1);
$includepath= $dir1 . "/" . $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";
}
}
}
}
// If cat2 is defined in the URL:
elseif (isset($cat2)) {
$cat2 = stripslashes(strip_tags($cat2));
$forbidden1 = ereg("\.\./", $cat2);
$forbidden2 = ereg("/", $cat2);
$forbidden3 = ereg("/", $cat2);
$includepath= $dir2 . "/" . $cat2 . $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";
}
}
}
}
// If no category is defined in the URL:
else {
include ("$mainpage");
}
?>