From 984ff3a96aafa2d66c4275a37971e9f215092232 Mon Sep 17 00:00:00 2001 From: x2000habouzit Date: Mon, 9 Feb 2004 13:55:38 +0000 Subject: [PATCH] =?utf8?q?r=E9cup?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- etat_migration | 4 ++-- htdocs/redirect/error.php | 13 +++++++++++++ htdocs/redirect/redirect.php | 41 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 56 insertions(+), 2 deletions(-) create mode 100644 htdocs/redirect/error.php create mode 100644 htdocs/redirect/redirect.php diff --git a/etat_migration b/etat_migration index 186c2d9..98a5ac8 100644 --- a/etat_migration +++ b/etat_migration @@ -98,8 +98,6 @@ Etat | Ancien nom | Nouveau nom | profil.php | | profil2.php | | recherche.php | - | redirect/error.php | - | redirect/redirect.php | | trombino.php | | trombipromo.php | | x.php | @@ -137,6 +135,8 @@ Etat | Ancien nom | Nouveau nom ------+-------------------------------------------+---------------- @@@ | groupex/donne-chall.php | - @@@ | groupex/export-econfiance.php | - +@@@ | redirect/error.php | - +@@@ | redirect/redirect.php | - x | epouse.php | - x | parselog.php | stats/... xx | AccesPermanentOff.php | cookie_off.php diff --git a/htdocs/redirect/error.php b/htdocs/redirect/error.php new file mode 100644 index 0000000..c24f771 --- /dev/null +++ b/htdocs/redirect/error.php @@ -0,0 +1,13 @@ + + + + +404 Not Found + +

Not Found

+The requested URL was not found on this server.

+


+
Apache Server at www.carva.org Port 80
+ diff --git a/htdocs/redirect/redirect.php b/htdocs/redirect/redirect.php new file mode 100644 index 0000000..6b3c170 --- /dev/null +++ b/htdocs/redirect/redirect.php @@ -0,0 +1,41 @@ +"; +var_dump($_SERVER); +echo "";*/ + +// on coupe la chaîne REQUEST_URI selon les / et on ne garde que +// le premier non vide et éventuellement le second +// la config d'apache impose la forme suivante pour REQUEST_URI : +// REQUEST_URI = /prenom.nom(/path/fichier.hmtl)? +list($username, $path) = preg_split('/\//', $_SERVER["REQUEST_URI"], 2, PREG_SPLIT_NO_EMPTY); + +$result = mysql_query("select redirecturl from auth_user_md5 where username= '$username' or alias = '$username'"); +if ($result and list($url) = mysql_fetch_row($result) and $url != '') { + // on envoie un redirect (PHP met automatiquement le code de retour 302 + if (!empty($path)) { + if (substr($url, -1, 1) == "/") + $url .= $path; + else + $url .= "/" . $path; + } + header("Location: http://$url"); + exit(); +} + +// si on est ici, il y a eu un erreur ou on n'a pas trouvé le redirect +header("HTTP/1.0 404 Not Found"); + +?> + + + +404 Not Found + +

Not Found

+The requested URL was not found on this server.

+


+
Apache Server at www.carva.org Port 80
+ -- 2.1.4