X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=htdocs%2Fwebredirect.php;h=109346982c2ebe3c10f1aa0c6b193f4f3cdb8714;hb=0001ba7a34dc3b535407cb1b961781c3c69c0ccd;hp=9bae428a68bc9c0bc69b4c522aa11d9fd31e94b0;hpb=d9a33f98749460b66f1d282a29579dce540a459c;p=platal.git diff --git a/htdocs/webredirect.php b/htdocs/webredirect.php index 9bae428..1093469 100644 --- a/htdocs/webredirect.php +++ b/htdocs/webredirect.php @@ -1,6 +1,6 @@ assign('xorg_title','Polytechnique.org - Redirection de page WEB'); +require_once 'xorg.inc.php'; -$log =& Session::getMixed('log'); -$url = Env::get('url'); +$platal = new Xorg('core'); -if ((Env::get('submit') == 'Valider' or Env::get('submit') == 'Modifier') and Env::has('url')) { - if ($globals->xdb->execute('UPDATE auth_user_quick SET redirecturl = {?} WHERE user_id = {?}', - $url, Session::getInt('uid'))) - { - $log->log('carva_add', 'http://'.Env::get('url')); - $page->trig("Redirection activée vers $url"); - } else { - $page->trig('Erreur de mise à jour'); - } -} elseif (Env::get('submit') == "Supprimer") { - if ($globals->xdb->execute("UPDATE auth_user_quick SET redirecturl = '' WHERE user_id = {?}", Session::getInt('uid'))) - { - $log->log("carva_del", $url); - Post::kill('url'); - $page->trig('Redirection supprimée'); - } else { - $page->trig('Erreur de suppression'); +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"); + } } } - -$res = $globals->xdb->query('SELECT redirecturl FROM auth_user_quick WHERE user_id = {?}', Session::getInt('uid')); -$page->assign('carva', $res->fetchOneCell()); - -$page->run(); +header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found'); +?> + + + + 404 Not Found + + +

Not Found

+ The requested URL was not found on this server.

+


+
Apache Server at www.carva.org Port 80
+ + +