PDA

View Full Version : logging out....


Xavior
22-05-2003, 23:58
Heh... ok it's me again..
anyways.. i'm having this login script..
that will count the number of members online..
but the problem with this is that..
if a user does not logoff..
and exits the page.. this script will still count e member as an online member...
anyone has any ideas on how to correct this?
i cant just use the onunload javascript..
as it will be stored in a mysql database..
help!~!

Heng Chai
23-05-2003, 04:08
Depending on how the script is done, use a session timeout. Either delete the session rows when the time has exceeded X number of seconds, or set them to offline, depending on how your script works.

royong
23-05-2003, 08:48
I'll go along with SG.GS

You cannot ensure that each user uses the Login/Logout facility faithfully. Even if they do, you'll never know when their net connection gets terminated or drops.

The timeout suggestion is the way to go....

Xavior
23-05-2003, 19:12
personally, i aint good at using sessions..
hmMm... i think i will need to redo my login script..
sigh~! headache again.. =x

Xavior
23-05-2003, 22:41
erm.. can someone explain or teach me some stuff or two to go about doing the login script??
i'm looking at php.net sessions...
but hor.. i now getting headache laio.. dont really understand..
got what..
session.save_path
session.name
session.save_handler
session.auto_start
session.gc_probability
session.gc_maxlifetime
session.serialize_handler
session.cookie_lifetime
session.cookie_path
session.cookie_domain
session.cookie_secure
session.use_cookies
session.use_only_cookies
session.referer_check
session.entropy_file
session.entropy_length
session.cache_limiter
session.cache_expire
session.use_trans_sid
url_rewriter.tags
... argh~!

icelava
29-05-2003, 10:07
I've never use PHP myself but there should be a session timeout event you can use to trigger clean up code.

Xavior
30-05-2003, 00:17
indeed there is -> session.cache_expire
but i tried, it didnt work..
anyways, i got the code and it does not require sessions, just required a script to run... maybe every 10mins? to log everyone off, and if any user is still alive and clicks on a link, it will "login" that user again.

Xavior
30-05-2003, 00:42
erm, i think i will rephrase it..

this script, will be activated whenever a user access it,
it will check for users that has been logged on, and that has timed out, it will log them off. and reports the number of users. that are still within the "time" given.