Re: No cookie is being set?
| From: | Matt Grimm | Date: | Fri, 02 Jan 2004 18:29:28 +0000 |
| Subject: | Re: No cookie is being set? | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-173646@lists.php.net to get a copy of this message | ||
Why not just echo the ID var separately? Less confusing with the escaped
quotes and all. If you're not getting an ID var, it might be because you
didn't use the array quotes ($row['member_id']) as Larry mentioned.
Also be aware:
"If setcookie() successfully runs, it will return TRUE. This does not
indicate whether the user accepted the cookie."
http://us2.php.net/manual/en/function.setcookie.php
--
Matt Grimm
Web Developer
The Health TV Channel, Inc.
(a non - profit organization)
3820 Lake Otis Parkway
Anchorage, AK 99508
907.770.6200 ext. 686
907.336.6205 (fax)
E-mail: mgrimm@healthtvchannel.org
Web: www.healthtvchannel.org
"Cesar Aracena" <lists@icaam.com.ar> wrote in message
news:20040102173603.65915.qmail@pb1.pair.com...
> As extrange as can be, the echo function simply returns the following:
>
> 31536000);
>
> but not the setcookie, $varname and $value parts... What's this? Do I
havve
> a missconfiguration in php.ini file?
>
> Thanks,
>
> Cesar Aracena
>
> "Larry Brown" <larry.brown@dimensionnetworks.com> escribió en el mensaje
> Sä[‘rÆc™ò
> Ï艶anews:CBECIONKKLMDDCIKHALJKEPLJMAA.larry.brown@dimensionnetworks.com...
> > 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