X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=htdocs%2Fwebredirect.php;h=befcdabd4b3e58411f2265bd9b2ca748e45c63c7;hb=c76545c351fae4e2298624ff9ee5bf854dc5a5b6;hp=5246d816e3e6671272f5ff47b8491930f41a94ec;hpb=a7de4ef724d1a3b0bf978a50ce7cc9d23412c7a0;p=platal.git diff --git a/htdocs/webredirect.php b/htdocs/webredirect.php index 5246d81..befcdab 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'); ?> @@ -51,5 +54,7 @@ header("HTTP/1.0 404 Not Found");
Apache Server at www.carva.org Port 80
+ +