i need one tcl for web database
tcl who can write html file with users in eggdrop userfile
are someone have tcl like this example
Code: Select all
bind dcc n writehtml write_html
bind pub n !writehtml write_html
bind msg n writehtml write_html
proc write_html {args} {
set fp [open users.html w]
foreach u [userlist] {
puts $fp "$u<br>"
}
close $fp
return 1
}
Code: Select all
bind dcc n writehtml write_html
bind pub n !writehtml write_html
bind msg n writehtml write_html
proc write_html {args} {
set fp [open users.html w]
foreach u [userlist] {
puts $fp "$u<br>"
}
close $fp
return 1
}
Code: Select all
set wwwfile "/home/bla/bla/bla/record.htm"
set bodytag {<body bgcolor="#FFFFFF" text="#000000" link="#000000">}
set update_time 5
set update_rate 5
set www_enable 1
set th_a(0) "#999999"
set th_a(1) "#999999"
set td_a(0) "#c0c0c0"
set td_a(1) "#e0e0e0"
set bot_admin "Vizor"
set admin_email "Vizor@mail.com"
proc sort {user} {
set chan [string tolower $user]
foreach i [userlist] {
if {![matchchanattr $i 15|15 ]} {
set some [lindex [getuser $i XTRA created] 0]
if {$some != "" && $i != "*ban"} {
lappend list "$some $i"
}
}
}
set list [lsort -increasing -integer -index 0 $list]
return $list
}
bind dcc K dorecord dcc_dorecord
proc dcc_dorecord {hand idx text} {
switch -glob [clock format [clock seconds] -format %M] {
default {
do_stats
putdcc $idx "Updating webfiles."
return 1
}
}
}
proc do_stats {} {
global wwwfile bodytag botnick update_time th_a td_a bot_admin admin_email
foreach statuser [channels] {
putserv "ping 0"
set out "<meta http-equiv=\"Refresh\" content=\"[expr $update_time * 60]\">"
append out "\n<html><head>\n"
append out "<title>$botnick User File Records</title>\n"
append out "\n</head>\n"
append out "\n$bodytag\n"
append out "\n<center><h1>$botnick User File Records</h1>"
append out "\n<table width=100% valign=top border=0>\n<caption><br>"
append out "\n Last Update : [clock format [clock seconds] -format "%d.%m.%Y %H:%M"]<br>"
append out "\n Next Update in $update_time minute(s)."
append out "</caption>\n<tr>"
append out "\n<th align=center bgcolor=\"$th_a(0)\"><font size=2 face=Verdana>Nr</th>"
append out "\n<th align=center bgcolor=\"$th_a(1)\"><font size=2 face=Verdana>Nick</th>"
append out "\n<th align=center bgcolor=\"$th_a(0)\"><font size=2 face=Verdana>Global Flags</th>"
append out "\n<th align=center bgcolor=\"$th_a(1)\"><font size=2 face=Verdana>Added ...</th>"
append out "\n<th align=center bgcolor=\"$th_a(0)\"><font size=2 face=Verdana>Comment</th>"
append out "\n<th align=center bgcolor=\"$th_a(1)\"><font size=2 face=Verdana>Info</th>"
append out "\n<th align=center bgcolor=\"$th_a(0)\"><font size=2 face=Verdana>E-mail</th>"
append out "\n</tr>"
set lista [lrange [sort ""] 0 999]
set no 0
foreach i $lista {
incr no
set handle [lindex $i 1]
set flags [matchchanattr $handle ""]
if {[matchchanattr $handle "+n"]} {set flags Owner}
if {[matchchanattr $handle "+m-n"]} {set flags Master}
if {[matchchanattr $handle "+o-m"]} {set flags Op}
if {[matchchanattr $handle "+b"]} {set flags Bot}
if {[matchchanattr $handle "+t-m"]} {set flags "Bot Master"}
if {[matchchanattr $handle "+d"]} {set flags +d}
if {[matchchanattr $handle "+k"]} {set flags +dk}
if {$flags == 1 } {set flags -}
set added [getuser $handle XTRA Added]
if {$added == ""} {set added -}
set comment [getuser $handle COMMENT]
if {$comment == ""} {set comment -}
set info [getuser $handle INFO]
if {$info == ""} {set info -}
set email [getuser $handle XTRA Email]
if {$email == ""} {set email -}
append out "\n<tr>"
append out "\n<td align=center bgcolor=\"$td_a(0)\"><font size=1 face=Verdana color=red>$no</td>"
append out "\n<td align=center bgcolor=\"$td_a(1)\"><font size=1 face=Verdana>$handle</td>"
append out "\n<td align=center bgcolor=\"$td_a(0)\"><font size=1 face=Verdana>$flags</td>"
append out "\n<td align=center bgcolor=\"$td_a(1)\"><font size=1 face=Verdana>$added</td>"
append out "\n<td align=center bgcolor=\"$td_a(0)\"><font size=1 face=Verdana>$comment</td>"
append out "\n<td align=center bgcolor=\"$td_a(1)\"><font size=1 face=Verdana>$info</td>"
append out "\n<td align=center bgcolor=\"$td_a(0)\"><font size=1 face=Verdana><a href=\"mailto:$email\">$email</a></td>"
append out "\n</tr>"
}
append out "\n</table></center>"
append out "\n<table width=100% valign=top border=0>\n<caption><br>"
set cnt 0
foreach usr [userlist +n] {
incr cnt 1
}
set cnt1 0
foreach usr [userlist +m-n] {
incr cnt1 1
}
set cnt2 0
foreach usr2 [userlist +b-nm] {
incr cnt2 1
}
append out "\n<b>Total Users in the bot database [countusers]</b><br>"
append out "\n<b>Owner $cnt</b><br>"
append out "\n<b>Masters $cnt1</b><br>"
append out "\n<b>Bots $cnt2</b><br>"
append out "\n</table></caption></center><br>"
append out "\n<center>Please report any bugs to <A HREF=\"mailto:sysadmin@crazysexycool.com\">CrazyD</A> © 2002"
append out "\n<center>Any questions about add and flags send to Admins and Masters <A HREF=\"mailto:$admin_email\">$bot_admin </A>"
append out "</center>"
append out "\n</body></html>"
set fd [open "$wwwfile" w]
puts $fd $out
close $fd
unset out
}
}
proc do_record_run {} {
global update_rate www_enable
if {$www_enable} {
do_stats
if { ![string match "* do_record_run *" [timers]] } {
timer $update_rate do_record_run
}
}
}
proc do_record_check {} {
global update_rate
if { ![string match "* do_record_run *" [timers]] } {
timer $update_rate do_record_run
}
}
do_record_check