| 1234567891011121314151617181920212223242526272829303132 |
- <?php
- function readNbUserPerChannel()
- {
- require_once("./.htconfig.php");
- $dblink = getlink();
- $result = array();
- $userCountPerChan = $dblink->query("SELECT anope_userstats_chan.channel, count(nickid) as nbuser FROM `anope_userstats_ison` inner join anope_userstats_chan on anope_userstats_chan. chanid=anope_userstats_ison.chanid inner join knacki_official ON knacki_official.channel = anope_userstats_chan.channel group by anope_userstats_chan.chanid order by channel");
- $userCountPerChan->setFetchMode(PDO::FETCH_OBJ);
- while ($i = $userCountPerChan->fetch())
- $result[$i->channel] = $i->nbuser;
- return $result;
- }
- function printNbUserPerChannelAsTable()
- {
- // FIXME catch error
- ?><table>
- <tr>
- <th>Channel</th>
- <th>Connected user</th>
- </tr>
- <?php foreach(readNbUserPerChannel() as $channel => $usercount){ ?>
- <tr>
- <td><?php echo $channel; ?></td>
- <td><?php echo $usercount; ?></td>
- </tr>
- <?php } ?>
- </table><?php
- }
- ?>
|