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 (@$_REQUEST['redirect'] == 'sistemas' || @$_REQUEST['embperl']) {
58 $m = new HTML_DietMarco('sistemas', 'Sistemas');
59 // $m->addTitle('Sistemas');
63 $m = new HTML_DietMarco('servicios', 'Servicios');
64 // $m->addTitle('Servicios');
67 $login = new HTML_Login();
68 if(isset($error) && $error == 1)
69 $login->login_incorrecto = true;//FIXME terminar de prgramar cuando haya ldap
70 $t = new HTML_Table(array('width' => 760,
77 $t->addRow(array($login));
79 $m->addStyleSheet($login->getCSS());
80 $m->addBodyContent($t);
85 if(isset($_SESSION['usuario']) && ! @ $error &&
86 (@$_REQUEST['redirect']))
88 $redirect = $_REQUEST['redirect'];
91 WHERE servicio = $redirect";
92 $link = $DB->getOne($query);
93 if(PEAR::isError($link)) {
95 if (@$_REQUEST['embperl']) {
96 header('Location: /Php2Embperl_Session?redirect='.$redirect);
99 header('Location: '.$redirect);
103 header('location: '.$link);