Tou a fazer um sistema de login, no qual tou a usar cookies, e quando faco o login, ele verifica bem na BD, mas depois quando e para gravar o cookie da este erro:
Warning: Cannot modify header information - headers already sent by (output started at /web/sites/vhbu3/1/235/73406/public/www/catalogo/configuracao.php:1) in /web/sites/vhbu3/1/235/73406/public/www/catalogo/entrar.php on line 61
Warning: Cannot modify header information - headers already sent by (output started at /web/sites/vhbu3/1/235/73406/public/www/catalogo/configuracao.php:1) in /web/sites/vhbu3/1/235/73406/public/www/catalogo/entrar.php on line 62
Login feito com sucesso!
e não grava o cookie.
tenho este código:
O valor $cookieTime tou a buscar noutro documento que tenho assim:
$cookieTime = time()+7*86400;
ninguem sabe o porque de isto acontecer?
Warning: Cannot modify header information - headers already sent by (output started at /web/sites/vhbu3/1/235/73406/public/www/catalogo/configuracao.php:1) in /web/sites/vhbu3/1/235/73406/public/www/catalogo/entrar.php on line 61
Warning: Cannot modify header information - headers already sent by (output started at /web/sites/vhbu3/1/235/73406/public/www/catalogo/configuracao.php:1) in /web/sites/vhbu3/1/235/73406/public/www/catalogo/entrar.php on line 62
Login feito com sucesso!
e não grava o cookie.
tenho este código:
PHP:
if (!isset($_GET['entrou'])) {
echo '
<table border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><form name="form" method="post" action="index.php?c=entrar&entrou">
<table width="100%" border="0" cellspacing="4" cellpadding="0">
<tr>
<td colspan="3"><strong>Login</strong></td>
</tr>
<tr>
<td>Nome de Utilizador</td>
<td><input name="username" type="text" id="username"></td>
</tr>
<tr>
<td>Password</td>
<td><input name="password" type="password" id="password"></td>
</tr>
<tr>
<td> </td>
<td><input type="submit" name="Submit" value="Login">
<input type="reset" name="Reset" value="Limpar"></td>
</tr>
</table>
</form></td>
</tr>
</table>';
} else {
$username1 = $_POST['username'];
$password1 = $_POST['password'];
if (!$username1 | !$password1) {
echo 'Campos em branco.';
} else {
$user = mysql_query("SELECT * FROM users WHERE username = '$username1'");
if( ($usez = mysql_num_rows($user) ) == 0)
{
echo 'Utilizador não existe.';
} else {
$superquery = mysql_query("SELECT * FROM users WHERE username = '$username1' AND password = '$password1'");
if (mysql_num_rows($superquery) == 1){
setcookie("username", $username1, $cookieTime);
setcookie("password", $password1, $cookieTime);
echo 'Login feito com sucesso!';
}else{
echo 'Falhou.';
}
}
}
}
O valor $cookieTime tou a buscar noutro documento que tenho assim:
$cookieTime = time()+7*86400;
ninguem sabe o porque de isto acontecer?