Hello All,
I have this PHP script that checks for empty form fields, but I don't know how
to incorporate a check in the "msg" field for a URL. I've been getting tons of
link spam in these forms, and so upon submission, I'd like to echo a msg to the
user that their post will be dead upon arrival. My failed attempt is commented out below.
Can you GREAT people "fill in" this script snip with the actual PHP code that will
work?
PHP Code:<?php # now to check for valid input...
$ipi = $_REQUEST['ip'];
$firstname = $_REQUEST['first-name'];
$lastname = $_REQUEST['last-name'];
$emailaddress = $_REQUEST['email-address'];
$urllist = $_REQUEST['urls'];
$msg = $_REQUEST['msg'];
/* begin what I've tried... */
if ($msg == "http:") {
alert("You Crazy spammer! Your message will be rejected, and your IP will be denied.");
}
/* end what I've tried... */
if (!isset($_REQUEST['ip']) || !isset($_REQUEST['first-name']) || !isset($_REQUEST['last-name']) || !isset($_REQUEST['email-address']) || !isset($_REQUEST['urls']) || !isset($_REQUEST['msg'])){
header( "Location: http://my-domain.com/page.html#form-container" );
}
elseif (empty($ipi) || empty($firstname) || empty($lastname) || empty($emailaddress) || empty($urllist) || empty($msg)) {
header( "Location: http://my-domain.com/sub-folder/contact-error.php" );
}
else {
$ToAddress = "seo-contact-form@my domain dot com";
$message = "Martin, you have a message from the AWD SEO Contact form\n";
$message .= "--------------------------------------------\n";
foreach ($_POST as $key => $value){$message .= "$key: $value\n";}
$message .= "--------------------------------------------\n";
mail("<$ToAddress>","Message from the AWD SEO Contact form", $message,"From: $ToAddress");
}
?>






Bookmarks