Viewing file: index.php (3.55 KB) -rw-rw-rw- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?
// Configura la información de tu cuenta
$dbhost='192.168.10.3';
$dbusername='jaime';
$dbuserpass='123';
$dbname='pev';
session_start();
if($entrar){
// Conectar a la base de datos
mysql_connect ($dbhost, $dbusername, $dbuserpass);
mysql_select_db($dbname) or die('Cannot select database');
if ($_POST['username']) {
//Comprobacion del envio del nombre de usuario y password
$username=$_POST['username'];
$password=$_POST['password'];
if ($password==NULL) {
echo '<script languaje="JavaScript">
// self.close()
alert("Falto digitar la contraseña");
document.location.href="index.php";
</script>';
}else{
$query = mysql_query("SELECT username,password FROM users WHERE username = '$username'") or die(mysql_error());
$data = mysql_fetch_array($query);
if($data['password'] != $password) {
//echo "Login incorrecto";
echo '<script languaje="JavaScript">
// self.close()
alert("Login incorrecto");
document.location.href="index.php";
</script>';
}else{
$query = mysql_query("SELECT username,password,area FROM users WHERE username = '$username'") or die(mysql_error());
$row = mysql_fetch_array($query);
$_SESSION["s_username"] = $row['username'];
$_SESSION["s_area"] = $row['area'];
// echo "Has sido logueado correctamente ".$_SESSION['s_area']." y puedes acceder al acceso.php. ";
//$s_area= ".$_SESSION['s_area'].";
$s_area= $row['area'];
if ($s_area == 'legal')
{
$link ="dla.php";
}
if ($s_area == 'tecnica')
{
$link ="tecnica.php";
}
if ($s_area == 'notificaciones')
{
$link ="notificaciones.php";
}
echo "<div align='center'><img src='imagenes/cargando1.gif'> </div>";
echo '<script LANGUAGE="JavaScript">
var pagina="http://127.0.0.1/pev/'.$link.'"
function redireccionar()
{
document.location.href= pagina
}
setTimeout ("redireccionar()", 3000);
</script>';
}
}
}
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Acceso</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
@import url("miraflores.css");
-->
</style>
<link href="css/jctribin.css" rel="stylesheet" type="text/css">
</head>
<body>
<form action='index.php' method='POST'>
<table width="650" height="350" align="center" background="imagenes/userid_bg.gif" style='border:1px solid #000000;'>
<tr>
<td width="865" align='right'> <p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p><font face="Broadway">Usuario</font>
<input type='text' size='15' maxlength='25' name='username' class="textohome">
</p></td>
</tr>
<tr>
<td align='right'> <font face="Broadway">Clave</font>
<input type='password' size='15' maxlength='25' name='password' class="textohome">
</td>
</tr>
<tr>
<td align='right'>
<input name="entrar" type="submit" id="entrar" value="Entrar">
</td>
</tr>
<?
if($confirm == '1')
{
echo "
<tr>
<td align='center'> <p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p></td>
</tr>";
}
?>
</table>
</form>
</body>
</html>
|