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];
42 $MECON_DNI= $info[0]['uidnumber'][0];
43 $MECON_NOMBRE= $info[0]['sn'][0]." ".$info[0]['givenname'][0];
44 $MECON_LOGIN= $_POST['usuario'];
45 $usuario=& new MECON_USUARIO();
46 $usuario->Insertar_Usuario($MECON_DNI,$MECON_LOGIN,$MECON_NOMBRE);
47 // Fin Agregado MANAZAR
53 if(!isset($_SESSION['usuario']) )
55 if((isset($_GET['redirect']) && $_GET['redirect'] == 'sistemas') ||
56 (isset($_POST['redirect']) && $_POST['redirect'] == 'sistemas'))
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 (isset($_POST['redirect']) || isset($_GET['redirect'])))
88 @ $redirect = $_GET['redirect'].$_POST['redirect'];
89 $db = DB::Connect('mysql://intranet:intranet@bal747f/intranet');
92 WHERE servicio = $redirect";
93 $link = $db->getOne($query);
94 if(PEAR::isError($link))
95 header('location: '.$redirect);
97 header('location: '.$link);