Garayed.com  

Go Back   Garayed.com > PHP
FAQ Members List Calendar Search Today's Posts Mark Forums Read


Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-11-2008, 08:42 PM
Jeff
 
Posts: n/a
Default PHP and Cookies

I am having trouble retrieving cookie data using IE 7.
I am using the following code to store the current date and user name
into a cookie:

<?php
//($sec, $min, $hour, $mday, $mon, $year, $wday, $ydat, $isdst) =
localtime();
$localtime = localtime();
$localtime[5] += 1900;
$date = $localtime[4]+1 . "-" . $localtime[3] . "-" . $localtime[5];

// retrieve cookie
$visit = $_COOKIE['lastdate'];
if ($visit=="") $visit = "0-0-0";
$userlogin = $_COOKIE['user'];
if ($userlogin=="") $userlogin = "Guest";

// set cookie
SetCookie("lastdate", $date, time()+60*60*24*365, "/",
".assistacomp.com");
SetCookie("user", $userlogin, time()+60*60*24*365, "/",
".assistacomp.com");
?>

The code works perfectly in FireFox but IE7 does something strange.
It functions perfectly until I reboot the computer. When the computer
is rebooted, a new cookie is created with a [2] after the cookie name
and the original cookie is completely ignored.
Anybody have any idea of how to fix this?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 05-11-2008, 08:45 PM
Jerry Stuckle
 
Posts: n/a
Default Re: PHP and Cookies

Jeff wrote:
> I am having trouble retrieving cookie data using IE 7.
> I am using the following code to store the current date and user name
> into a cookie:
>
> <?php
> //($sec, $min, $hour, $mday, $mon, $year, $wday, $ydat, $isdst) =
> localtime();
> $localtime = localtime();
> $localtime[5] += 1900;
> $date = $localtime[4]+1 . "-" . $localtime[3] . "-" . $localtime[5];
>
> // retrieve cookie
> $visit = $_COOKIE['lastdate'];
> if ($visit=="") $visit = "0-0-0";
> $userlogin = $_COOKIE['user'];
> if ($userlogin=="") $userlogin = "Guest";
>
> // set cookie
> SetCookie("lastdate", $date, time()+60*60*24*365, "/",
> ".assistacomp.com");
> SetCookie("user", $userlogin, time()+60*60*24*365, "/",
> ".assistacomp.com");
> ?>
>
> The code works perfectly in FireFox but IE7 does something strange.
> It functions perfectly until I reboot the computer. When the computer
> is rebooted, a new cookie is created with a [2] after the cookie name
> and the original cookie is completely ignored.
> Anybody have any idea of how to fix this?
>


Find out why IE isn't recognizing the cookie. Maybe a microsoft group
would be of more help.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 02:10 AM.




LinkBacks Enabled by vBSEO 3.0.0 © 2007, Crawlability, Inc.