Gossamer Forum
Home : Products : Gossamer Links : Pre Sales :

Users online

Quote Reply
Users online
For my links, users must login to get to certain areas, so i think about showing who´s online.
Cause both scripts Links and the wwwforum work with perl and mysql, it should be possible to get the right functions out of the forum-script; has someone tried this or know on which way it is done?
Maybe with session-cookies or to pass the Owner-ID everytime the user did something?
I see, i must learn more about these serversite sessionthings ... is this build in to apache or is an additional mod needed? I will walk tru apache.org and search for this ...


Robert

Quote Reply
Re: Users online In reply to
You are munging several issues here, but the biggest one is Jerry has already written such a script (I think) or has figured out how to, and the next release of Links with the updated user registration features should make that easy to do. Just query the sessions database for transactions less than 10 minutes.

Remember, being "on" the webserver is not quite like being "on" a bbs. you are not really "attached" to it, and you may be "logged in" yet be on some other site and not coming back.

It's only an approximation based on past (or current) activity on that server.

http://www.postcards.com
FAQ: http://www.postcards.com/FAQ/LinkSQL/

Quote Reply
Re: Users online In reply to
Yes i know, but the code to do this is still in the forum, so i have asked.
But it seems, nobody has done it before. So i will give it a try.

Robert

Quote Reply
Re: Users online In reply to
Okay, I realize this thread is quite old, but thought I'd post to it anyway.

It's relatively easy to do a who's online system, we have created one for one client that does a dating service using cgi scripts and a mysql database.

Basically in a nutshell, it goes like this.

Use your existing users database, add an extra field, named time, then in each cgi script you add a subroutine to check the database users to see if there is already an entry for that particular person, if there is update the time in the time field, if there isn't then add it in. Then also in every cgi script that does anything for a logged in user, you have a cleaning routine that checks the time field for each row, and deletes it if more than xx minutes. Then if the person really is still logged in, on their next action it will rewrite a time for them to the time field.

Then you create a who's online script that reads the userdatabase, and if it finds a time in the time field, then it will display that person on the who's online script output page. Then if you have a logout script, you can have it remove the time data from the time field of that persons users information, regardless of whether or not they use the logout button, the cleaning routines will clean them out when the next person comes along after xx minutes of inactivity. The only thing we havn't been able to work out yet, and Im sure it would be easy for a perl guru, is to check the hour as well, and remove the time data if it's over xx minutes or over 1 hour and xx minutes, currently it only checks the minutes, so if you had a not busy site, and user A logs in at 10am and doesn't logout , but leaves the site at 1005am, then user B logs in at 1103, they will still see the othe person logged in until xx minutes have elapsed, or if the time is set to default after 10 minutes, then user B will see the other person as being logged in until 1111am


This works well, and has been working well on a virtual server for almost a year, without a complaint from the server admins, and this particular clients site gets thousands upon thousands of members visiting every day.

Unfortunately I don't have the time right now to rewrite it to use the links database, and I havn't checked the mods resources, so perhaps someone else has already done this, but like I said it took us all of 5 hours to do the whole entire thing for this one particular clients site.

Regards,
Harrison


"I've got if's pretty good, but that's about it"
Quote Reply
Re: Users online In reply to
The _best_ way, really, has been discussed here before.

Since your users log on anyway, just query the 'sessions' database, and if all you want is a list of users, you'd use an SQL statement similar to:

SELECT DISTINCT Username FROM Sessions


If you wanted a count of the users on-line, you'd do:

SELECT COUNT(DISTINCT Username) FROM Sessions


You wouldn't have to really do much modification to any of the other scripts, since the Sessions management is built into the User.cgi and other logon scripts.

If you wanted to keep a time_of_last_logon, _that_ would be a field to add to the User database, since it's something in a single field, that is attached to the Username directly. You could also keep a count of the user logons in the User table, by adding a logon_countfield, and incrementing it by one on each logon. If you did that, and made the time_of_last_logon a TIMESTAMP field, the time_of_last_logon would be automatically set when you updated the logon_count.

This has been discussed recently, and Eliot has posted some "problems" with getting the theory to work.

I'm doing some reading/studying of MySQL and some of the problems may be related to the various versions of MySQL, and the fact that many of the "published" features are really in 3.23.03+ (currently 3.23.25) and most people are running a version of 3.22 which is the last official "stable" release (3.22.32).

http://www.postcards.com
FAQ: http://www.postcards.com/FAQ/LinkSQL/

Quote Reply
Re: Users online In reply to
As pugdog mentioned, the better approach is to pull data from the Sessions table...this is what I did and I was able to get the DISTINCT function to work within my Online Users script:

http://vlib.anthrotech.com/bin/online.cgi

And as pugdog also mentioned, there is a Thread in the Links SQL Discussion Forum that addresses this issue.

Regards,

Eliot Lee

Quote Reply
Re: Users online In reply to
that looks like a great source to spam..

hehe

Jerry Su
Quote Reply
Re: Users online In reply to
yes,

and Eliot check your span ( [<<] ) the link doesn't work.

regards, alexander

Quote Reply
Re: Users online In reply to
Thanks for pointing that out, Alexander.

Very funny, Jerry su. Not really. Mad

Regards,

Eliot Lee

Quote Reply
Re: Users online In reply to
Also your banner is showing at the bottom of the first page, but when I go to the second or subsequent pages of the user list I get this text instead of a banner :

Expires: Thu, 31 Dec 1998 11:59:59 GMT Status: 301 Found Location:
http://vlib.anthrotech.com/images/banner/banner.gif

Thought you should know.

easy does it
Quote Reply
Re: Users online In reply to
Welp...I fixed that...

Wink

Regards,