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

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
yosuke_
Forum Commoner
Posts: 64
Joined: Tue Apr 13, 2004 12:29 pm

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

Post 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!!!
User avatar
MarK (CZ)
Forum Contributor
Posts: 239
Joined: Tue Apr 13, 2004 12:51 am
Location: Prague (CZ) / Vienna (A)
Contact:

Post 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.
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post by JayBird »

YOU REALLY NEED TO LEARN TO POST IN THE CORRECT PLACE
yosuke_
Forum Commoner
Posts: 64
Joined: Tue Apr 13, 2004 12:29 pm

Post 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??
yosuke_
Forum Commoner
Posts: 64
Joined: Tue Apr 13, 2004 12:29 pm

Post by yosuke_ »

And when I log user and close IE it works!!!
User avatar
Ixplodestuff8
Forum Commoner
Posts: 60
Joined: Mon Feb 09, 2004 8:17 pm
Location: Queens, New York

Post 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.
User avatar
JAM
DevNet Resident
Posts: 2101
Joined: Fri Aug 08, 2003 6:53 pm
Location: Sweden
Contact:

Post by JAM »

How do you set the cookie and how do you delete the cookie in the php script?
yosuke_
Forum Commoner
Posts: 64
Joined: Tue Apr 13, 2004 12:29 pm

Post 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!!
yosuke_
Forum Commoner
Posts: 64
Joined: Tue Apr 13, 2004 12:29 pm

Post by yosuke_ »

OK, i created another page wo will logoff user by seting cookie to past time! thank you everybody!!!!
Post Reply