feedback form keywords blacklist


#1

Hi all,

I’d like to have keywords black list for my feedback form. Right now it works fine with just one keyword1 (see below). What to do with more keyword2, keyword3 and also in upper case? As I have almost no php experience, I would do it using several if-then-else blocks, though someone might kindly suggest me more elegant solution.
Please advise.
Thanks ahead.

[php]

<?php function getUserIP() { $client = @$_SERVER['HTTP_CLIENT_IP']; $forward = @$_SERVER['HTTP_X_FORWARDED_FOR']; $remote = $_SERVER['REMOTE_ADDR']; if(filter_var($client, FILTER_VALIDATE_IP)) { $ip = $client; } elseif(filter_var($forward, FILTER_VALIDATE_IP)) { $ip = $forward; } else { $ip = $remote; } return $ip; } $user_ip = getUserIP(); $user_agent = $_SERVER['HTTP_USER_AGENT']; $ref = @$_SERVER[HTTP_REFERER]; $nl = nl2br(" ||||| "); $email_domain = substr($_REQUEST['email'], 0, strrpos($_REQUEST['email'], '@')); $headerFields = array( "MIME-Version: 1.0", "Content-Type: text/html;charset=utf-8" ); if (!filter_var($_REQUEST['email'], FILTER_VALIDATE_EMAIL)) { $desc = $desc.'Email is not valid.'; $host = $_SERVER['HTTP_HOST']; $uri = rtrim(dirname($_SERVER['PHP_SELF']), '/\\'); $extra = 'error.php'; header("HTTP/1.1 409 CONFLICT"); header("Location: http://$host$uri/$extra"); } else if (strpos($_REQUEST['message'], 'keyword1') !== false) { $desc = $desc.'Forbidden content.'; $host = $_SERVER['HTTP_HOST']; $uri = rtrim(dirname($_SERVER['PHP_SELF']), '/\\'); $extra = 'error3.php'; header("HTTP/1.1 409 CONFLICT"); header("Location: http://$host$uri/$extra"); } else ... [/php]

#2

How many words?


#3

Let’s say, up to ten so far.


#4

Did you check the link?


#5

Yes, looks realistic, though I did not find a way to apply it on my feedback form yet.
Thanks anyway.