hey people. i am asking if it is posible to check for the user status using php. i mean to know if the user if online or offline.
i am trying to build a chatting system that alow me to know who is online and who is offline.

Recommended Answers

All 6 Replies

i guess this is one of the things i want to know. but now i got another question which is how do i use this technology?
and i am asking how to know who is online like facebook.
you can see a list of the people who are online and chat with them. so this is what i am asking about

Member Avatar for diafol

websocket.org echo example does nothing for me. Says my browser supports it (chrome10 Win), but nothing happens on connect.

Hi

maybe you could try...

when the user logs in:

$user = "logged-in/$username";
$user = fopen($user, 'w') or die('ERROR');
fclose($page);

on logout:

unlink($username);

to list users:

$users = sort(glob('logged-in/*'));
foreach ($users as $user) {
  print $user; 
  print '<br />';
}

good luck :)

Calum

In order to track users, you'll need some sort of logon process. The previous post provides a low-end approach to doing this. This may satisfy your needs, otherwise you'll want to look at using a database to keep the user information, including their login status. You need a process to force a logoff for anyone who is inactive for a set period of time. Otherwise, everyone will eventually show as logged on / active.

good point chrishea; i'm not very familiar with mysql... lol, thats why my cms is flat file!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.