crr_gm Posted February 14, 2011 Share Posted February 14, 2011 I am having a hard time getting sessions and cookies to work as I would expect. I am using codelobster editor/debugger and wampserver. My problem is that when I try to delete a cookie it shows that the cookie is still there and active. <?PHP session_start(); date_default_timezone_set('Asia/Qatar'); // I try to delete the previous cookie which was set setcookie('my_session',"",time()-3600); // here I have a function that sets a cookie log_session("username","password"); session_destroy(); ?> When I check the local variables in the debugger they are still there and not deleted and have the same value. Is my logic wrong or is it my system? Quote Link to comment Share on other sites More sharing options...
zenlord Posted February 14, 2011 Share Posted February 14, 2011 Did you read the 'common pitfalls' on the setcookie-page? Things I can think of: * If you set or delete a cookie, it is visible when the page is reloaded - do you reload your page before checking? * You use single and double quotes together * Try explicitly setting the value of the cookie to 'false' - no need to set the time in the past, that is something that is done internally by PHP Quote Link to comment 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.