Code: Select all
set debug 0
set ver "1.1"
set dbhost "_host_"
set dbuser "_user_"
set dbpass "_pass_"
set dbname "_name_"
set timeoff 1141
set date [clock seconds]
set estdate [expr $date - $timeoff]
set lastdate [expr $estdate - 3600]
timer 5 checkdb
proc checkdb { } {
global dbhost dbuser dbpass dbname ver debug lastdate
set dbconnect [mysqlconnect -host $dbhost -user $dbuser -password $dbpass]
mysqluse $dbconnect $dbname
if { [mysqlstate $dbconnect -numeric] == 0 } {
putlog "Could not connect to $dbhost (Unlooping script) -- Forum IRC Notifier $ver"
mysqlclose $dbconnect
return 0
} else {
if { $debug == 1 } {
putlog "Connected to $dbhost -- Forum IRC Notifier $ver"
}
putlog "#Topic Report# Parsing"
set sql "SELECT * FROM ibf_topics WHERE start_date > $lastdate ORDER BY start_date DESC"
set numrows [mysqlsel $dbconnect $sql]
if { $numrows != 0 } {
for { set i 0 } { $i < $numrows } { incr i } {
set res [mysqlnext $dbconnect]
set topicid [lindex $res 0]
set topic [lindex $res 1]
set poster [lindex $res 10]
set lastdate [lindex $res 6]
set link "http://www.teamexcess.net/forums/index.php?showtopic=$topicid"
putserv "PRIVMSG #excess :\002New Excess.ca Forum Post:\002 $topic"
putserv "PRIVMSG #excess :\002Link:\002 $link - \002By:\002 $poster"
}
}
mysqlclose $dbconnect
return 0
}
}