Formulario HTML:
Código HTML:
<html> <head> <title> Bienvenido </title> </head> <body bgcolor = "#252525"> <body text = "#E5E5E5"> <font face = "tahoma"> <body link = "#E5E5E5" vlink = "#E5E5E5"> <h2> IDENTIFICACION </h2> <br><br> <form name ="formuregistro" action = "tres.php" method ="POST" /> <strong>Usuario:</strong> <input type = "text" name = "usuario" /> <br><br> <strong>Contraseña:</strong> <input type = "password" name = "contraseña" /> <br> <input type = "submit" name = "enviar" value = "Enviar datos" /> <br><br><br> <a href="ppal.html"><h4>Volver</h4> </a> </body> </html>
Código PHP:
<?php
$usuario = $_REQUEST['usuario'];
$contraseña = $_REQUEST['contraseña'];
$conexion = mysql_connect("localhost", "root", "") or die("Problemas en la conexion");
mysql_select_db("usuarios", $conexion) or die ("Problema al seleccionar bd");
$consulta = mysql_query("SELECT * FROM personas WHERE login='$usuario' AND contraseña='$contraseña'");
if($login_persona = mysql_fetch_array($consulta)){
$_SESSION['usuario']=$usuario;
echo "<META HTTP-EQUIV='refresh' CONTENT='4; url=bienvenido.html'>";
}
else{
echo "el usuario no existe";
}
?>