]> git.llucax.com Git - mecon/intranet.git/commitdiff
Login redirige cualquier cosa con redirect
authorGonzalo Merayo <merayo@gmail.com>
Thu, 9 Oct 2003 12:57:57 +0000 (12:57 +0000)
committerGonzalo Merayo <merayo@gmail.com>
Thu, 9 Oct 2003 12:57:57 +0000 (12:57 +0000)
sistema/www/login.php

index ca3c860d6e54975c332bfdfb09c1e548d6a2970c..f78827cdd4250e62e0fd0955338ad98625ba59e1 100644 (file)
   if(isset($_SESSION['usuario']) &&
        (isset($_POST['redirect']) || isset($_GET['redirect'])))
   {
-    if((isset($_GET['redirect']) && $_GET['redirect'] == 'sistemas') ||
-       (isset($_POST['redirect']) && $_POST['redirect'] == 'sistemas'))
-    {
-      header('location: sistemas.php');
-      exit;
-    }
+    @ $redirect = $_GET['redirect'].$_POST['redirect'];
+    $db = DB::Connect('mysql://intranet:intranet@bal747f/intranet');
+    $query = "SELECT link
+              FROM servicio
+              WHERE servicio = $redirect";
+    $link = $db->getOne($query);
+    if(PEAR::isError($link))
+      header('location: '.$redirect);
     else
-    {
-      $db = DB::Connect('mysql://intranet:intranet@bal747f/intranet');
-      $query = "SELECT link
-                FROM servicio
-               WHERE servicio = ";
-      if(isset($_POST['redirect'])) $query .= $_POST['redirect'];
-      else                          $query .= $_GET['redirect'];
-      $link = $db->getOne($query);
       header('location: '.$link);
-    }
   } 
 ?>