-- The entire mIRC part that does everything (just take what you need) -- alias start-php-listening { ; starts listening for the PHP script on port 5600 if ($portfree(5600)) { set %channel #sp219 socklisten php 5600 } } alias send-to-php2 { ; alias that sends $1- to PHP, so data can be sent easily with one command sockwrite -tn %bleh1 $1- } alias send-to-php { ; alias that sends $1- to PHP, so data can be sent easily with one command sockwrite -tn %bleh1 $1- sockclose %bleh1 } alias send-users { ; loop through the userlist and send each nick to PHP set %testvar 1 while (%testvar < $calc($nick($1,0)+1)) { sockwrite -tn %bleh1 $nick($1,%testvar) $+ : inc %testvar } sockclose %bleh1 } on *:socklisten:php:{ ; listens and accepts the socket request from PHP if (!$sockerr) { %sockname = usercount $+ $rand(1,99999999999999) ; accept it sockaccept usercount %sockname } } on *:sockread:usercount*:{ ; read the data from php, and put it in the variable %temp sockread -f %temp ; set the socket name so it can be used in other aliases set %bleh1 $sockname ; PHP sent the word "uptime", so send it the mirc uptime if (uptime iswm %temp) { send-to-php $uptime(mirc,2) } ; PHP sent the word "topic #somechan", so send it the topic for that channel if (topic* iswm %temp) { send-to-php $chan($gettok(%temp,2,32)).topic } ; PHP sent the word "users #somechan", so call the send-users alias to loop through and send each user if (users* iswm %temp) { send-users $gettok(%temp,2,32) } ; PHP sent the word "chans", so return all the channels im in if (chans iswm %temp) { unset %botchans | send-to-php $chansimin } ; PHP sent the word "howmanyusers", so return the number of users in each channel if (howmanyusers iswm %temp) { unset %botusers | chansimin | send-to-php %botusers } } alias chansimin { var %load = 0 var %i = 1 while (%i <= $chan(0)) { if (%i != $chan(0)) { set %botchans %botchans $+ $chan(%i) $+ : set %botusers %botusers $+ $nick($chan(%i),0) $+ : } if (%i == $chan(0)) { set %botchans %botchans $+ $chan(%i) set %botusers %botusers $+ $nick($chan(%i),0) } inc %load inc %i } return %botchans unset %load unset %i } -- The PHP chans.php -- '; //print_r($usersarray); $val = 0; $numchans = count($chansarray); //echo $numchans; while ($val < $numchans) { $chansarray[$val] = str_replace(array("\r", "\n"), '', $chansarray[$val]); $usersarray[$val] = str_replace(array("\r", "\n"), '', $usersarray[$val]); $temp = str_replace('#', '', $chansarray[$val]); echo "$chansarray[$val] ($usersarray[$val])
\n"; $val++; } ?>