Meissa Posted January 7, 2007 Share Posted January 7, 2007 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 Link to comment https://forums.phpfreaks.com/topic/33206-cookies-with-randomly-generated-values-do-they-change/ Share on other sites More sharing options...
Meissa Posted January 7, 2007 Author Share Posted January 7, 2007 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? Link to comment https://forums.phpfreaks.com/topic/33206-cookies-with-randomly-generated-values-do-they-change/#findComment-155018 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.