IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

PHP & Base de données Discussion :

Interdire des mots [MySQL]


Sujet :

PHP & Base de données

  1. #1
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Juillet 2008
    Messages
    73
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juillet 2008
    Messages : 73
    Points : 35
    Points
    35
    Par défaut Interdire des mots
    Bonjour,

    J'utilise un script de commentaires et celui-ci n'est plus du tout mis à jour ni supporté. Je commence à avoir plein de spams et je voulais savoir s'il était possible de rajouter une liste de mots à bannir dans le script, genre viagra, tradamol et tout le reste. Ce serait sympa si quelqu'un pouvait m'aider car bloquer les adresses ip ne sert à rien, l'interdiction de mots est bcp plus efficace.

    Voici le code.

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
     
    <?
     
    $COM_CONF['full_path'] = dirname(__FILE__);
    include("{$COM_CONF['full_path']}/config.php");
    if (! $COM_CONF['dbhost']) {
    	echo 'It seems that comments script is not properly installed. See readme.txt for more info.';
    }
     
    require("{$COM_CONF['full_path']}/lang/lang_{$COM_CONF['lang']}.php");
    require("{$COM_CONF['full_path']}/akismet-class.php");
     
    $comments_db_link = mysql_connect($COM_CONF['dbhost'],$COM_CONF['dbuser'],$COM_CONF['dbpassword']);
    mysql_select_db($COM_CONF['dbname'], $comments_db_link);
     
    main();
     
    function main() {
     
            if ($_REQUEST['action'] == 'add'){
            	add();
            }
            elseif ($_REQUEST['action'] == 'unsub'){
            	unsub();
            }
    	elseif (1) {
    		view();
    	}
     
     
    }
     
    function check_for_errors() {
     
    	global $comments_db_link, $COM_CONF, $COM_LANG;
     
            $ip = mysql_escape_string($_SERVER['REMOTE_ADDR']);
    	$result = mysql_query("SELECT ip FROM {$COM_CONF['dbbannedipstable']} WHERE ip='$ip'", $comments_db_link);
     
    	if (mysql_num_rows($result)>0) {
    		$error_message.=$COM_LANG['not_allowed'] . "<br />";
    	}
    	if ($_REQUEST['disc_name'] == '') {
    		$error_message.=$_REQUEST['r_disc_name'] . "<br />";
    	}
    	if ($_REQUEST['disc_body'] == '') {
    		$error_message.=$_REQUEST['r_disc_body'] . "<br />";
    	}
    	if ($_REQUEST['disc_email'] != '') {
    		if (!is_email($_REQUEST['disc_email'])) {
    			$error_message.="Invalid email address" . "<br />";
    		}
    	}
     
    	return $error_message;
     
    }
     
    function flood_protection($INPUT) {
     
    	global $comments_db_link, $COM_CONF, $COM_LANG;
     
    	$result = mysql_query("select time from {$COM_CONF['dbmaintable']} where ip='{$_SERVER['REMOTE_ADDR']}' AND  (UNIX_TIMESTAMP( NOW( ) ) - UNIX_TIMESTAMP( time )) < {$COM_CONF['anti_flood_pause']}", $comments_db_link);
    	if (mysql_num_rows($result)>0) {
    		$error_message="Flood detected";
    		return $error_message;
    	}
    	$result = mysql_query("select ID from {$COM_CONF['dbmaintable']} where text='{$INPUT['disc_body']}' AND author='{$INPUT['disc_name']}' AND href='{$INPUT['href']}'", $comments_db_link);
    	if (mysql_num_rows($result)>0) {
    		$error_message="Flood detected";
    		return $error_message;
    	}
     
    	return "";
    }
     
    function spam_check($email, $name, $url, $text, $path_to_page, $ip) {
     
    	global $COM_CONF, $comments_db_link;
     
    	$try = 0;
    	while (!$valid && $try <= 3) {
    		// Initialize and verify API key
    		$akismet = new Akismet($COM_CONF['site_url'], $COM_CONF['akismet_apikey']);
    		$result = $akismet->isKeyValid();
    		// Possible values: 'valid', 'invalid', 'no connect'
    		if ($result != 'valid') {
    			if (($result == 'invalid')) {
    				// Invalid key
    				return 2;
    			} else {
    				// Could not connect to the Akismet server
    				$try++;
    			}
    		}
    		else {
    			$valid = 1;
    		}		
    	}
     
    	if (!$valid) {
    		return 3; // Could not connect to the Akismet server 
    	}
     
    	// Pass comment info to the class
    	$akismet->setCommentAuthorEmail($email);
    	$akismet->setCommentAuthor($name);
    	$akismet->setCommentAuthorURL($url);
    	$akismet->setCommentContent($text);
    	$akismet->setUserIP($ip);
    	$akismet->setPermalink($COM_CONF['site_url'] . $path_to_page);
    	$akismet->setCommentType('Comment');
     
    	$try = 0;
    	while ($try <= 3) {
    		// Check the comment for spam
    		$result = $akismet->isCommentSpam();
    		// Possible values: 'false' (not spam), 'true' (spam), 'no connect'
    		if ($result != 'false') {
    			if ($result == 'true') {
    				// The comment is spam
    				return 1;
    			} else {
    				// Could not connect to the Akismet server
    				$try++;
    			}
    		} else {
    			return 0;
    		}
    	}
     
    	return 3; // Could not connect to the Akismet server
    }
     
     
    function add() {
     
    	global $comments_db_link, $COM_CONF, $COM_LANG;
     
    	foreach ($_REQUEST as $key => $value) {
    		if ($key == 'disc_body') {
    			$comment_text=stripslashes($value);
    		}
    		$_REQUEST[$key] = str_replace('<', '&lt;', $_REQUEST[$key]);
    		$_REQUEST[$key] = str_replace('>', '&gt;', $_REQUEST[$key]);
    		if (get_magic_quotes_gpc()) {
    			$_REQUEST[$key] = stripslashes($_REQUEST[$key]);
    		}
    		$_REQUEST[$key] = mysql_escape_string($_REQUEST[$key]);
    	}
     
    	$_REQUEST['href'] = str_replace('%2F', '/', $_REQUEST['href']);
    	$_REQUEST['href'] = str_replace('%3F', '?', $_REQUEST['href']);
    	$_REQUEST['href'] = str_replace('%26', '&', $_REQUEST['href']);
    	$_REQUEST['href'] = str_replace('%3D', '=', $_REQUEST['href']);
     
    	if ($_REQUEST['dont_show_email'] != '') { $dont_show="1"; }
    	else { $dont_show="0"; }
     
     
    	$error_message = check_for_errors();
    	$error_message .= flood_protection($_REQUEST);	
     
     
    	if ($COM_CONF['ckeck_for_spam']) {
    		if (!$error_message) {
    			$spam_check_result = spam_check($_REQUEST['disc_email'], $_REQUEST['disc_name'], "", $comment_text, $_REQUEST['href'], "");
    			if ($spam_check_result == 1) {
    				$error_message .= "<br>Your comment suspected as spam.";
     
    				mysql_query("INSERT INTO {$COM_CONF['dbjunktable']} VALUES (NULL, NOW(), '{$_REQUEST['href']}', '{$_REQUEST['disc_body']}', '{$_REQUEST['disc_name']}', '{$_REQUEST['disc_email']}', '$dont_show', '{$_SERVER['REMOTE_ADDR']}')", $comments_db_link);
    			}
    			if ($spam_check_result == 2) {
    				$error_message .= "<br>Invalid WordPress API key";
    			}
    			if ($spam_check_result == 3) {
    				$error_message .= "<br>Could not connect to the Akismet server";
    			}
    		}
    	}
     
     
    	if ($error_message) {
    		print "The following errors occured:<br>$error_message<br><br>
    			Please <a href=\"javascript:history.go(-1)\">get back</a> and try again.";
    		return 0;
    	}
     
     
    	mysql_query("INSERT INTO {$COM_CONF['dbmaintable']} VALUES (NULL, NOW(), '{$_REQUEST['href']}', '{$_REQUEST['disc_body']}', '{$_REQUEST['disc_name']}', '{$_REQUEST['disc_email']}', '$dont_show', '{$_SERVER['REMOTE_ADDR']}')", $comments_db_link);
     
    	if ($_REQUEST['email_me'] != '' && $_REQUEST['disc_email'] != '') {
    		$result = mysql_query("select COUNT(*) from {$COM_CONF['dbemailstable']} where href='{$_REQUEST['href']}' AND email='{$_REQUEST['disc_email']}'", $comments_db_link);
    		list ($count) = mysql_fetch_row($result);
    		if ($count == 0) {
    			$hash=md5($email . $COM_CONF['copy_random_seed']);
    			mysql_query("INSERT INTO {$COM_CONF['dbemailstable']} VALUES (NULL, '{$_REQUEST['disc_email']}', '{$_REQUEST['href']}', '$hash')", $comments_db_link);
    		}
    	}
     
    	if ($COM_CONF['email_admin']) {
    		notify_admin($_REQUEST['href'], $_REQUEST['disc_name'], $_REQUEST['disc_email'], $comment_text, "{$_SERVER['REMOTE_ADDR']}, {$_SERVER['HTTP_USER_AGENT']}");
    	}
    	notify_users($_REQUEST['href'], $_REQUEST['disc_name'], $_REQUEST['disc_email']);
     
    	header("HTTP/1.1 302");
    	header("Location: {$COM_CONF['site_url']}{$_REQUEST['href']}");
    	print "<a href=\"{$COM_CONF['site_url']}{$_REQUEST['href']}\">Click here to get back.</a>";
     
    }
     
     
    function notify_admin($href, $name, $email, $text, $ip) {
     
    	global $comments_db_link, $COM_CONF, $COM_LANG;
     
    	$headers = "From: Comments <{$COM_CONF['email_from']}>\r\n";
    	$text_of_message="
    {$COM_LANG['email_new_comment']} {$COM_CONF['site_url']}$href
    {$COM_LANG['email_from']}: $name <$email>
     
    $text
    
    $ip
    		";
     
    		mail($COM_CONF['email_admin'], "{$COM_LANG['email_new_comment']} $href", $text_of_message, $headers);
     
     
    }
     
    function notify_users($href, $name, $email_from) {
     
    	global $comments_db_link, $COM_CONF, $COM_LANG;
     
    	$headers = "From: Comments <{$COM_CONF['email_from']}>\n";
     
    	$result=mysql_query("select email, hash from {$COM_CONF['dbemailstable']} where href='$href'", $comments_db_link);
    	while (list($email, $hash) = mysql_fetch_row($result)) {
    	  if ($email != $email_from) {
    		$text_of_message="
    {$COM_LANG['email_new_comment']} {$COM_CONF['site_url']}$href
    {$COM_LANG['email_from']}: $name
    
    {$COM_LANG['email_to_unsubscribe']}
    {$COM_CONF['site_url']}{$COM_CONF['script_url']}?action=unsub&page=$href&id=$hash
    
    			";
    		mail($email, "{$COM_LANG['email_new_comment']} $href",$text_of_message, $headers);
    	  }
    	}
     
     
    }
     
    function unsub() {
     
    	global $comments_db_link, $COM_CONF, $COM_LANG;
     
    	$id=mysql_escape_string($_REQUEST['id']);
    	$href=mysql_escape_string($_REQUEST['page']);
     
    	mysql_query("delete from {$COM_CONF['dbemailstable']} where href='$href' AND hash='$id'", $comments_db_link);
     
    	if (mysql_affected_rows() > 0) {
    		print "{$COM_LANG['unsubscribed']}";
    	}
    	else {
    		print "{$COM_LANG['not_unsubscribed']}";
    	}
     
    }
     
     
    function view() {
     
    	global $comments_db_link, $COM_CONF, $COM_LANG;
     
    	$request_uri = mysql_escape_string($_SERVER['REQUEST_URI']);
    	$result = mysql_query("select time, text, author, email, dont_show_email from {$COM_CONF['dbmaintable']} where href='$request_uri' order by time {$COM_CONF['sort_order']}", $comments_db_link);
     
    	$comments_count=0;
    	$time=$text=$author=$email=$dont_show_email=array();
    	while (list($time[$comments_count], $text[$comments_count], $author[$comments_count], $email[$comments_count], $dont_show_email[$comments_count])=mysql_fetch_array($result)) {
    		$text[$comments_count] = wordwrap($text[$comments_count], 75, "\n", 1);
    		$time[$comments_count] = format_date($time[$comments_count]);
    		$comments_count++;
    	}
     
    	require("{$COM_CONF['full_path']}/templates/{$COM_CONF['template']}.php");
     
    }
     
    function format_date ($date) {
     
    	global $COM_LANG;
     
    	$year = substr($date, 0, 4);
    	$month = intval(substr($date, 5, 2)) - 1;
    	$day = substr($date, 8, 2);
    	$hour = substr($date, 11, 2);
    	$min = substr($date, 14, 2);
     
    	return "$day {$COM_LANG['months'][$month]} $year, $hour:$min";
     
    }
     
    function is_email($Addr)
      {
       $p = '/^[a-z0-9!#$%&*+-=?^_`{|}~]+(\.[a-z0-9!#$%&*+-=?^_`{|}~]+)*';
       $p.= '@([-a-z0-9]+\.)+([a-z]{2,3}';
       $p.= '|info|arpa|aero|coop|name|museum)$/ix';
       return preg_match($p, $Addr);
    }
     
    ?>

  2. #2
    Modérateur
    Avatar de sabotage
    Homme Profil pro
    Inscrit en
    Juillet 2005
    Messages
    29 208
    Détails du profil
    Informations personnelles :
    Sexe : Homme

    Informations forums :
    Inscription : Juillet 2005
    Messages : 29 208
    Points : 44 155
    Points
    44 155
    Par défaut
    tiens un truc embryonnaire.
    mais les spammers ont de l'avance ils savent déjà écrire ce qu'il faut passer pour des filtres simples comme ca.

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    if ($result != 'false') {
    			if ($result == 'true') {
    				// The comment is spam
    				return 1;
    			} else {
    				// Could not connect to the Akismet server
    				$try++;
    			}
    		} else {
    			$forbidden_words = array("viagra", "tradamol");
                            foreach ($forbidden_words as $forbidden_word
                                  {                        
                                    if (stristr($text, $forbidden_word)) {
                                           return 1;
                                    }
                             }
                            return 0
    		}

  3. #3
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Juillet 2008
    Messages
    73
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juillet 2008
    Messages : 73
    Points : 35
    Points
    35
    Par défaut
    Oui c'est sûr mais ça limitera déjà pas mal je pense.

    A quel endroit je dois rajouter ton code pour le tester ?

  4. #4
    Modérateur
    Avatar de sabotage
    Homme Profil pro
    Inscrit en
    Juillet 2005
    Messages
    29 208
    Détails du profil
    Informations personnelles :
    Sexe : Homme

    Informations forums :
    Inscription : Juillet 2005
    Messages : 29 208
    Points : 44 155
    Points
    44 155
    Par défaut
    A l'endroit ou je l'ai mis
    J'ai laissé un bout de code pour que tu vois.

  5. #5
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Juillet 2008
    Messages
    73
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juillet 2008
    Messages : 73
    Points : 35
    Points
    35
    Par défaut
    ça me mets une erreur :

    Parse error: syntax error, unexpected T_IF in /www/comments/comments.php on line 160

    Voici le code final après intégration:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    	$try = 0;
    	while ($try <= 3) {
    		// Check the comment for spam
    		$result = $akismet->isCommentSpam();
    		// Possible values: 'false' (not spam), 'true' (spam), 'no connect'
    		if ($result != 'false') {
    			if ($result == 'true') {
    				// The comment is spam
    				return 1;
    			} else {
    				// Could not connect to the Akismet server
    				$try++;
    			}
    		} else {
    			$forbidden_words = array("viagra", "tradamol");
                            foreach ($forbidden_words as $forbidden_word
                                  {                        
                                    if (stristr($text, $forbidden_word)) {
                                           return 1;
                                    }
                             }
    			return 0;
    		}
    	}
     
    	return 3; // Could not connect to the Akismet server
    }

  6. #6
    Modérateur
    Avatar de sabotage
    Homme Profil pro
    Inscrit en
    Juillet 2005
    Messages
    29 208
    Détails du profil
    Informations personnelles :
    Sexe : Homme

    Informations forums :
    Inscription : Juillet 2005
    Messages : 29 208
    Points : 44 155
    Points
    44 155
    Par défaut
    il manque la fin de parenthese du foreach.

  7. #7
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Juillet 2008
    Messages
    73
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juillet 2008
    Messages : 73
    Points : 35
    Points
    35
    Par défaut
    Cette fois, pas d'erreur, sauf que j'ai testé en postant viagra, et là, pas de blocage, le post est passé.

  8. #8
    Modérateur
    Avatar de sabotage
    Homme Profil pro
    Inscrit en
    Juillet 2005
    Messages
    29 208
    Détails du profil
    Informations personnelles :
    Sexe : Homme

    Informations forums :
    Inscription : Juillet 2005
    Messages : 29 208
    Points : 44 155
    Points
    44 155
    Par défaut
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    $forbidden_words = array("viagra", "tradamol");
     
                            foreach ($forbidden_words as $forbidden_word)
                                  {
                                  echo '<p>' .  $forbidden_word . '<=>' . $text . </p>';
    rajoute la ligne echo et dit moi ce que ca t'affiche.

  9. #9
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Juillet 2008
    Messages
    73
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juillet 2008
    Messages : 73
    Points : 35
    Points
    35
    Par défaut
    Avec ce code

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    $forbidden_words = array("viagra", "tradamol");
                            foreach ($forbidden_words as $forbidden_word)
                                  {                        
                                    echo '<p>' .  $forbidden_word . '<=>' . $text . </p>';    
    								if (stristr($text, $forbidden_word)) {
                                           return 1;
                                    }
    ça me met :
    Parse error: syntax error, unexpected '<' in /www/comments/comments.php on line 160

  10. #10
    Modérateur
    Avatar de sabotage
    Homme Profil pro
    Inscrit en
    Juillet 2005
    Messages
    29 208
    Détails du profil
    Informations personnelles :
    Sexe : Homme

    Informations forums :
    Inscription : Juillet 2005
    Messages : 29 208
    Points : 44 155
    Points
    44 155
    Par défaut
    rahhh je fais des fautes

  11. #11
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Juillet 2008
    Messages
    73
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juillet 2008
    Messages : 73
    Points : 35
    Points
    35
    Par défaut
    Pas d'erreur mais ça marche tjrs pas!

  12. #12
    Modérateur
    Avatar de sabotage
    Homme Profil pro
    Inscrit en
    Juillet 2005
    Messages
    29 208
    Détails du profil
    Informations personnelles :
    Sexe : Homme

    Informations forums :
    Inscription : Juillet 2005
    Messages : 29 208
    Points : 44 155
    Points
    44 155
    Par défaut
    Ca n'etait pas censé marcher mieux mais ecrire quelque chose.

  13. #13
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Juillet 2008
    Messages
    73
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juillet 2008
    Messages : 73
    Points : 35
    Points
    35
    Par défaut
    ça n'écrit rien.

  14. #14
    Modérateur
    Avatar de sabotage
    Homme Profil pro
    Inscrit en
    Juillet 2005
    Messages
    29 208
    Détails du profil
    Informations personnelles :
    Sexe : Homme

    Informations forums :
    Inscription : Juillet 2005
    Messages : 29 208
    Points : 44 155
    Points
    44 155
    Par défaut
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
     
    			$forbidden_words = array("viagra", "tradamol");
                            foreach ($forbidden_words as $forbidden_word
                                  {                        
                                    if (stristr($text, $forbidden_word)) {
                                           return 1;
                                    }
                             }
     
    $try = 0;
    	while ($try <= 3) {
    		// Check the comment for spam
    		$result = $akismet->isCommentSpam();
    		// Possible values: 'false' (not spam), 'true' (spam), 'no connect'
    		if ($result != 'false') {
    			if ($result == 'true') {
    				// The comment is spam
    				return 1;
    			} else {
    				// Could not connect to the Akismet server
    				$try++;
    			}
    		} else {
     
    			return 0;
    		}
    	}

  15. #15
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Juillet 2008
    Messages
    73
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juillet 2008
    Messages : 73
    Points : 35
    Points
    35
    Par défaut
    Tu as encore oublié la parenthèse après foreach :-)

    Sinon ça marche toujours pas, viagra passe toujours

  16. #16
    Modérateur
    Avatar de sabotage
    Homme Profil pro
    Inscrit en
    Juillet 2005
    Messages
    29 208
    Détails du profil
    Informations personnelles :
    Sexe : Homme

    Informations forums :
    Inscription : Juillet 2005
    Messages : 29 208
    Points : 44 155
    Points
    44 155
    Par défaut
    RAAAAA. J'ai fini par installer Scriptsmill.

    En fait la fonction spam_check n'est utilisé que si Akismet est configuré donc je suppose que ce n'est pas ton cas.

    En mettant le truc ligne 209 ca fonctionne.

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    	$forbidden_words = array("viagra", "tradamol");
    	foreach ($forbidden_words as $forbidden_word)
    		  {                        
    			if (stristr($comment_text, $forbidden_word)) {
    				$error_message = "forbidden word";
    				break;
    			}
    	 }
     
    	if ($error_message) {
    		print "The following errors occured:<br>$error_message<br><br>
    			Please <a href=\"javascript:history.go(-1)\">get back</a> and try again.";
    		return 0;
    	}

  17. #17
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Juillet 2008
    Messages
    73
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juillet 2008
    Messages : 73
    Points : 35
    Points
    35
    Par défaut
    Hourra, cette fois ça marche!!!!!! que dire sinon merci à toi

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. [RegExp] Interdire des mots
    Par PIEPLU dans le forum Général JavaScript
    Réponses: 12
    Dernier message: 11/11/2010, 15h05
  2. Comment changer des mots dans un fichier?
    Par ptitbonum dans le forum Linux
    Réponses: 5
    Dernier message: 07/04/2004, 23h42
  3. Mettre la première lettre des mots en majuscule
    Par seb.49 dans le forum Langage
    Réponses: 8
    Dernier message: 23/05/2003, 14h26
  4. Au sujet des mots de passe
    Par FranT dans le forum Langage
    Réponses: 6
    Dernier message: 17/09/2002, 22h16

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo