Autu Logout?

Started on the old forum in April 2008 · view the original in the archive · old links redirect here

24 replies · 1,233 views · started 18 years ago · 1 min read

7 participants
Guest #21

yes post if ill give you new php to add to your script and sql and it will make auto logout what query do you use

MatrixIS Developer · 53 posts #22

DELETE FROM online WHERE user = '$user'

Guest #24

ok here is sql to alter your online table use it in phpmyadmin

ALTER TABLE `online` ADD `lseen` INT( 255 ) NOT NULL DEFAULT '0';

Add this function

function update_timeout($user){
$currenttime = time();
mysql_query("UPDATE online SET lastseen='$currenttime' WHERE user='$user'");
$limit = 420;  //timout in seconds (420 seconds is 7 mins)
$userlseen = time()-$limit;
mysql_query("DELETE FROM online WHERE lseen < $userlseen");
}

I havn't tested this for errors so any problems then post here

to use afer adding use

update_timeout($user);

$user is the var containg of the person that is logged in put it in main menu or a page that is updated frequently

Write your reply now; next you create a free account (or sign in) and it is posted right away. Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close