My code is simply to login.

I have two files: login.html (form) and login.php to validate. I donīt
understand why php capture only password )I call it senha) and take a blank
username (I call it nome). Any idea?

#Code - login.html

<form  method="POST" action="login.php">
...
 <input type="text" name="nome">
 <input type="password" name="senha">
<input type="submit" name="Submit" value="Enviar">
    <input type="reset" name="Submit2" value="Limpar">
...

#Code: login.php
<?
include('conecta.inc.php') ;
$cod=md5($senha);
$sql = "SELECT * FROM usuario where nome='$nome' AND senha='$cod'"";
$tarefa=mysql_query($sql);
$num=mysql_numrows($tarefa);
$i=0;
if ($num < 1) {
header("Location:login.html");
} else {
while ($num > $i)  {
$nome = mysql_result($tarefa,$i,"nome");
$tipo = mysql_result($tarefa,$i,"tipo");
$i++;
}
setcookie("nome", "$nome");
setcookie("tipo", "$tipo");
header("Location:index.php");
}
?>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to