Forum Moderators: coopster

Message Too Old, No Replies

Username, reg. & guest count

I can't find a script!

         

Moonbrat

9:56 am on Dec 2, 2004 (gmt 0)

10+ Year Member



Hiya.

I'm TRYING to find a script that I can incorperate into my already existing tables that will allow me to pull who is online and how many like this (I need it for my archive of writing):

Who's Online: Moonbrat, Admin
Guests Online: 12
Members Online: 2

But I can't seem to find any. All of them are saying I'd basically have to destroy the login/signup script I have (which I DON'T want to do because all my members have encrypted passwords in my MySQL and there's too many to redo) and others only give one 1 username which is like: welcome (username) to....
Which is something I DON'T want either.

Can anyone suggest what I can do?
So far I have two scripts that do:

First: Total Online: 14
Second: 1 User registered in the past 24 hours: Moonbrat

I'm sorry to be such a pain in the rear-end.

-MB

ergophobe

10:03 am on Dec 2, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Welcome to WebmasterWorld Moonbrat.

You could just add a query at the top of the script. Since you just want to log it, you don't even need to display it. So...

- query for all users who have made a request in the last X minutes
- then run through the result set and store it in your archive in the desired format.

Let us know if you need more guidance than that.

Tom

Moonbrat

10:56 am on Dec 2, 2004 (gmt 0)

10+ Year Member



Sorry I'm a little new here, but wouldn't that just show only ONE name, whereas I want to show ALL the names of the people logged in so others can see the usernames too?

Thankyou.
-MB

ergophobe

11:47 am on Dec 2, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Warning: I'm super tired, so this may not be the most coherent post....

No, it would get all users. Let's say you have a table with the following columns


userid name last_login
1 Qautle 2004-10-21 12:00:00
2 Phlamro 2004-11-21 12:00:00
3 Marok 2004-11-21 12:00:00

$q = "SELECT name FROM users
WHERE DATE_SUB(NOW(),INTERVAL 5 MINUTE) <= last_login";

$result = mysql_query($q);

while($user = mysql_fetch_array($result))
{
$user_string .= $user['name'] . ", ";
}

echo substr($user string, 0, -2) // strip off last , and space.

That outputs a list of all users online. If you want to log it, I don't know how you want the data to look and how you want to log it, but that's roughlyhow you'd go about it.

newads

8:59 am on Dec 3, 2004 (gmt 0)

10+ Year Member



USE XOOPS..........

www.xoops.org