Ciao a tutti,
ho fatto questo prg in php5, in pratica quando uno mette email e password qualunque essa sia dovrebbe creare una sessione e cambiare pagina, ma il cambio pagina non funziona, l'errore presentato è il seguente:
Warning: Cannot modify header information - headers already sent by (output started at /var/www/login.php:10) in /var/www/login.php on line 15
il codice è questo:
Codice PHP:
<?php
include 'session.inc';
function check_auth() { return 4; }
?>
<html>
<head><title>Login</title></head>
<body>
<?php
if(isset($_POST['login']) && ($_POST['login'] == 'log in') &&
($uid = check_auth($_POST['email'], $_POST['password'])))
{
$_SESSION['uid'] = $uid;
header('Location: index.php');
} else {
?>
<h1>Log-in</h1>
<form method="post" action="login.php">
<table>
<tr><td>Indirizzo di posta elettronica:</td>
<td><input type='text' name='email'/></td></tr>
<tr><td>Password:</td>
<td><input type='password' name='password'/></td></tr>
<tr><td colspan='2'>
<input type='submit' name='login' value='log in'/></td>
</tr>
</table>
</form>
<?php } ?>
</body>
</html>