Ver Mensaje Individual
  #3 (permalink)  
Antiguo 04/12/2005, 07:52
amena
 
Fecha de Ingreso: febrero-2002
Mensajes: 52
Antigüedad: 22 años, 2 meses
Puntos: 0
ok este es el codigo de index.php

<html>
<head>
<title>Autentificación php</title>
</head>
<body>
<h1>Autentificación php</h1>
<form action="control.php" method="POST">
<table align="center" width="225" cellspacing="2" cellpadding="2" border="0">
<tr>
<td colspan="2" align="center"
bgcolor=#cccccc>Introduce tu clave de acceso
</td>
</tr>
<tr>
<td align="right">USER:</td>
<td><input type="Text" name="usuario" size="8" maxlength="50"></td>
</tr>
<tr>
<td align="right">PASSWD:</td>
<td><input type="password" name="contrasena" size="8" maxlength="50"></td>
</tr>
<tr>
<td colspan="2" align="center"><input type="Submit" value="ENTRAR"></td>
</tr>
</table>
</form>
<br>
<br>
Datos correctos:
<br>
<br>
User: miguel
<br>
Passwd: qwerty
</body>
</html>

este es el de control.php

<?
//vemos si el usuario y contraseña es váildo
if ($_POST["usuario"]=="miguel" && $_POST["contrasena"]=="qwerty"){
//usuario y contraseña válidos
//defino una sesion y guardo datos
session_start();
$_SESSION["autentificado"]= "SI";
header ("Location: aplicacion.php");
}else {
//si no existe le mando otra vez a la portada
header("Location: index.php?errorusuario=si");
}
?>