PHP Coding
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsPHP RelatedPHP Coding

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old August 28th, 2002, 05:02 PM
alsaffar alsaffar is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 58 alsaffar User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Cookie's Life

Hi there,

I set a cookie and then I deleted that cookie manualy from the cookies folder in my windows.

But although I deleted that cookie file from my windows, if I execute this code it'll give me the cookie contents:

<?

$CkUserName = $HTTP_COOKIE_VARS["CkUserName"];

echo "The content of the cookie is: $CkUseName":

?>

This is if I deleted the cookie file with colsing the session, it'll gave me the cookie content, even if I hit the Refresh button million times.

And if I set the cookie with a php script to null, it will not see the cookie:

<?
setcookie ("CkUserName","","","/",".myDomain.com","");
?>

This if I didn't close the session.

But if I closed the session and run the first script again, it will not see the cookie!

So is the cookie available for the session until its closed if deleted the cookis file manulay?

Anything wrong with my knowledge? Anyone can help?

Reply With Quote
  #2  
Old August 28th, 2002, 11:14 PM
zombie zombie is offline
Codewalkers Intermediate (1500 - 1999 posts)
 
Join Date: Apr 2007
Location: serbia
Posts: 1,876 zombie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 3
RE: Cookie's Life

what u are doing with that setcookie() call is setting a "memory-only" cookie, that is not savet to disk, but remains in memory while the browser is active.

to test it, close your browser, and start it again, and navigate to the same page.

to use "disk" cookies, try setting a life-time for cookie, like this:

this is from the php man at page http://php.net/setcookie . in the future, i sugest to RTFM

php Code:
Original - php Code
  1.  
  2. setcookie ("TestCookie", $value);
  3. setcookie ("TestCookie", $value,time()+3600)/* expire in 1 hour */
  4. setcookie ("TestCookie", $value,time()+3600, "/~rasmus/", ".utoronto.ca", 1)


Reply With Quote
Reply

Viewing: Codewalkers ForumsPHP RelatedPHP Coding > Cookie's Life


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway