egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The best way to do this?

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
leandro
Voice


Joined: 02 Jun 2007
Posts: 13

PostPosted: Tue Oct 30, 2007 12:50 pm    Post subject: The best way to do this? Reply with quote

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.
Back to top
View user's profile Send private message
CrazyCat
Revered One


Joined: 13 Jan 2002
Posts: 1032
Location: France

PostPosted: Tue Oct 30, 2007 1:00 pm    Post subject: Reply with quote

are you using a SQL database? if yes, you'd better use the mysql package to access directly to the datas.
_________________
https://www.eggdrop.fr - French IRC network
Offer me a coffee - Do not ask me help in PM, we are a community.
Back to top
View user's profile Send private message Visit poster's website
leandro
Voice


Joined: 02 Jun 2007
Posts: 13

PostPosted: Tue Oct 30, 2007 1:02 pm    Post subject: Reply with quote

Yes, MySQL.

Can you explain me how to do this in a more detailled manner?
Back to top
View user's profile Send private message
r0t3n
Owner


Joined: 31 May 2005
Posts: 507
Location: UK

PostPosted: Tue Oct 30, 2007 3:43 pm    Post subject: Reply with quote

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

Code:
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
Back to top
View user's profile Send private message MSN Messenger
leandro
Voice


Joined: 02 Jun 2007
Posts: 13

PostPosted: Tue Oct 30, 2007 3:45 pm    Post subject: Reply with quote

Thank you very much!

I'll look into that!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber