noobstar Posted December 1, 2006 Share Posted December 1, 2006 Hi there,After using some references from php.net and looking at some examples i found for the logout script to destroy a cookie, i still failed in getting the cookie destroyed.This is what happens i go to the login page type in my login details then it runs the login script once validated it passes the me to the members area page when i click on Logout it should log out however, it does not.[code]<?php //this makes the time in the past to destroy the cookiesetcookie(ID_my_site, gone, time() - 3600);setcookie(Key_my_site, gone, time() - 3600);?>[/code]Please if you have anu suggestions or ideas why it doesn't work let me know.Thank you in advance :) Quote Link to comment https://forums.phpfreaks.com/topic/29085-cookie-destroy-problem/ Share on other sites More sharing options...
HuggieBear Posted December 1, 2006 Share Posted December 1, 2006 Can you please post the line of code that sets the cookie?RegardsHuggie Quote Link to comment https://forums.phpfreaks.com/topic/29085-cookie-destroy-problem/#findComment-133332 Share on other sites More sharing options...
noobstar Posted December 1, 2006 Author Share Posted December 1, 2006 The cookie is set in the login script and here it is:[code]$_POST['username'] = stripslashes($_POST['username']);setcookie(ID_my_site, $_POST['username'], time() + 3600);setcookie(Key_my_site, $_POST['pass'], time() + 3600);[/code] Quote Link to comment https://forums.phpfreaks.com/topic/29085-cookie-destroy-problem/#findComment-133352 Share on other sites More sharing options...
HuggieBear Posted December 1, 2006 Share Posted December 1, 2006 OK, in that case, try leaving the value field as either blank, or FALSE[code=php:0]setcookie(ID_my_site, "", time() - 3600);[/code] RegardsHuggie Quote Link to comment https://forums.phpfreaks.com/topic/29085-cookie-destroy-problem/#findComment-133383 Share on other sites More sharing options...
noobstar Posted December 1, 2006 Author Share Posted December 1, 2006 yea i did try that one too no luck either I am not sure what else to try I even had a go at mktime() but it didn't work too this cookie stuff is really stubborn lol Quote Link to comment https://forums.phpfreaks.com/topic/29085-cookie-destroy-problem/#findComment-133396 Share on other sites More sharing options...
HuggieBear Posted December 1, 2006 Share Posted December 1, 2006 Are you sure this isn't a caching issue?RegardsHuggie Quote Link to comment https://forums.phpfreaks.com/topic/29085-cookie-destroy-problem/#findComment-133397 Share on other sites More sharing options...
noobstar Posted December 2, 2006 Author Share Posted December 2, 2006 It could be if it is is there a way to solve this issue or is it a dead end ? Quote Link to comment https://forums.phpfreaks.com/topic/29085-cookie-destroy-problem/#findComment-133810 Share on other sites More sharing options...
HuggieBear Posted December 2, 2006 Share Posted December 2, 2006 Do you have the code live somewhere that I can test it?RegardsHuggie Quote Link to comment https://forums.phpfreaks.com/topic/29085-cookie-destroy-problem/#findComment-133924 Share on other sites More sharing options...
noobstar Posted December 6, 2006 Author Share Posted December 6, 2006 Nope sorry, no matter i will stick to sessions they seem to be better and easier anyways thx for the help though i appreciate it :) Quote Link to comment https://forums.phpfreaks.com/topic/29085-cookie-destroy-problem/#findComment-135960 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.