
25/02/2008, 06:26
|
 | | | Fecha de Ingreso: febrero-2008
Mensajes: 45
Antigüedad: 17 años, 1 mes Puntos: 1 | |
Problema con login Estoy tratando de hacer un admin para un sistema de noticias y tengo problemas kon el login.. acepta kualkier usuario.. este el el codigo...
admin.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Documento sin título</title>
</head>
<body>
<p> </p>
<form id="form1" name="form1" method="post" action="validar.php">
<label> user<br />
<input type="text" name="us" id="textfield" />
</label>
<p>pass </p>
<p>
<input type="password" name="pass" id="textfield2" />
</p>
<p>
<label>
<input type="submit" name="button" value="Enviar" />
</label>
<input type="reset" name="button2" value="CANCEL" />
</p>
</form>
<p> </p>
<p>
<label></label>
</p>
</body>
</html>
validar.php
<?php
session_start();
function validar($us,$pass){
if ($us=="pepito" && $pass=="1234")
{
$_SESSION["valido"]=1;
}
}
validar($_POST["us"],$_POST["pass"]);
header("Location:pagina2.php");
?>
pagina2.php
<?php
echo $_SESSION["valido"];
if($_SESSION["valido"]==0){
echo "usuario no activo";
}
else{
echo "usuario valido";
}
?>
gracias de antemano.... |