<script language=javascript>
function passwordinvalido()
{
// parent.location.href = 'NotLogin.php';
parent.central.location.href='NotLogin.php';
}
function usuarioinvalido()
{
parent.central.location.href='usuarioinvalido.php';
}
function administrador1()
{
parent.arriba.location.href='barrabotones.php';
}
function administrador2()
{
parent.central.location.href='bienvenido.php';
}
function usuario1()
{
parent.arriba.location.href='barrabotonesusuario.php';
}
function usuario2()
{
parent.central.location.href='bienvenido.php';
}
function destuirsession1()
{
parent.arriba.location.href='barraLogin.php'
}
function destuirsession2()
{
parent.central.location.href='cierresesion.php';
}
</script
<?php
include "dblogin.php";
$dblogin = new cdbLogin;
$odbc_sat_server = "SatReparacionesOdbc";
$odbc_sat_USER= "";
$odbc_sat_PASS= "";
$dblogin->conexion($odbc_sat_server, $odbc_sat_USER, $odbc_sat_PASS);
//$_SESSION['loged'] = 0;
$disabledusario='""';
$disabledcontraseña='""';
$disabledlogin='""';
$class ='class = "textlogin"';
$classtabla='""';
{
$acceder = $_GET['acceder'];
}
if( isset($_GET['acceder']) ) $acceder = $_GET['acceder'];
$_SESSION['permiso'] = 0;
switch ( $acceder)
{
case 'login':
if( $_SESSION['permiso'] == 0 )
{
$check_user = $_GET['usuario'];
$existeUsuario = $dblogin->usuarioexite($check_user);
if ( $existeUsuario != 0 )
{
if( isset ( $_GET['contraseña']) ) {
$password = $_GET['contraseña'];
$existeContraseña = $dblogin->contraseñaExiste($check_user,$password);
if ($existeContraseña != 0 )
{
$permiso = $dblogin->login($check_user,$password);
if ( $permiso == 1 )
{
$_SESSION['permiso'] = $permiso;
/*$redirect = $_SERVER['PHP_SELF'];
header("Refresh:5;URL =marco2.php?redirect=$redirect");*/
?>
<script language=javascript>administrador1()</script>
<?php;
?>
<script language=javascript>administrador2()</script>
<?php;
$disabledusario='disabled="disabled"';
$disabledcontraseña='disabled="disabled"';
$disabledlogin='disabled="disabled"';
$class ='class = "inputtext"';
$classtabla='class = "inputtext"';
}
// DE MOMENTO SOLO HAY DOS POSIBILIDADES PERMISO = 1 E = 2 , EN UN FUTURO HABRA QUE IMPLEMENTAR ESTAS OPCIONES
else
{
$disabledusario='disabled="disabled"';
$disabledcontraseña='disabled="disabled"';
$disabledlogin='disabled="disabled"';
$class ='class = "inputtext"';
$classtabla='class = "inputtext"';
$_SESSION['permiso'] = $permiso;
$_SESSION['auntentificado'] = true;
?>
<script language=javascript>usuario1()</script>
<?php;
?>
<script language=javascript>usuario2()</script>
<?php;
}
}
else
{
?>
<script language=javascript>passwordinvalido()</script>
<?php;
}
}
}
else
{
?>
<script language=javascript>usuarioinvalido()</script>
<?php;
}
}
else
{
echo ( "debes cerrar la session primero");
}
break;
case 'logout':
/*session_unset();
session_destroy();*/
?>
<script language=javascript>destuirsession1()</script>
<script language=javascript>destuirsession2()</script>
<?php;
break;
}
?>
<html>
<head>
<title>
</title>
<link href="Css1/style_new1.css" rel="stylesheet" type="text/css" />
</head>
<body class="tablebotonesprincipales">
<form action ="lateral.php" method = "GET">
<input type ="hidden" name="redirect" value="<?php echo $_GET['redirect'];?>">
<?php
echo '<TABLE width="130" height = "380" CELLSPACING="1" CELLPADDING="1" align = "center" >
<tr>
<td>
<table width="55%" height = "60%" CELLSPACING="1" CELLPADDING="1" align = "center" >
<TR>
<TD ' . $classtabla . ' >Usuario:<br><INPUT ' . $class .' TYPE ="TEXT" NAME="usuario" alight = "left" ' . $disabledusario .' ></input>
</td>
</TR>
<TD ' . $classtabla . ' >Contraseña:<br><INPUT ' . $class .' type="password" NAME="contraseña" alight = "left" ' . $disabledcontraseña .'></input>
</td>
</tr>';?>
<td align = "center">
<?php
if ( $_SESSION['permiso'] != 0 )
{
echo
'<input type = "submit" name = "acceder" value="login" disabled="disabled" ' . $class . '></input>
Usuario conectado:
' . $check_user . ' ';
}
else
{
echo
'<input type = "submit" class ="button" name = "acceder" value="login" ></input>';
}
?>
</tr>
<tr>
<TD height = "15%" align = "center">
</td>
</tr>
<tr>
<td align = "center">
<?php
if ( $_SESSION['permiso'] != 0 )
{
echo
'<input type = "submit" class ="button" name = "acceder" value="logout" >';
}
else
{
echo
'<input type = "submit" class ="button" name = "acceder" value="logout" disabled="disabled" >';
}
?>
</td>
</tr>
</TABLE>
</td>
<td>
</tr>
</table>
</form>
<?php
?>
</body>
</html>