I have a script that prints the output of a /lusers to a txt file, but i can't get it to print...fo example to a .php file as;
Code: Select all
<? $lusers='
<here the same output as the .txt>
'\;" ?>
Code: Select all
<? $lusers='
<here the same output as the .txt>
'\;" ?>
Code: Select all
set lusers_setting(page) "/home/public_www/msc/lusers.txt"
set lusers_setting(timer_update) "5"
set lusers_setting(nettype) "4"
####################
# Code begins here #
####################
foreach rb {250 251 252 253 254 255 265 266} { bind raw - $rb lusers_write_lusers }
if {[lsearch -glob [utimers] "* lusers_update *"] == -1} { utimer $lusers_setting(timer_update) lusers_update }
foreach a [array names lusers_lusers_data] { unset lusers_lusers_data($a) }
switch -regexp -- $lusers_setting(nettype) {
"^1\$" { set lusers_setting(lastnum) "250" }
"^(2|\[5-7\])\$" { set lusers_setting(lastnum) "266" }
"^(3|4)\$" { set lusers_setting(lastnum) "255" }
}
proc lusers_rcodes {text} {
regsub -all -- "\002|\037|\026|\017|\003(\[0-9\]\[0-9\]?(,\[0-9\]\[0-9\]?)?)?" $text "" text
return $text
}
proc lusers_write_lusers {from keyword text} {
set ::lusers_localserver $from
if {[regexp 252|254 $keyword]} { regsub -all -- ":" $text "" text }
set ::lusers_lusers_data($keyword) [string trimleft [join [lrange [split $text] 1 end]] :]
if {[string compare $keyword $::lusers_setting(lastnum)] == 0} { lusers_do_final }
}
proc lusers_do_final {} {
set stats [open $::lusers_setting(page) w]
foreach i [array names ::lusers_lusers_data] { puts $stats " [lusers_rcodes $::lusers_lusers_data($i)] " }
close $stats
foreach a [array names lusers_lusers_data] { unset lusers_lusers_data($a) }
}
proc lusers_update {} {
putserv "LUSERS"
if {[lsearch -glob [utimers] "* lusers_update *"] == -1} { utimer $::lusers_setting(timer_update) lusers_update }
}