| View previous topic :: View next topic |
| Author |
Message |
garfwen Halfop
Joined: 12 Mar 2008 Posts: 61
|
Posted: Sat Mar 21, 2009 7:35 pm Post subject: Need help "[ ] { } ' - /" |
|
|
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 |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Sat Mar 21, 2009 9:48 pm Post subject: |
|
|
Do you think you could post the script? _________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
garfwen Halfop
Joined: 12 Mar 2008 Posts: 61
|
Posted: Sun Mar 22, 2009 9:18 am Post subject: |
|
|
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 |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Sun Mar 22, 2009 10:03 am Post subject: |
|
|
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 |
|
 |
garfwen Halfop
Joined: 12 Mar 2008 Posts: 61
|
Posted: Sun Mar 22, 2009 10:15 am Post subject: |
|
|
Yep.
Thank you |
|
| Back to top |
|
 |
|