X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=htdocs%2Fwebredirect.php;h=8ba42f932f9c4803efe5972f87ddacdb93ff9ed1;hb=e153e57a59576be2652bb4dd49d3668757a219ae;hp=dc7e761be9b382d4d141c44aa6298716f0ee909e;hpb=0c86c2ea637570f446fb109029ebb72a9e78508f;p=platal.git diff --git a/htdocs/webredirect.php b/htdocs/webredirect.php index dc7e761..8ba42f9 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'); ?> @@ -57,5 +56,5 @@ header("HTTP/1.0 404 Not Found");