The Most Dog Friendly Community Online
Join and Discover the Best Things to do with your Dog

Live chat?

BeeJay

New Member
Registered
Messages
5,124
Reaction score
13
Points
0
The Live Chat link at the top just had a ? in the number of people in the room. Any idea why?
 
Glad to know the function was working :D even if the chat room probably wasn't :( - your question was answered here. ;)

Basically it means that the bit of code that shows the number of users couldn't connect to the chat server to find out the number of users.
 
Last edited by a moderator:
Nigel said:
Glad to know the function was working :D even if the chat room probably wasn't :( - your question was answered here.  ;) Basically it means that the bit of code that shows the number of users couldn't connect to the chat server to find out the number of users.
The Chat Room was working 'cause I clicked on it to see what a ? was. Well it was working immediately after I logged on I should say.
 
OK. The code I wrote waits the smallest amount of time possible for the chat server to respond - so that it doesn't hold up loading of pages if it shouldn't respond. I suppose it was just one of those times it didn't respond quick enough.
 
Last edited by a moderator:
>The code I wrote

Ah it's the code that you wrote Nigel. I see the problem now. :D
 
BeeJay said:
Ah it's the code that you wrote Nigel.  I see the problem now.   :D
I know you were dying to ask but...

So here you are Barbara, just for you

Code:
    //---------------------------------------------
   // Find out how many chat users & show them
   // $chatusers has number or ? if failed to connect
   //---------------------------------------------

$chatusers = "";
$error_status = error_reporting();
error_reporting(E_ERROR);
$fp = fsockopen("localhost", 11100, &$errno, &$errstr, 1);
error_reporting($error_status);
if(!$fp) {
 $chatusers = "";
} else {
 fputs($fp,"GET /?api.UserCount HTTP/1.0\n\n");
 $header = true;
 $stream_read = array("timed_out" => 0);
 while(!feof($fp) and !$stream_read["timed_out"]) {
 	$start = time();
   	socket_set_timeout($fp, 0,500000);
 	$line = fgets($fp,128);
 	$stream_read = (stream_get_meta_data($fp));
 	if ( $header == false ) $chatusers .= $line;
 	if ( trim($line) == "" ) $header = false;
 }
 fclose($fp);
}
if ($chatusers == "") {
 $chatusers = "?";
}
$chatusers = trim($chatusers);

$ibforums->skin['template'] = str_replace( "<!--CHATUSERS-->"     , $chatusers                     , $ibforums->skin['template']);
 
Last edited by a moderator:
Back
Top