This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Timer Problems

Old posts that have not been replied to for several years.
Locked
G
Guest

Post by Guest »

I'm using PHP Nuke in my website and I found a way to connect TCL to MySQL for extract the articles index and randomly make announces in all channels the bot is. This task is acomplished by the timer function but this sometimes works well and others fails making announces in some channels and sometime nothing . Here go my $0.02 for you guys, and please help me if you know some fix to that problem:

set hostname "x.x.x.x"
set user "username"
set password "password"
set db "databasename"
set cc "!"
set ver "1.00"
set intervalo 15
set html "<.*?>"
set espacio " "
if {[info commands mysqlconnect] == ""} { load libmysqltcl.so }
if {[info commands mysqlconnect] == ""} { putlog "[info script] needs libmysqltcl.so - not installed!"; return 0 }



proc getnotice {} {
global hostname user password db html espacio
set conn [mysqlconnect -host $hostname -user $user -password $password -db $db]
mysqluse $conn $db
set query1 "SELECT count(*) FROM nuke_stories;";
set result1 [mysqlsel $conn "$query1"]
set total [mysqlnext $conn]
set position [rand $total]
set query2 "SELECT sid,title,topic,hometext FROM nuke_stories LIMIT $position,1;";
set result2 [mysqlsel $conn "$query2"]
mysqlmap $conn {sid title topic hometext} {set anuncio "mag-net $sid $title $topic"}
set query3 "SELECT topictext FROM nuke_topics where topicid = $topic;";
set result3 [mysqlsel $conn "$query3"]
mysqlmap $conn {topictext} {set textocompleto "mag-net $topictext"}
mysqlclose
regsub -all "n" $hometext "" storytext1
regsub -all "r" $storytext1 "" storytext2
regsub -all "$html" $storytext2 " " storytext3
regsub -all "$espacio" $storytext3 " " storytext4
set cadena "^B^C4$topictext : $title : http://www.mag-net.com.mx/article.php?sid=$sid^C4^B : ^C7$storytext4"
set trimmedtext [string range $cadena 1 300]
set texto "^C7$trimmedtext^C3 ... ^BLéelo en Mag-net^C3^B"
return $texto
}

proc mag-net { } {
global intervalo
set cadena [getnotice]
foreach c [string tolower [channels]] {
putserv "PRIVMSG $c :$cadena"

}
set tiempo [timer $intervalo { mag-net }]

}

if {![info exists magrun1]} {
mag-net
set magrun1 1
}

putlog "02Mag-Net HeadLines02 v$ver by ViAjErO loaded."

<font size=-1>[ This Message was edited by: ViAjerO on 2001-10-05 22:21 ]</font>
Locked