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 );
19 $r = @ldap_bind($ds, "uid=$uid,ou=Personas,o=$domain,o=gov.ar", $_POST['password']);
21 $sr = @ldap_search($ds, "ou=Personas,o=$domain,o=gov.ar", "uid=$uid");
22 $info = @ldap_get_entries($ds, $sr);
27 //error reading / authenticating - return false
32 $_SESSION['usuario'] = $_POST['usuario'];
33 $_SESSION['documento'] = $info[0]['uidnumber'][0];
36 $MECON_DNI= $info[0]['uidnumber'][0];
37 $MECON_NOMBRE= $info[0]['sn'][0]." ".$info[0]['givenname'][0];
38 $MECON_LOGIN= $_POST['usuario'];
39 $usuario=& new MECON_USUARIO();
40 $usuario->Insertar_Usuario($MECON_DNI,$MECON_LOGIN,$MECON_NOMBRE);
41 // Fin Agregado MANAZAR
46 if(!isset($_SESSION['usuario']))
48 if((isset($_GET['redirect']) && $_GET['redirect'] == 'sistemas') ||
49 (isset($_POST['redirect']) && $_POST['redirect'] == 'sistemas'))
51 $m = new HTML_DietMarco('sistemas', 'Sistemas');
52 $m->addTitle('Sistemas');
56 $m = new HTML_DietMarco('servicios', 'Servicios');
57 $m->addTitle('Servicios');
60 $login = new HTML_Login();
61 if(isset($error) && $error == 1)
62 $login->login_incorrecto = true;//FIXME terminar de prgramar cuando haya ldap
63 $t = new HTML_Table(array('width' => 760,
70 $t->addRow(array($login));
72 $m->addStyleSheet($login->getCSS());
73 $m->addBodyContent($t);
78 if(isset($_SESSION['usuario']) &&
79 (isset($_POST['redirect']) || isset($_GET['redirect'])))
81 if((isset($_GET['redirect']) && $_GET['redirect'] == 'sistemas') ||
82 (isset($_POST['redirect']) && $_POST['redirect'] == 'sistemas'))
84 header('location: sistemas.php');
89 $db = DB::Connect('mysql://intranet:intranet@bal747f/intranet');
93 if(isset($_POST['redirect'])) $query .= $_POST['redirect'];
94 else $query .= $_GET['redirect'];
95 $link = $db->getOne($query);
96 header('location: '.$link);