Jump to content

Cookies with randomly generated values... Do they change?


Meissa

Recommended Posts

I'm working on a series of pages and am having cookie issues:

Page1:  Writes a cookie to your hard drive with a randomly generated 5-digit number for the VALUE.
setcookie(name, rand(10000-99999), expiration);


Page2:  Reads the cookie and echos the correct number.
$cookie = $_COOKIE[name];


Page3:  Reads the cookie and echos a completely different number.
$cookie = $_COOKIE[name];

I can't figure out why the cookie's value would change between readings...  Can anyone offer insight as to why the cookie's value changes?


Meissa
Upon further pondering...

Could it be that the [b]"rand(10000, 99999)"[/b] (instead of the actual generated 5-digit number) is what's stored in the cookie's VALUE and it recalculates itself each time the file is accessed by the browser?

If so, then why wouldn't it recalculate itself each time I opened the cookie with Notepad?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.