Re: Site Sessions: Online/Offline - help?

From: Date: Tue, 17 Apr 2001 19:37:26 +0000
Subject: Re: Site Sessions: Online/Offline - help?
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-49033@lists.php.net to get a copy of this message
Greetings. Thanks for your help! That about people not using logout buttons is really true! But what can one expect? However, how can I create a unique session ID? I don't use Databases, at least not MYSQL. - Richard ""Plutarck"" <aemuli@spamclause-yahoo.com> wrote in message news:9bhsa8$vq8$1@toye.p.sourceforge.net... > Simplest way to do it IMHO. > > When a user logs in (starts their session) register their username into the > session (that session is "bound" to them now). > > On every page when a user does anything, update your database with the > current time as a "last_activity" entry for that user. > > When showing who is currently logged in, get all the entries out and check > their dates. If the last activity is older than a certain amount of > acceptable time (how long it takes them to be considered "logged out". note: > people rarely use a logout button), then consider that user as not being > logged in. > > Delete the entry so your "who's online" function doesn't hugely slow down > the page, and you should be good to go. > > > The only problem is that you have to do an update every time someone visits > a page, which increases your server load. But to avoid any noticable slow > down you could just use a register_shutdown_function. > > I think that should handle your problem... > > > -- > Plutarck > Should be working on something... > ...but forgot what it was. > > > ""Richard"" <oblivion@lunamorena.net> wrote in message > news:9bfv6n$pds$1@toye.p.sourceforge.net... > > Greetings. > > > > Some of you are familiar with my latest project, a smaller community. > I > > have implemented almost everything I need, and I wish to thank those of > you > > who helped me with "which mail is new" and so forth. However, this problem > > is quite worse I suppose, but I hope some of you has done something like > > this before: > > > > Sessions. > > > > I wish to keep track of every visitor. Not a counter or anything, but more > > of when a person signs in, the users nickname will be bound to this > session > > ID which will keep track of the person is online or offline. I have solved > > it like so: > > > > Whenever a person loggs in, I add it's name to a online.dat file. When > > the user signs of, I remove the nickname thus the login time from the > file. > > > > PROBLEMS?? First one: User must click on "logout" to remove itself. > Second: > > It does not always remove itself. > > > > Therefore, I ask: How can I create a new session for every visitor (so I > > know how many are online at the time), bind this ID to its nickname (so > one > > row in a file would be: NICKNAME|SESSION_ID|DATE), and how can I make sure > > that whenever the browser is closed or whatever, or after a certain time > of > > inactivity (3 minutes), the user is removed from the file. > > > > All help is greatly appriciated and your name will be on the credits list > > too. > > > > - Richard > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > > For additional commands, e-mail: php-general-help@lists.php.net > > To contact the list administrators, e-mail: php-list-admin@lists.php.net > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.general (#49033) next »