X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=htdocs%2Fwebredirect.php;h=befcdabd4b3e58411f2265bd9b2ca748e45c63c7;hb=fb813fb52d5ab65ca9a5b92b5cb9089523380d79;hp=cca10b1d54ec87cf9a8584000c925200007f06d4;hpb=730a173a333507926e0029d8a96c3a26b55756e4;p=platal.git diff --git a/htdocs/webredirect.php b/htdocs/webredirect.php index cca10b1..befcdab 100644 --- a/htdocs/webredirect.php +++ b/htdocs/webredirect.php @@ -1,6 +1,6 @@ pl_self(), '/'); +@list($username, $path) = explode('/', $path, 2); -if ($url = $res->fetchOneCell()) { - $url = preg_replace('@/+$@', '', $url); - if ($path) { - http_redirect("http://$url/$path"); - } else { - http_redirect("http://$url"); +if ($username && !is_null($user = User::getSilent($username))) { + $url = XDB::fetchOneCell('SELECT url + FROM carvas + WHERE uid = {?}', $user->id()); + if ($url) { + $url = preg_replace('@/+$@', '', $url); + if ($path) { + http_redirect("http://$url/$path"); + } else { + http_redirect("http://$url"); + } } } -header("HTTP/1.0 404 Not Found"); - +header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found'); ?> @@ -53,5 +54,7 @@ header("HTTP/1.0 404 Not Found");
Apache Server at www.carva.org Port 80
+ +