SCREENSHOT: http://www.hawkee.com/profile/img/1014731/
mIRC Side for this script: http://www.hawkee.com/snippet/8962/
MySQL Database Structure:
CREATE TABLE `chanstatus` (
`channel` varchar(50) NOT NULL,
`nickname` varchar(50) NOT NULL,
`status` tinyint(6) unsigned NOT NULL,
`idle` smallint(5) unsigned NOT NULL,
`address` varchar(100) NOT NULL,
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=7687 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC;
P.S. Don't judge the PHP code, I'm used to code with my own database classes and <?=$woot?>, but this is coded to maximally suit every user and PHP version. :)
P.P.S. By playing around with it, you can integrate statistics module (http://www.hawkee.com/snippet/8958/) to show certain users stats, or even implement seen system.
<?php
# creating connection with the database server
mysql_connect("127.0.0.1", "root", "") or die("Couldn't establish connection with database.");
mysql_select_db("database");
# no need for warnings and errors
error_reporting(0);
# basic settings
$level = array("5", "4", "3", "2", "1", "0");
$symbol = array("~", "&", "@", "%", "+", "");
?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Channel Status</title>
</head>
<body>
<?php
# if client has already selected which channel to view
if (!empty($_GET['channel']) AND ctype_alnum($_GET['channel'])) {
$channel = "#".mysql_real_escape_string($_GET['channel']);
$users = mysql_result(mysql_query("SELECT COUNT(*) FROM `chanstatus` WHERE `channel`='".$channel."'"),0,0);
if (empty($users)) die("Sorry, no such channel.");
$topic = mysql_result(mysql_query("SELECT `topic` FROM `channels` WHERE `channel`='".$channel."'"),0,0);
?>
<h1><?php echo $channel; ?></h1>
<h4><?php echo $topic; ?></h4>
<table style="width: auto;">
<tr style="background-color: black; color: white;">
<th scope="col">Status</th>
<th scope="col">Nickname</th>
<th scope="col">Idle</th>
<th scope="col">Address</th>
</tr>
<?php
$list = mysql_query("SELECT * FROM `chanstatus` WHERE `channel`='".$channel."' ORDER BY `status` DESC");
while ($data = mysql_fetch_array($list)) {
?>
<tr>
<td style="text-align: right;"><?php echo str_replace($level, $symbol, $data['status']); ?></td>
<td><?php echo $data['nickname']; ?></td>
<td><?php echo $data['idle']; ?> sec.</td>
<td style="text-align: right;"><?php echo $data['address']; ?></td>
</tr>
<?php } ?>
</table>
<?php
}
# if client hasn't selected which channel to view
else {
$channels = mysql_query("SELECT DISTINCT `channel` FROM `chanstatus`");
?>
<form name="channels">
<select name="list" size="1" onChange="window.location=document.channels.list.options[document.channels.list.selectedIndex].value">
<?php while ($channel = mysql_fetch_array($channels)) { echo '<option value="?channel='.str_replace("#","",$channel['channel']).'">'.$channel['channel'].'</option>'; } ?>
</select>
</form>
<?php
}
?>
</body>
</html>