Log out when user leaves page

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

Post Reply
User avatar
Joan Garnet
Moderator
Moderator
Posts: 387
Joined: Sat Aug 03, 2002 2:56 am
Location: Mars
Contact:

Post by Joan Garnet » Fri Dec 20, 2002 6:42 pm

Well, I guess you can set the expire date of the cookie to a reasonable time.
For example 5 minutes.
So If the user keeps browsing your site, the cookie will be updated everytime he loads a new page.
If the user don't update that cookie, it'll be removed automatically.
You can also add a loggout button, but people don't use it really...

I hope it helped.
;)

User avatar
Joan Garnet
Moderator
Moderator
Posts: 387
Joined: Sat Aug 03, 2002 2:56 am
Location: Mars
Contact:

Post by Joan Garnet » Sat Dec 21, 2002 10:21 am

I would use a session to do this.
It's much better for many reasons.

Code: Select all

<?php
session_start();
$username = "Joan";
$password = "my_pass";
session_register("username","password");
?>

For each page you want to use those variables, you put this code BEFORE ANYTHING on the page:

Code: Select all

<?php
session_start();
?>


byes!

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests