2 require_once 'HTML_DietMarco.php';
3 require_once 'HTML_Login.php';
4 require_once 'MECON/Usuario.php'; //Agregado MANAZAR
6 if(isset($_POST['usuario']))
8 $userid = $_POST['usuario'];
9 $ds = @ldap_connect( 'ldapdist.mecon.ar' )
10 or $ds = @ldap_connect( 'ldapmaster.mecon.ar' );
13 //error connecting - return false
14 echo "Error conectando!\n";
16 @ list( $uid, $domain ) = split( "@", $userid );
17 if(is_null($uid) || is_null($domain))
20 $r = @ ldap_bind($ds, "uid=$uid,ou=Personas,o=$domain,o=gov.ar", $_POST['password']);
22 $sr = @ ldap_search($ds, "ou=Personas,o=$domain,o=gov.ar", "uid=$uid");
23 $info = @ ldap_get_entries($ds, $sr);
29 //error reading / authenticating - return false
34 if(! @ $_POST['usuario'] || ! @ $info[0]['uidnumber'][0])
38 $_SESSION['usuario'] = $_POST['usuario'];
39 $_SESSION['documento'] = $info[0]['uidnumber'][0];
40 // Agregado por culpa de Aldoros
41 $aux = split('-',$_SESSION['documento']);
42 $_SESSION['documento'] = (count($aux) == 3) ? $aux[1] : $aux[0];
44 $MECON_DNI= $info[0]['uidnumber'][0];
45 $MECON_NOMBRE= $info[0]['sn'][0]." ".$info[0]['givenname'][0];
46 $MECON_LOGIN= $_POST['usuario'];
47 $usuario=& new MECON_USUARIO();
48 $usuario->Insertar_Usuario($MECON_DNI,$MECON_LOGIN,$MECON_NOMBRE);
49 // Fin Agregado MANAZAR
55 if(!isset($_SESSION['usuario']) )
57 if((isset($_GET['redirect']) && $_GET['redirect'] == 'sistemas') ||
58 (isset($_POST['redirect']) && $_POST['redirect'] == 'sistemas'))
60 $m = new HTML_DietMarco('sistemas', 'Sistemas');
61 // $m->addTitle('Sistemas');
65 $m = new HTML_DietMarco('servicios', 'Servicios');
66 // $m->addTitle('Servicios');
69 $login = new HTML_Login();
70 if(isset($error) && $error == 1)
71 $login->login_incorrecto = true;//FIXME terminar de prgramar cuando haya ldap
72 $t = new HTML_Table(array('width' => 760,
79 $t->addRow(array($login));
81 $m->addStyleSheet($login->getCSS());
82 $m->addBodyContent($t);
87 if(isset($_SESSION['usuario']) && ! @ $error &&
88 (isset($_POST['redirect']) || isset($_GET['redirect'])))
90 @ $redirect = $_GET['redirect'].$_POST['redirect'];
93 WHERE servicio = $redirect";
94 $link = $DB->getOne($query);
95 if(PEAR::isError($link))
96 header('location: '.$redirect);
98 header('location: '.$link);