Re: Setting Cookies in netscape and explorer?
| From: | Martin Johansson | Date: | Fri, 21 Jun 2002 11:50:11 +0000 |
| Subject: | Re: Setting Cookies in netscape and explorer? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-103257@lists.php.net to get a copy of this message | ||
I tried your stuff but it didnt help me!
Still works in explorer but when I tried it in netscape
It says ERROR!!! in netscape!!!!
if (isset($devProcTailorCookie))
{
$tok = explode("|", $devProcTailorCookie);
}
else
{
echo "ERRROR!!!";
}
I have global_variables turned on in my php.ini
/Martin
"Kondwani Spike Mkandawire" <kondwani@cs.mun.ca> skrev i meddelandet
news:20020621114205.49106.qmail@pb1.pair.com...
> As opposed to using the Cookies Array HTTP_COOKIES_VAR
> could you not just use explode the $devProcCookie using
> if (isset($devProcCookie)){
> $tok = explode("|", $devProcCookie);
> }
> //Note this will only work if the global variables in your php.ini files
> are turned on...
> I have no idea why it can't read the index $devProcCookie in the
> Cookies Array if you figure it out though please post up...
>
> Kondwani
>
>
> "Martin Johansson" <d99majo@swipnet.se> wrote in message
> news:20020621095233.67571.qmail@pb1.pair.com...
> Hi!
> Cookies makes me go AHHHHGHH!!
> Please help me with this:
>
> I am setting a cookie like this in my loginscript:
>
> setcookie("devProcCookie", "cookie value"."|".time(), 31536000);
> //
Set
> cookie
> header("Location: inside.php");
> exit;
>
> So far it works!
> But when I go to the inside.php page that looks like this:
>
> $cookie_life = 30;
> // The cookie lives for 1 hour
> $tok = explode("|", $HTTP_COOKIE_VARS["devProcCookie"]);
> $cookie_value = $tok[0];
> $creation_time = $tok[1];
> if((time()-$creation_time) > $cookie_life)
> // If time expires go to cookie_expired.php
> {
> // cookie has expired so delete it.
> setcookie("devProcCookie", "");
> header ("Location: cookie_expired.php");
> exit;
> }
> setcookie("devProcCookie", "cookie value"."|".time(), 31536000);
> // If
> time hasnt expired update the cookie time
>
>
> Something happens in netscape. Everything works fine in IExplorer.
> Netscape says:
>
> Notice: Undefined index: devProcCookie in
> c:\inetpub\wwwroot\devproc\beta\inside.php on line 2
> Notice: Undefined offset: 1 in c:\inetpub\wwwroot\devproc\beta\inside.php
on
> line 4
> Warning: Cannot add header information - headers already sent by (output
> started at c:\inetpub\wwwroot\devproc\beta\inside.php:4) in
> c:\inetpub\wwwroot\devproc\beta\inside.php on line 9
> Warning: Cannot add header information - headers already sent by (output
> started at c:\inetpub\wwwroot\devproc\beta\inside.php:4) in
> c:\inetpub\wwwroot\devproc\beta\inside.php on line 10
>
> What is wrong!!!!!!!!!
> Please help me someone!!!
> /Martin
>
>
>
> ---
> Ditt utgående mail är virusfritt.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.371 / Virus Database: 206 - Release Date: 2002-06-13
>
>
>