The Most Dog Friendly Community Online
Join Dog Forum to Discuss Breeds, Training, Food and More

Live chat?

BeeJay

New Member
Registered
Messages
5,124
Reaction score
13
Points
0

Join our free community today.

Connect with other like-minded dog lovers!

Login or Register
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:

Welcome to Dog Forum!

Join our vibrant online community dedicated to all things canine. Whether you're a seasoned owner or new to the world of dogs, our forum is your go-to hub for sharing stories, seeking advice, and connecting with fellow dog lovers. From training tips to health concerns, we cover it all. Register now and unleash the full potential of your dog-loving experience!

Login or Register
Back
Top