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.

The best way to do this?

Help for those learning Tcl or writing their own scripts.
Post Reply
l
leandro
Voice
Posts: 13
Joined: Sat Jun 02, 2007 9:43 am

The best way to do this?

Post by leandro »

Hi.

I'm creating an online database of akicks from a channel. Akicks can be added to the database via a webserver.

I display the newly added akicks on a webpage, which then the eggdrop must read, add them in chanserv, and mark them on the webserver.

But what is the best way to do this? Should I save the whole webpage to a .txt, then loop through the file, opening and closing a connection for each akick that needs to be set? Or should I do something else?


Thanks for your help.
User avatar
CrazyCat
Revered One
Posts: 1334
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

are you using a SQL database? if yes, you'd better use the mysql package to access directly to the datas.
l
leandro
Voice
Posts: 13
Joined: Sat Jun 02, 2007 9:43 am

Post by leandro »

Yes, MySQL.

Can you explain me how to do this in a more detailled manner?
r
r0t3n
Owner
Posts: 507
Joined: Tue May 31, 2005 6:56 pm
Location: UK

Post by r0t3n »

Lets say you have a mysql database named akicks, with the fields mask, set.

Code: Select all

bind time - "?0 * * * *" akick:update

proc akick:update {min hour day month year} {
    if {[catch {[set mysql [mysql::connect -user username -password mypassword -host localhost -port 3306 -db akicks]} err]} {
        putlog "mysql error"
        foreach line [split $err \n] { putlog "$line" }
        putlog "end of error"
    } else {
        set result [mysql::sel $mysql "SELECT * FROM `akicks` WHERE `set` = '0';" -list]
        if {$result == ""} { return }
        foreach akick $result {
            if {$akick == ""} { return }
            set mask [lindex [split $akick] 0]
            putlog "adding '$mask' to akick list for #mychannel"
            putquick "PRIVMSG ChanServ :akick #mychannel add $mask"
            mysql::exec $mysql "UPDATE `akicks` SET `set` TO '1' WHERE `mask` = '$mask';"
        }
        putlog "updated akicks"
    }
}
This is just an example, not guaranteed working![/code]
r0t3n @ #r0t3n @ Quakenet
l
leandro
Voice
Posts: 13
Joined: Sat Jun 02, 2007 9:43 am

Post by leandro »

Thank you very much!

I'll look into that!
Post Reply