egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Listing Users in a channel

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
Night_Prowler
Voice


Joined: 24 Feb 2007
Posts: 1

PostPosted: Sat Feb 24, 2007 4:38 pm    Post subject: Listing Users in a channel Reply with quote

I've been searching trying to find a tcl script that will allow me to list users in my IRC channel, and export the data to a text file. I have foun several, but I havent yet to get anything to work. One I did find, has two parts, the tcl script, which exports the data to a text file, and a php script that reads the text file. the tcl script works "I think" and exports to a text file, but the php script I cant figure out. Below are the two parts, any help would be greately appchiated, or if you know of something maybe more simple that would be great! Smile)

Thanks
Night_Prowler

The TCLScript:
Code:

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."


The PHP Scipt

Code:

<?
$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>";
?>


The Text Output
Quote:

On channel #STK
STKBot
Juston
Back to top
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Sat Feb 24, 2007 9:24 pm    Post subject: Reply with quote

This forum is concerned with Eggdrop Tcl scripts and not php. Here you'll find a Tcl code which will save the nick list of each channel in a file.
_________________
Follow me on GitHub

- Opposing

Public Tcl scripts
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber