Thanks
Night_Prowler
The TCLScript:
Code: Select all
set i2h_htmlfile "/var/www/html/Chat/users.txt"
set i2h_chan "#STK"
set i2h_text "#000000"
set maxupdate 60
bind join - "$i2h_chan %" i2h:make
bind kick - "$i2h_chan %" i2h:make
bind nick - "$i2h_chan %" i2h:make
proc i2h:make {args} {
global i2h_htmlfile i2h_chan i2h_text server maxupdate
set i2h_file [open $i2h_htmlfile w]
set online [chanlist $i2h_chan]
set count [llength $online]
set users [lindex $online 0]
set users "[nick2hand $users $i2h_chan]users"
for {set i 1} {$i < $count} {incr i 1} {
set user [lindex $online $i]
set ch_text [getchanhost $user]
regsub -all \@.* $ch_text "" ch_text
regsub -all ~ $ch_text "" ch_text
set users "$users%20[nick2hand $user]%20$ch_text%20$user"
}
puts $i2h_file "$users<br>\n"
close $i2h_file
if {[utimerexists ""] == ""} {utimer $maxupdate i2h:make}
return 1
}
proc utimerexists {i2h:make} {
foreach j [utimers] {if {[string compare [lindex $j 1] i2h:make] == 0} {return [lindex $j 2]}}
return
}
proc i2h:convert {i2h_text} {
#Strip control codes.. sorta
regsub -all . $i2h_text "" i2h_text
regsub -all . $i2h_text "" i2h_text
regsub -all . $i2h_text "" i2h_text
regsub -all . $i2h_text "" i2h_text
regsub -all . $i2h_text "" i2h_text
#Convert special chars
regsub -all & $i2h_text "\&" i2h_text
regsub -all \" $i2h_text "\"" i2h_text
regsub -all < $i2h_text "\<" i2h_text
regsub -all > $i2h_text "\>" i2h_text
regsub -all " " $i2h_text " \ " i2h_text
return $i2h_text
}
i2h:make
utlog "IRC Bot nick list loaded."
Code: Select all
<?
$onlinefile = "http://chat.hl2stk.net/~jgriggs/users.txt";
$killname = array("bot", "_$");
$httpfaulttime = 5;
function urlExists($url)
{
$url = ereg_replace("http://", "", $url);
list($domain, $file) = explode("/", $url, 2);
$fid=fsockopen($domain,80, $errno1, $errstr1,$httpfaulttime);
@fputs($fid,"GET /$file HTTP/1.0\r\nHost: $domain\r\n\r\n");
@$gets = fgets($fid, 1024);
@fclose($fid);
if (ereg("HTTP/1.1 200 OK", $gets)) return true;
else return false;
}
if (!urlExists($onlinefile)) {
$chatterson ="Error Getting User List.\n";
$onlineirc="0";
}
else {
$file = fopen($onlinefile, "r");
while (!feof($file)) {
$buffer .= fgets($file, 4096);
}
fclose($file);
$buffer = strip_tags ($buffer);
$buffer = chop($buffer);
$chatterson ="";
$temparray = explode ("%20", $buffer);
$temparraysize = sizeof ($temparray);
$k = 0;
for ($i = 0; $i < $temparraysize; $i+=3) {
$bufferarray[handle1][$k] = ($temparray[$i]);
$bufferarray[host][$k] = ($temparray[$i+1]);
$bufferarray[nick][$k] = ($temparray[$i+2]);
$k+=1;
}
$bufferarraysize = (sizeof ($temparray)/3);
$onlineirc = ($bufferarraysize);
$buffercount=0;
for ($buffercount=0; $buffercount < $bufferarraysize; $buffercount++) {
$tempbuff=$bufferarray[nick][$buffercount];
foreach ($killname as $kilvalue) {
if (eregi($kilvalue, $tempbuff)) {
$onlineirc=$onlineirc-1;
$bufferarray[nick][$buffercount] = "";
continue ;
} } }
unset($chatterson);
for ($i = 0; $i < $bufferarraysize; $i++) {
if (!$bufferarray[nick][$i] == "") {
if (!$chatterson == "") {
$chatterson = $chatterson.", ".$bufferarray[nick][$i];
}
else { $chatterson = $bufferarray[nick][$i]; }
}}
}
echo "<tr><td colspan=\"3\" bgcolor=\"#FFFFFF\"><font color=\"#FF6600\" size=\"1\"><div align=\"center\"><b>
$chatterson</div></b></font></td>
</tr><tr><td width=\"33%\" bgcolor=\"#FFFFFF\"><font color=\"#000000\"><b><div align=\"center\">Total Number of Users:</b></font></a><font color=\"#000000\"><b> $onlineirc</div></td><td width=\"34%\" bgcolor=\"#FFFFFF\"><div align=\"center\"><b><a href=\"jIRC+main.html\" target=\"_blank\">Click Here to Connect.</div></b></td><td width=\"33%\" bgcolor=\"#FFFFFF\"><div align=\"center\"><b><a href=\"irc://irc.ircserver.com:6667/Channelname\">#Channelname on irc.ircserver.com:6667</a></div></b></font></td></tr>";
?>
On channel #STK
STKBot
Juston