logo       

RE: Session questions: msg#00835

Subject: RE: Session questions
>  I have a login system which uses sessions, and when people login it
puts
> the date they logged in in their profile and moves their last login
date
> over to another field, that works fine, but how can I check if someone
has
> logged out via code?  In other words, if someone does what they want
and
> then just closes the browser without logging out no record is saved,
how
> can
> I tell whether they have logged out / gone from the website ?  I need
to
> know this for security.

You can't know for sure. It's a limitation of HTTP. What you do is
assume that if after X minutes, the user hasn't done anything, then they
have left. If you're using sessions, the files will be cleaned up after
X minutes, anyhow, and they will lose their login. 

> Which brings me to my next question :-)
> 
> How would I make it so only 1 person can login at any time with any
given
> username/password combo?  I know I have to track the sessions, but not
> sure
> how :-(

Set a flag in the database that says whether that user is logged in. If
that username tries to log in again, set an error. The problem you'll
run into with this, though, is you'll have to implement a "cleanup"
system to unset the flag after X minutes of inactivity. Also, if I
accidentally close my window and then go back to log in, it won't let me
because the flag is still set until your cleanup program unsets it. 

---John Holmes...



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
science.linguis...    culture.sf.lite...    video.mplayer.c...    yellowdog.gener...    ietf.rfc822/199...    emacs.help/2002...    redhat.release....    kernel.speakup/...    java.openejb.de...    debian.devel.gt...    xfree86.newbie/...    bug-tracking.ma...    pam/2003-05/msg...    games.devel.ope...    user-groups.lin...    music.pancham/2...    network.mq.deve...    web.html.genera...    arklinux.bugs/2...    linux.ecasound/...    qnx.openqnx.dev...    org.user-groups...    file-systems.sf...    trustix.contrib...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe