Concurrent Users

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mmcoolkid94
Forum Newbie
Posts: 8
Joined: Mon Jun 19, 2006 9:07 pm

Concurrent Users

Post by mmcoolkid94 »

Can anyone help me with a code to show how many users are on at once?
*I got nothing :? *
Last edited by mmcoolkid94 on Wed Jun 21, 2006 7:53 pm, edited 3 times in total.
Grim...
DevNet Resident
Posts: 1445
Joined: Tue May 18, 2004 5:32 am
Location: London, UK

Post by Grim... »

Have a bit of included code on each page that updates a field in their row of the user table to show the time they were last active.
Then have something like

Code: Select all

$time = $timenow - $five_minutes //or whatever

Code: Select all

SELECT * FROM users WHERE active_date > $time
Hint: I like to use mktime() to get the epoch time, store that, and just use

Code: Select all

$time = mktime() - 300; //five minutes ago
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

I think the word you want is 'Concurrent', not 'Congruent', though I could be mistaken.

To answer you question, when I set up my user table I uisually include a field for logged_in. This is used to support DB sessions for the user and can easily be adapted to check the count of users that are logged in...

Code: Select all

<?php
$sql = "SELECT COUNT(user_id) AS users_online FROM user_table WHERE user_logged_in = 1";
?>
User avatar
tecktalkcm0391
DevNet Resident
Posts: 1030
Joined: Fri May 26, 2006 9:25 am
Location: Florida

Post by tecktalkcm0391 »

You must mean concurrent users if so please change it in your title ...
is this something your looking for?: http://www.tutorialized.com/forum/viewtopic.php?t=46

if not how about: http://www.hotscripts.com/Detailed/23850.html
that page is a little confusing it trys to take you here:
http://www.ridwank.com/index.php?script=6 and you can download the script here: http://ridwank.host.sk/download/ preview it here: http://www.ridwank.com/script/whosonline/whosonline.php


i know your new, and not to be rude, but next time try googleing... php + what you want to look for before you post a message. :D :D

Chris
mmcoolkid94
Forum Newbie
Posts: 8
Joined: Mon Jun 19, 2006 9:07 pm

Post by mmcoolkid94 »

Is there a way so I can see where the Ip Adress is coming from like a map of the World with little dots of every Computer.
Last edited by mmcoolkid94 on Thu Jun 22, 2006 9:12 am, edited 2 times in total.
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Post by Weirdan »

Is there a way so I can see where the Ip Adress is coming from like a map of the World with little dots of every Computer.
It's not an easy task I guess... though one could use geoip together with google maps.
User avatar
tecktalkcm0391
DevNet Resident
Posts: 1030
Joined: Fri May 26, 2006 9:25 am
Location: Florida

Post by tecktalkcm0391 »

Hey,

http://webmonkey.wired.com/webmonkey/04 ... rogramming

Would be another tutorial I found that might be something like it. And try google maps API for the dot thing.
Post Reply