[Résolu] moderation SQL
#10
Donc si je comprend bien..

Sa devrais donner ainsi :

tcl
# Proc - Badword #
bind pub o|o .+badword +badword
proc +badword { nick host hand chan arg } {
	set colonne(mots) [string tolower [lindex $arg 0]]
	set colonne(salon) [lindex $arg 1]
	if ![onchan $nick $::back(chan)] {
		putserv "notice $nick :\00314Erreur vous devez être sur\003 \0034$::back(chan)\0034"
		return
	}
	if {$colonne(mots)==""} {
		putserv "notice $nick :\00314Incorrect veuillez mettre un mot\003. Exemple : .+badword \0034connard #salon\0034"
		return 0
	}
	if {![string match #* $colonne(salon)]} {
		putserv "notice $nick :\00314Incorrect veuillez mettre un salon\003. Exemple : \0034#SQL\0034"
		return 0
	}
	service:connect
	mysqlsel $::mysqlink "SELECT * FROM `badword` WHERE mots='$colonne(mots)' and salon='$colonne(salon)'"
	if {[mysqlresult $::mysqlink rows] ne 0} {
		while {[set row [mysqlnext $::mysqlink]] != ""} {
			set checkmots [lindex $row 0]
			set checksalon [lindex $row 1]
			if {[string match [string tolower $colonne(mots)] [string tolower $checkmots]] && [string match $colonne(salon) $checksalon]} {
				putserv "notice $nick :\00314Mot invalide ! le mot\003 (\0034$colonne(mots)\0031) et déjà enregistré sur le salon !"
				return 0
			}
		}
		service:deconnect
	}
	service:connect
	mysqlsel $::mysqlink "INSERT INTO badword (mots, salon) VALUES ('$colonne(mots)', '$colonne(salon)')"
	service:deconnect
	puthelp "privmsg $::back(chan) :$::chanlog(+badword) \00314Sur\003 \0034$chan\0034 \0031\002$hand@$nick\002\0031 (\0037$colonne(mots)\0031)"
}


Vous interdisez les erreurs, vous empêchez ainsi la victoire.

Ma super kikoo-page loll
Répondre Avertir


Messages dans ce sujet
moderation SQL - par aliasangelius - 07/03/2017, 12:51
RE: moderation SQL - par CrazyCat - 07/03/2017, 13:59
RE: moderation SQL - par aliasangelius - 07/03/2017, 14:08
RE: moderation SQL - par aliasangelius - 07/03/2017, 17:57
RE: moderation SQL - par CrazyCat - 08/03/2017, 00:53
RE: moderation SQL - par aliasangelius - 08/03/2017, 14:42
RE: moderation SQL - par CrazyCat - 08/03/2017, 16:47
RE: moderation SQL - par aliasangelius - 08/03/2017, 17:42
RE: moderation SQL - par CrazyCat - 08/03/2017, 18:37
RE: moderation SQL - par aliasangelius - 08/03/2017, 19:24
RE: moderation SQL - par CrazyCat - 09/03/2017, 01:06
RE: moderation SQL - par aliasangelius - 09/03/2017, 01:27
RE: moderation SQL - par CrazyCat - 09/03/2017, 13:00
RE: moderation SQL - par aliasangelius - 09/03/2017, 15:45
RE: moderation SQL - par CrazyCat - 10/03/2017, 00:48
RE: moderation SQL - par aliasangelius - 10/03/2017, 14:43

Atteindre :


Utilisateur(s) parcourant ce sujet : 1 visiteur(s)
Tchat 100% gratuit -Discutez en toute liberté