![Antiguo](http://static.forosdelweb.com/fdwtheme/images/statusicon/post_old.gif)
22/10/2010, 16:01
|
| | Fecha de Ingreso: octubre-2010
Mensajes: 93
Antigüedad: 14 años, 3 meses Puntos: 0 | |
Respuesta: Validacion de inicio de sesión Este es el archivo valida.php donde se verifica la existencia del usuario y si existe debe mandar a alumnos.php y si no mandar a logIn.php
valida.php
<?php
session_start();
$nom=$_POST["nombreUsuario"];
$cla=$_POST["clave"];
mysql_connect("localhost","root","admin");
mysql_select_db("alumnos");
$sql="SELECT * FROM sesiones WHERE UserName=$nom AND Clave=$cla";
$recordset=mysql_query($sql) or die (mysql_error());
$reg=mysql_fetch_assoc($recordset);
if($reg["UserName"]==$nom && $reg["Clave"]==$cla)
{
$_SESSION["valido"]=true;
$_SESSION["ID"]=$reg["NC"];
$_SESSION["user"]=$reg["NombreUsuario"];
header("Location:alumnos.php");
}
else
{
header("Location:logIn.php");
}
?> |