Yes i have a custom php block . It is needed to browse "enter in chat" and count the number of user .
I use ajax-chat .
To obtain the block:
$count = count(chatOnlineUsers());
$user = chatOnlineUsers();
$userName = '';
for ( $i = 0; $i < $count; $i++)
{
$userName .= $user[$i];
if($i != $count-1)
{
$userName .= ', ';
}
}
if ($count == 0 )
echo '<b>Nessun Utente in Chat</b>';
elseif ($count == 1 )
echo '<b>1 Utente in Chat:</b><br />'.$userName;
else
echo '<b>'.$count.' Utenti in Chat:</b><br />'.$userName;
echo '<br /><br />';
echo '<div style="text-align:center;"><a href="http://www.stregoneria.net/forum/chat/index.php"><u><b>Entra in Chat!</b></u></a></div>';
echo '<br /><br />';
at the down of load.php , before >? add code :
function chatOnlineUsers(){
global $smcFunc;
$userName = array();
$result = $smcFunc['db_query']('', '
SELECT userName
FROM ajax_chat_online WHERE NOW() <= DATE_ADD(dateTime, interval 2 MINUTE)' ,
array()
);
while($row = $smcFunc['db_fetch_assoc']($result)) {
array_push($userName, $row['userName']);
}
$smcFunc['db_free_result']($result);
return array_unique($userName);
}
File attached
P.S Thanks for the answer.