-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvalidar.php
More file actions
32 lines (31 loc) · 1009 Bytes
/
validar.php
File metadata and controls
32 lines (31 loc) · 1009 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php
session_start();
//Conectamos con la base de datos
$link=mysql_connect("localhost","root","gigoreales");
mysql_select_db("proyecto",$link);
//Comprobación de los datos
$sentencia="SELECT nombre_usuario FROM formulario WHERE nombre_usuario= '".$_POST["login"]."' and password= '".$_POST["password"]."'";
$result=mysql_query($sentencia);
$num=mysql_num_rows($result);
if($num==0)
echo ("<script language=\"javascript\">alert('Los datos no son validos');document.location.href=\"iniciar-sesion.html\";</script>");
else{
//Registramos en sesión la variable $id_cliente
$_SESSION["nombre_usuario"]=$_POST["login"];
echo("<html>
<body>
<table width=\"500\" align=\"center\">
<tr>
<td align=\"center\"><br/><br/>Validación de Usuario<br/></td>
</tr>
<tr>
<td align=\"center\">Bienvenido, <B>".$_SESSION["nombre_usuario"]."</B><BR /></td>
<td align=\"center\"><a href=\"cerrarsesion.php\">Cerrar Sesión</a></td>
</tr>
<tr>
</table>
</body>
</html>
");
}
?>