Drezard Posted November 14, 2008 Share Posted November 14, 2008 Im writing an app that uses cookies. Now... my code to create a cookie looks like this: // my cookie creation setcookie("USER_SESSION", ($this->user_id . "+|+" . $this->password), (time() + 900)); my code to delete the cookie looks like this: // my cookie deletion setcookie("USER_SESSION", "", ((1-time())-900)); The cookie creates but it wont delete. Whats wrong? Daniel Link to comment https://forums.phpfreaks.com/topic/132659-cookie-creationdeletion/ Share on other sites More sharing options...
PFMaBiSmAd Posted November 14, 2008 Share Posted November 14, 2008 Just use time() - 900. The value must be a valid Unix Timestamp. Doing 1-time()-900 results in negative a value that wraps around and looks like a large positive value. Link to comment https://forums.phpfreaks.com/topic/132659-cookie-creationdeletion/#findComment-689934 Share on other sites More sharing options...
Drezard Posted November 14, 2008 Author Share Posted November 14, 2008 nope. even when I changed it, it still wouldn't work. the code for deleting the cookie is: setcookie("USER_SESSION", "", (time()-3600)); Daniel Link to comment https://forums.phpfreaks.com/topic/132659-cookie-creationdeletion/#findComment-689954 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.