Page 1 of 1

logof user dosnt work! cookie deleted, but still nothing!

Posted: Sun Apr 18, 2004 11:19 am
by yosuke_
Hi!
Im creating a user login script, but I have a problem!!! The default page checks if user hase a cookie, if he dosnt then he get this:
Welcome Guest, you may login or register
When user clicks login and logins with hes username and password and returns to default page he get cookie and this:
Welcome Username.
When I open my cookie folder and delete that cookie, and refresh default page, It still shows Welcome Username., but when I close IE and run it again and when I run defualt page it shows Welcome Guest, you may login or register. After re-rining IE it works, but why dosnt it work after deleting the cookie and clicking refresh?? How to make user logoff script!! I have no idea!!! Thank You!!!

Posted: Sun Apr 18, 2004 11:54 am
by MarK (CZ)
And when you log user, close and open IE, does it work? I mean, is there still "Welcome username"? I think that the cookies aren't saved correctly so they remain in IE only one session.

Posted: Sun Apr 18, 2004 11:59 am
by JayBird
YOU REALLY NEED TO LEARN TO POST IN THE CORRECT PLACE

Posted: Sun Apr 18, 2004 12:11 pm
by yosuke_
You got me wrong!!! When I delete cookie and click refresh there is still Welcome Username, it shows Welcome Guest only then, when I close my prowser and run it again!!!!! I need it after I delete cookie to display:
Welcome Guest, you may login or register!!!
How can I delete that cookie from php, is there a better way to logoof user??

Posted: Sun Apr 18, 2004 12:15 pm
by yosuke_
And when I log user and close IE it works!!!

Posted: Sun Apr 18, 2004 1:04 pm
by Ixplodestuff8
you should look at the manual's page on setcookie()

To delete a cookie set a new cookie with the same name, but make the expiration date sometime in the past.

Posted: Sun Apr 18, 2004 1:11 pm
by JAM
How do you set the cookie and how do you delete the cookie in the php script?

Posted: Sun Apr 18, 2004 1:27 pm
by yosuke_
well this is code for setcookie:

Code: Select all

<? setcookie("eatthis",$password . "<explode_this>" . $username,time() + 360000); ?>

And I deleted cookie just by opening cookie folder and deleting it!!

Posted: Sun Apr 18, 2004 1:39 pm
by yosuke_
OK, i created another page wo will logoff user by seting cookie to past time! thank you everybody!!!!