X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=htdocs%2Fwebredirect.php;h=572042f36517c037c698c1295b76fb95e45ab241;hb=bd803525db63a497d3b1b5ee90e5b560e9fc60f1;hp=d5ef5474b564fa6837b1ad0e0933d09fda7ecec9;hpb=a40328ac43945999042f31fe7388406b3354350f;p=platal.git diff --git a/htdocs/webredirect.php b/htdocs/webredirect.php index d5ef547..572042f 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
+ +