Log out when user leaves page

A

Anonymous

Guest
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.
;)
 
I would use a session to do this.
It's much better for many reasons.

Code:
<?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:
<?php
session_start();
?>

byes!
 
Back
Top