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 

Need help "[ ] { } ' - /"

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


Joined: 12 Mar 2008
Posts: 61

PostPosted: Sat Mar 21, 2009 7:35 pm    Post subject: Need help "[ ] { } ' - /" Reply with quote

Hello

I made a simple auth-sistem with mysql.
It saves your nickname in a table when you AUTH.

But i'm having a little trouble with nicknames with [ ] { } ' - /, the bot just dont read them or add some { }.

Any solution?

Thanks,
GaRfWeN
Back to top
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Sat Mar 21, 2009 9:48 pm    Post subject: Reply with quote

Do you think you could post the script?
_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
garfwen
Halfop


Joined: 12 Mar 2008
Posts: 61

PostPosted: Sun Mar 22, 2009 9:18 am    Post subject: Reply with quote

Hello.

The scripts is a little big, i'll post the "auth" proc:

Code:

proc auth {nick hand host txt} {
global botnick ci cf db mainchan mainchanpvt modeauth
if { $modeauth == 1 } {
if {[onchan $nick $mainchan]} {
   if { [::mysql::sel $db "SELECT auth FROM users WHERE ircnick='[string tolower $nick]' AND ircstatus='1'"] == "1" } {
   puthelp "PRIVMSG $nick :$ci Tu já estas autenticado! $cf"
   } else {
   set auth [string tolower [lindex [split $txt] 0]]
   set pass [md5 [string tolower [lindex [split $txt] 1]]]
      if { $txt == "" } {
         puthelp "PRIVMSG $nick :$ci Comando inválido, para te autenticares usa /msg $botnick auth <nick> <pass> $cf"
      } else {
         if { $pass == "" } {
            puthelp "PRIVMSG $nick :$ci Comando inválido, para te autenticares usa /msg $botnick auth <nick> <pass> $cf"
            } else {
            if {[::mysql::sel $db "SELECT password FROM users WHERE auth='$auth'" -list] == $pass } {
               set check [::mysql::sel $db "SELECT ircstatus FROM users WHERE auth='$auth'" -list]
               if { $check == 1 } {
               set authednick [::mysql::sel $db "SELECT ircnick FROM users WHERE auth='$auth'" -list]
               putserv "privmsg $authednick :$ci O utilizador $nick fez auth na tua conta(#$auth). Deixas-te de estar autenticado $cf"
               }
               set result [::mysql::exec $db "UPDATE users SET ircstatus='1' WHERE auth='$auth'"]
               set result [::mysql::exec $db "UPDATE users SET ircnick='$nick' WHERE auth='$auth'"]
               set level [::mysql::sel $db "SELECT level FROM users WHERE auth='$auth'" -list]
               puthelp "PRIVMSG $nick :$ci Estás agora autenticado como $auth $cf"
               set auth [::mysql::sel $db "SELECT auth FROM users WHERE ircnick='$nick' AND ircstatus='1'" -list]
               }
            } else {
            putserv "privmsg $mainchanpvt : Tentativa de login falhado por $nick (Auth: #$auth)"
            puthelp "PRIVMSG $nick :$ci Password/nick inválido, para te autenticares usa /msg $botnick auth <nick> <pass>  $cf"
            }
         }
      }
   }
   } else {
   puthelp "PRIVMSG $nick :$ci Precisas de estar no canal $mainchan para fazer auth $cf"
}
} else {
puthelp "PRIVMSG $nick :$ci Esta funcão foi desactivada $cf"
}
}

( I deleted some code, maybe a } is missing or smthng.)

That proc checks if your on the chan, checks if your already authed, checks if your login/password exists and also checks if they match acording to de mysql db.
Back to top
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Sun Mar 22, 2009 10:03 am    Post subject: Reply with quote

Ahh, I do see some unbalanced {}'s but that's probably due to your trimming.

The error at hand however, is that you use the -list option with ::mysql::sel. This makes it return a tcl-list of results, and you'll have to use lindex to retrieve a single item, or join to convert the list into a string.

Fix: change each ::mysql::sel-command like below:
Code:
#This...
if {[::mysql::sel $db "SELECT password FROM users WHERE auth='$auth'" -list] == $pass } {
#Should be changed into this...
if {[join [::mysql::sel $db "SELECT password FROM users WHERE auth='$auth'" -list]] == $pass } {

#This...
set check [::mysql::sel $db "SELECT ircstatus FROM users WHERE auth='$auth'" -list]
#Should be changed into this...
set check [join [::mysql::sel $db "SELECT ircstatus FROM users WHERE auth='$auth'" -list]]

#And so on...

_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
garfwen
Halfop


Joined: 12 Mar 2008
Posts: 61

PostPosted: Sun Mar 22, 2009 10:15 am    Post subject: Reply with quote

Yep.

Thank you
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