RE: [PHP] No cookie is being set?
| From: | Larry Brown | Date: | Fri, 02 Jan 2004 16:25:00 +0000 |
| Subject: | RE: [PHP] No cookie is being set? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-173640@lists.php.net to get a copy of this message | ||
shouldn't $row[member_id] be $row['member_id']. In case anyone can profit
from this, when I find a function doesn't work right and I am using
variables in its execution I run an echo/die combination immediately before
the function to verify the data being fed to it is as it should be. In this
example...
...
$id = $_SESSION["user"];
echo "setcookie(\"memberlogin\", ".$id.", ".time()
+60*60*24*365.");";
die();
setcookie...
What does this yeild?
-----Original Message-----
From: Cesar Aracena [mailto:lists@icaam.com.ar]
Sent: Friday, January 02, 2004 2:28 AM
To: php-general@lists.php.net
Subject: [PHP] No cookie is being set?
Hi again,
I have the following code to first start a session and then write a
cookie... is that so hard? Well it is starting the session but the cookie is
not being set. see:
$row = mysql_fetch_array($result);
$_SESSION["user"] = $row[member_id];
if ($_POST["autologin"] == "yes")
{
$id = $_SESSION["user"];
setcookie("memberlogin", $id, time()+60*60*24*365);
header("Location: $CFG->wwwroot");
exit();
}
else
{
header("Location: $CFG->wwwroot");
exit();
}
What can it be? No error is posted.
Thanks in advanced,
Cesar Aracena
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php