diff --git a/plugins/other/murmur_users b/plugins/other/murmur_users new file mode 100755 index 00000000..ab9d1865 --- /dev/null +++ b/plugins/other/murmur_users @@ -0,0 +1,150 @@ +#!/usr/bin/php +=5000 ) || $limit <= 0) $limit = 5000; +$out = shell_exec("tail -n ".$limit." \"".$logfile."\""); +$fp = split("\n",$out); +if(!count(@$fp)) { + fwrite(STDOUT, "0\n"); + return 1; + } +//var_dump($fp); +$online=0; +$offline=0; +$seen = array(); +for($i=count($fp);$i>(count($fp)-$limit);--$i) +{ + $l = trim($fp[$i]); + if(!$l) continue; + list( + $crap, + $w, + $date, + $time, + $serverid, + $id, + $nick, + $id2, + $msg, + ) = preg_split("/<(.*)>(.*) (.*) ([0-9]) => <(.*)\:(.*)\((.*)\)>(.*)/",$fp[$i],-1,PREG_SPLIT_DELIM_CAPTURE); + if(!strlen(trim($nick))) continue; + if(!array_key_exists($nick,$seen)){ + if( + strpos($msg," Connection closed")!==FALSE + || strpos($msg," Tiemout")!==FALSE + ){ + $seen[$nick]['online'] = 0; + $offline+=1; + + } + else + { + $seen[$nick]['online'] = 1; + $online+=1; + + } + } +} + +fwrite(STDOUT, "murmur.value ".$online."\n"); +//var_dump($seen); + +return 0; + +///////////////////////////////////////////////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////////////////////////////////////////// +//end of file +?> \ No newline at end of file