vidhatanand Posted October 3, 2008 Share Posted October 3, 2008 Here is hte code I did jsut as a test. but basically, and I dont know if this is even possible. I want to place a cookie, and then based on how fast that cookie is places, as in if it takes too long, like a second, then place other cookies or not. If someone has a prompt for cookies, then I want it to place the one and no more. Theory is if they have the prompt it will take time to place the cookie, and give hte program enough info to decide toplace others. <?php //Set test cookie setcookie("test", "test", time()+3600); if (isset($_COOKIE["test"])) { //Set Real cookies setcookie("first", "first", time()+3600); setcookie("second", "second", time()+3600); //Write Cookies echo "Cookie " . $_COOKIE["test"] . "!<br />"; echo "Cookie " . $_COOKIE["first"] . "!<br />"; echo "Cookie " . $_COOKIE["second"] . "!<br />"; } else echo "No Cookie!<br />"; //Delete cookies ?> Quote Link to comment https://forums.phpfreaks.com/topic/126857-can-u-help-in-cookies/ Share on other sites More sharing options...
wildteen88 Posted October 3, 2008 Share Posted October 3, 2008 Cookies cannot be used directly after they have been set. The page will have to be reloaded in order for the cookie to come available. This is nothing to do with PHP but how the HTTP protocol works. Quote Link to comment https://forums.phpfreaks.com/topic/126857-can-u-help-in-cookies/#findComment-656531 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.