Code: Select all
[11:27] wrong # args: should be "proc name args body"
while executing
"proc auth { nick uhost hand arg } {
global botnick ci cf db mainchan mainchanpvt modeauth
set d [::mysql::connect -host $bdhost -user $bduser -passwo..."
(file "scripts/test.tcl" line 13)
invoked from within
Code: Select all
bind msg - auth auth
set bdhost "localhost"
set bduser "user"
set bdpass "pass"
set bdname "bd"
set modeauth 1
set ci "0,1\[7«0"
set cf "7»0\]"
set mainchan "#main"
set mainchanpvt "#pvt"
proc auth { nick uhost hand arg } {
global botnick ci cf db mainchan mainchanpvt modeauth
set d [::mysql::connect -host $bdhost -user $bduser -password $bdpass]
set db [::mysql::use $d $dbname]
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 $arg] 0]]
set pass [md5 [string tolower [lindex [split $arg] 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 {[join [::mysql::sel $db "SELECT password FROM users WHERE auth='$auth'" -list]] == $pass } {
set check [join [::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"
}
}
thanks.