X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=htdocs%2Fwebredirect.php;h=572042f36517c037c698c1295b76fb95e45ab241;hb=bd5dad646a43b336ede8c679389a3448b5d7f2a3;hp=bd9e5a955522bb8e665ad58779ee917906c4b7f1;hpb=a3eb0113794362498be38b1a42f65aa2bcdec2a1;p=platal.git diff --git a/htdocs/webredirect.php b/htdocs/webredirect.php index bd9e5a9..572042f 100644 --- a/htdocs/webredirect.php +++ b/htdocs/webredirect.php @@ -1,6 +1,6 @@ fetchOneCell()) { - $url = preg_replace('@/+$@', '', $url); - if ($path) { - http_redirect("http://$url/$path"); - } else { - http_redirect("http://$url"); +global $globals; +$path = ltrim($platal->pl_self(), '/'); +@list($username, $path) = explode('/', $path, 2); + +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,3 +55,6 @@ header("HTTP/1.0 404 Not Found");
Apache Server at www.carva.org Port 80
+