if ($esistente == 0) {
die('il nome utente non esiste nel nostro archivio.');
echo('<a href="Registrazione.php">registrati</a>');
}
while($info = mysql_fetch_array($esito )) {
$_POST['pass'] = stripslashes($_POST['pass']);
$info['password'] = stripslashes($info['password']);
$_POST['pass'] = md5($_POST['pass']);
if ($_POST['pass'] != $info['password']) {
die('password errata, ripeti.');
} else {
$_POST['username'] = stripslashes($_POST['username']);
$durata = time() + 3600;
setcookie('Autenticato', $_POST['username'], $durata);
setcookie('Riconosciuto', $_POST['pass'], $durata);
header("Location: privato.php");
}
}
} else {
?>
<form action="<?php echo $_SERVER['PHP_SELF']?>" method="post">
<table border="0">
<tr><td colspan=2><h1>Login</h1></td></tr>
<tr><td>Username:</td><td>
<input type="text" name="username" maxlength="40">
</td></tr>
<tr><td>Password:</td><td>
<input type="password" name="pass" maxlength="50">
</td></tr>
<tr><td colspan="2" align="right">
<input type="submit" name="invio" value="Login">
</td></tr>
</table>
</form>
<?php
}
?>
Avanti >>>