Codeblok:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
[COLOR= #0000BB]<?php[/COLOR]
require_once dirname[COLOR= #007700]([/COLOR]__FILE__[COLOR= #007700]).[/COLOR][COLOR= #DD0000]"/../src/pfcinfo.class.php"[/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$info[/COLOR] [COLOR= #007700]= new[/COLOR] pfcInfo[COLOR= #007700]([/COLOR]
md5[COLOR= #007700]([/COLOR][COLOR= #DD0000]"Whois online demo"[/COLOR][COLOR= #007700]) );[/COLOR]
[COLOR= #FF8000]// NULL is used to get all the connected users, but you can specify
// a channel name to get only the connected user on a specific channel[/COLOR]
[COLOR= #0000BB]$users[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$info[/COLOR][COLOR= #007700]->[/COLOR]getOnlineNick[COLOR= #007700]([/COLOR]NULL[COLOR= #007700]);[/COLOR]
echo [COLOR= #DD0000]"<h1>A demo which explains how to get the connected users list</h1>"[/COLOR][COLOR= #007700];[/COLOR]
echo [COLOR= #DD0000]<div style="margin: auto; width: 70%; border: 1px solid red; background-color: #FDD; padding: 1em;">[/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$info[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]""[/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$nb_users[/COLOR] [COLOR= #007700]=[/COLOR]
count[COLOR= #007700]([/COLOR][COLOR= #0000BB]$users[/COLOR][COLOR= #007700]);[/COLOR]
if [COLOR= #007700]([/COLOR][COLOR= #0000BB]$nb_users[/COLOR] [COLOR= #007700]<=[/COLOR] [COLOR= #0000BB]1[/COLOR][COLOR= #007700])[/COLOR]
[COLOR= #0000BB]$info[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]"<strong>%d</strong> user is connected to the server !"[/COLOR][COLOR= #007700];[/COLOR]
else
[COLOR= #0000BB]$info[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]"<strong>%d</strong> users are connected to the server !"[/COLOR][COLOR= #007700];[/COLOR]
echo [COLOR= #DD0000]"<p>"[/COLOR][COLOR= #007700].[/COLOR]
sprintf[COLOR= #007700]([/COLOR][COLOR= #0000BB]$info[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$nb_users[/COLOR][COLOR= #007700]).[/COLOR][COLOR= #DD0000]"</p>"[/COLOR][COLOR= #007700];[/COLOR]
echo [COLOR= #DD0000]"<p>Here is the online nicknames list of <a href=./demo31_show_who_is_online-chat.php>this chat</a>:</p>"[/COLOR][COLOR= #007700];[/COLOR]
echo [COLOR= #DD0000]"<ul>"[/COLOR][COLOR= #007700];[/COLOR]
foreach[COLOR= #007700]([/COLOR][COLOR= #0000BB]$users[/COLOR] [COLOR= #007700]as[/COLOR] [COLOR= #0000BB]$u[/COLOR][COLOR= #007700])
{[/COLOR]
echo [COLOR= #DD0000]"<li>"[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$u[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000]"</li>"[/COLOR][COLOR= #007700];
}[/COLOR]
echo [COLOR= #DD0000]"</ul>"[/COLOR][COLOR= #007700];[/COLOR]
echo [COLOR= #DD0000]"</div>"[/COLOR][COLOR= #007700];[/COLOR]
?>
zoiets moet je dan gebruiken?
dan is die $nb_users het aantal denk ik, maar misschien even cachen dit aantal ?
edit: als ik in die pfcInfo class kijk staat er al wel iets van cache, geen idee wat die doet.