X-Git-Url: https://git.llucax.com/mecon/intranet.git/blobdiff_plain/30b342a8563ec023a0fdd4b37a690bd21311c33a..2175273b54918d3d8f474034ca2cb5def9f11fb2:/sistema/www/login.php?ds=sidebyside diff --git a/sistema/www/login.php b/sistema/www/login.php index e15ebb0..1ef3775 100644 --- a/sistema/www/login.php +++ b/sistema/www/login.php @@ -1,62 +1,72 @@ Insertar_Usuario($MECON_DNI,$MECON_LOGIN,$MECON_NOMBRE); - // Fin Agregado MANAZAR - + if(! @ $_POST['usuario'] || ! @ $info[0]['uidnumber'][0]) + $error = true; + else + { + $_SESSION['usuario'] = $_POST['usuario']; + $_SESSION['documento'] = $info[0]['uidnumber'][0]; + // Agregado por culpa de Aldoros + $aux = split('-',$_SESSION['documento']); + $_SESSION['documento'] = (count($aux) == 3) ? $aux[1] : $aux[0]; + // Agregado MANAZAR + $MECON_DNI= $info[0]['uidnumber'][0]; + $MECON_NOMBRE= $info[0]['sn'][0]." ".$info[0]['givenname'][0]; + $MECON_LOGIN= $_POST['usuario']; + $usuario=& new MECON_USUARIO($DB); + $usuario->Insertar_Usuario($MECON_DNI,$MECON_LOGIN,$MECON_NOMBRE); + // Fin Agregado MANAZAR + } } - }else{ - if(!isset($_SESSION['usuario'])) + } + + { + if(!isset($_SESSION['usuario']) ) { - if((isset($_GET['redirect']) && $_GET['redirect'] == 'sistemas') || - (isset($_POST['redirect']) && $_POST['redirect'] == 'sistemas')) - { - $m = new HTML_DietMarco('sistemas'); - $m->addTitle('Sistemas'); + if (preg_match('/sistemas/', @$_REQUEST['redirect']) || @$_REQUEST['embperl']) { + $m = new HTML_DietMarco('sistemas', 'Sistemas'); +// $m->addTitle('Sistemas'); } else { - $m = new HTML_DietMarco('servicios'); - $m->addTitle('Servicios'); + $m = new HTML_DietMarco('servicios', 'Servicios'); +// $m->addTitle('Servicios'); } $login = new HTML_Login(); + if(isset($error) && $error == 1) + $login->login_incorrecto = true; $t = new HTML_Table(array('width' => 760, 'align' => 'center', 'cellspacing' => 0, @@ -72,25 +82,25 @@ } } - if(isset($_SESSION['usuario']) && - (isset($_POST['redirect']) || isset($_GET['redirect']))) + if(isset($_SESSION['usuario']) && ! @ $error && + (@$_REQUEST['redirect'])) { - if((isset($_GET['redirect']) && $_GET['redirect'] == 'sistemas') || - (isset($_POST['redirect']) && $_POST['redirect'] == 'sistemas')) - { - header('location: sistemas.php'); - exit; + $redirect = $_REQUEST['redirect']; + $query = "SELECT link + FROM servicio + WHERE servicio = $redirect"; + $link = $DB->getOne($query); + if(PEAR::isError($link)) { + + if (@$_REQUEST['embperl']) { + header('Location: /Php2Embperl_Session?redirect='.$redirect); + } + else { + 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); - } - } + } + ?>