Re: Setcookie and then redirect isn't working!
| From: | Jean-Marc Lecarpentier | Date: | Fri, 01 Dec 2000 13:47:36 +0000 |
| Subject: | Re: Setcookie and then redirect isn't working! | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-28199@lists.php.net to get a copy of this message | ||
> doesn't work because you can't set any http headers before a redirect
> header.... as far as i know ....
Correct. But i have observed that sometimes it doesn't work even though no
output has been sent to the client.
For exemple something similar to
<?
if ($pseudo) {
include("../inc/connect.inc");
$query="select pwd from users where pseudo='$pseudo'";
$result=mysql_query($query,$link);
$row=mysql_fetch_array($result);
if ( md5($pwd)== $row[pwd]) {
setcookie("login",$pseudo);
header("Location: $ref");
}
else { ...........
sometimes didn't work. The warning was that headers had already been sent,
when i don't think anything was sent (there is NO space in front of th <? )
Has someone already experienced that??
Thanks,
JM