2 require_once '../local_lib/HTML_DietMarco.php';
3 require_once '../local_lib/HTML_Login.php';
5 require_once 'MECON/Usuario.php'; //Agregado MANAZAR
7 if(isset($_POST['usuario']))
9 $userid = $_POST['usuario'];
10 $ds = @ldap_connect( "ldapdist.mecon.ar" )
11 or $ds = @ldap_connect( "ldapmaster.mecon.ar" );
14 //error connecting - return false
15 echo "Error conectando!\n";
17 @ list( $uid, $domain ) = split( "@", $userid );
18 if(is_null($uid) || is_null($domain))
21 $r = @ ldap_bind($ds, "uid=$uid,ou=Personas,o=$domain,o=gov.ar", $_POST['password']);
23 $sr = @ ldap_search($ds, "ou=Personas,o=$domain,o=gov.ar", "uid=$uid");
24 $info = @ ldap_get_entries($ds, $sr);
30 //error reading / authenticating - return false
35 if(! @ $_POST['usuario'] || ! @ $info[0]['uidnumber'][0])
39 $_SESSION['usuario'] = $_POST['usuario'];
40 $_SESSION['documento'] = $info[0]['uidnumber'][0];
41 // Agregado por culpa de Aldoros
42 $aux = split('-',$_SESSION['documento']);
43 $_SESSION['documento'] = (count($aux) == 3) ? $aux[1] : $aux[0];
45 $MECON_DNI= $info[0]['uidnumber'][0];
46 $MECON_NOMBRE= $info[0]['sn'][0]." ".$info[0]['givenname'][0];
47 $MECON_LOGIN= $_POST['usuario'];
48 $usuario=& new MECON_USUARIO();
49 $usuario->Insertar_Usuario($MECON_DNI,$MECON_LOGIN,$MECON_NOMBRE);
50 // Fin Agregado MANAZAR
56 if(!isset($_SESSION['usuario']) )
58 if((isset($_GET['redirect']) && $_GET['redirect'] == 'sistemas') ||
59 (isset($_POST['redirect']) && $_POST['redirect'] == 'sistemas'))
61 $m = new HTML_DietMarco('sistemas', 'Sistemas');
62 // $m->addTitle('Sistemas');
66 $m = new HTML_DietMarco('servicios', 'Servicios');
67 // $m->addTitle('Servicios');
70 $login = new HTML_Login();
71 if(isset($error) && $error == 1)
72 $login->login_incorrecto = true;//FIXME terminar de prgramar cuando haya ldap
73 $t = new HTML_Table(array('width' => 760,
80 $t->addRow(array($login));
82 $m->addStyleSheet($login->getCSS());
83 $m->addBodyContent($t);
88 if(isset($_SESSION['usuario']) && ! @ $error &&
89 (isset($_POST['redirect']) || isset($_GET['redirect'])))
91 @ $redirect = $_GET['redirect'].$_POST['redirect'];
92 $db = DB::Connect('mysql://intranet:intranet@bal747f/intranet');
95 WHERE servicio = $redirect";
96 $link = $db->getOne($query);
97 if(PEAR::isError($link))
98 header('location: '.$redirect);
100 header('location: '.$link);