PHP setting cookie time to past wont delete it -
I have trouble setting cookies, for the time being, I am unable to log out. While validating user session cookies only work like magic. So on the first login I am setting up cookies like this (on successful login):
$ cookie_username = $ username; $ Cookie_password = sha1 (MD5 ($ password)); $ Cookie_value = 'username =' $ Cookie_username & Amp; Hash = '. $ Cookie_password; $ Cookie_name = 'remind_me @ website'; $ Cookie_time = time () + 31536000; Set cookie ($ cookie_name, $ cookie_value, $ cookie_time, '/', '.website.com'); The above cookies are working well and I do not have problems reading them.
This is my logout code:
setcookie ($ cookie_name, '', time () - 3600, '/', '.website.com'); Not set ($ _cookie [$ cookie_name]); Not set ($ _ session ['username']); \ Unset ($ _ session ['log in']); (
According to what I have read around so that these cookies work and should be removed They were setted after class = "text after" itemprop = "text">
You make sure that the cookie name, domain, path, and even security settings are all what you try to delete
If you create a cookie like this:
setkey ('name', 'value', time (+ 3600); more Then tried to delete it like this:
setcookie ('name', 'value', time () - 3600, '/', '.website.com'); This will not work. The exact same criteria are used when you create a cookie.
If you make a cookie in JavaScript then double check your settings there.
As a test, try all of the following code, then it works, comment out every one-by-one, you only left with that job O until :.
Setkyuki ($ Kuki_nav ', time () - 3600); Setco ($ cookie_name, '', time () - 3600, '/'); Setkey ($ cookie_name, '', time () - 3600, '/', '.website.com'); Set cookie ($ cookie_name, '', time () - 3600, '/', '.website.com', 1);
Comments
Post a Comment