Jump to content

Recommended Posts

Hi,

 

I got online users - when somebody go online, his NAME goes to "chat_online" table, and than see it in query.

 

I got in browser cookies:

 

name

password

session

 

How can I remove (delete) online user from "chat_online" table when he close the browser window?

 

 

"chat_online" table have:

 

chat_online_id

chat_online_user

chat_online_session

 

rows.

 

When somebody goes online his username and session goes in the table.

 

 

<?php
//Query return from dbase
$query_return = mysql_query("SELECT DISTINCT `chat_online_user` FROM `chat_online` ORDER BY `chat_online_user` ASC");

	if(!$query_return) {
		print mysql_error();
		exit;
	}

while($request = mysql_fetch_array($query_return)) {

	print "<p class=\"TXT_USER_ADMIN\">".$request['chat_online_user']."</p>";

}
?>

You cant do that with PHP on the fly unless you use AJAX or some other technology that links server with client in real time.

 

 

No need remove in real time - can I do this with cookie? (after 1-5 min)

You'd have to have a new table. Everytime the user performs an action update the table.

Then have a cron run every 2-3 minutes and check if their has been any activity in the last X minutes from the users. If there hasnt, then delete their name from the chat_online table.

You'd have to have a new table. Everytime the user performs an action update the table.

Then have a cron run every 2-3 minutes and check if their has been any activity in the last X minutes from the users. If there hasnt, then delete their name from the chat_online table.

 

 

I see, I think I must to find other way to do that - Ajax or other - because maybe the user will be there few hours without to want to say something.

 

Where can I find something about - ajax - the other way to do that?

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.