Mod anti-spam par Carl
Version 0.2
MesSouvenirs.com
include/init.inc.php
Cherche:
$CONFIG['TABLE_HIT_STATS'] = $CONFIG['TABLE_PREFIX'].'hit_stats';
Ajouter la ligne après:
$CONFIG['TABLE_SPAM'] = $CONFIG['TABLE_PREFIX'].'spam'; // antispam
lang/english.php
Cherche:
'com_author_error' => 'A registered user is using this nickname, login or use another one', //cpg1.4
Ajouter la ligne après:
'antispam' => 'Your comment is a spam!
If this is not spam, please contact the administrator', // anti-spam
lang/french.php
Cherche:
'com_author_error' => 'Un utilisateur enregistré utilise déjà ce pseudonyme, connectez-vous ou utilisez en un autre', //cpg1.4
Ajouter la ligne après:
'antispam' => 'Votre message est reçu comme spam!
Si ce n\'est pas du spam, veuillez contacter l\'administrateur', // anti-spam
db_input.php
Cherche:
$msg_id = (int)$_POST['msg_id'];
Ajouter les lignes après:
// Anti-spam mod
$query = "SELECT words FROM {$CONFIG['TABLE_SPAM']}";
$req = mysql_query($query); while ($data = mysql_fetch_array($req)) {
$spam = strpos($msg_body, $data['words']);
if ($spam !== false) { $msg_body = 'spam'; }
}
if ($msg_body == 'spam') cpg_die(ERROR, $lang_db_input_php['antispam'], __FILE__, __LINE__);
// Anti-Spam mod
Cherche:
$pid = (int)$_POST['pid'];
Ajouter les lignes après:
// Anti-spam mod
$query = "SELECT words FROM {$CONFIG['TABLE_SPAM']}";
$req = mysql_query($query); while ($data = mysql_fetch_array($req)) {
$spam = strpos($msg_body, $data['words']);
if ($spam !== false) { $msg_body = 'spam'; }
}
if ($msg_body == 'spam') cpg_die(ERROR, $lang_db_input_php['antispam'], __FILE__, __LINE__);
// Anti-Spam mod
Avant d'envoyer les fichiers sur le serveur, il faut créer une table via phpmyadmin depuis la console de gestion du site (Je n'ai pas encore fait d'installation automatique)
XXXX = début de vos tables ex: Remplacer XXXX par cpg_133
Dans SQL copier le code et (remplacer XXXX par celui utiliser dans Coppermine) et fait exécuter:
CREATE TABLE `XXXX_spam` ( `id` INT (4) NOT NULL AUTO_INCREMENT , `words` VARCHAR (30) NULL, UNIQUE (`id`) ENGINE MYISAM;INSERT INTO `XXXX_spam` (`id`, `words`) VALUES (NULL, 'http');
INSERT INTO `XXXX_spam` (`id`, `words`) VALUES (NULL, 'www');
INSERT INTO `XXXX_spam` (`id`, `words`) VALUES (NULL, 'porn');
INSERT INTO `XXXX_spam` (`id`, `words`) VALUES (NULL, 'drugs');
Pour bloquer d'autres mots utiliser par les spammeurs,il suffit de les ajouter à la table. Je bloque par défaut les liens, car souvent c'est ce qui est utiliser par les spammeurs.