Sorry about that it is a bit more complicated than I first thought. My original mod only gets rid of malicious PHP.
I've G00gled for a solution but there doesn't appear to be an an easy answer
I think the simplest way would be to replace all the @s in the body of the message with "at" in that way there would only be two valid email addresses $_POST['email'] and $recipient.
So you would have to add the line:
if ($key!='email'){$val= str_replace('@',' at ', $val);}
So the section of the code would be:
PHP Code:
foreach ($_POST as $key => $val) {
$val=strip_tags($val);
if ($key!='email' AND $key!='recipient'){$val= str_replace('@',' at ', $val);}
if ($key == 'realname') { $isrealname = 1; }
You will also need to check the recipient email address if you use it:
Code:
if (!(preg_match("/^.{2,}?@.{2,}\./", $_POST['recipient']))) {
echo '<font size="+1" color="#FF0000">Error: Invalid E-mail</font><BR>';
echo 'The e-mail address you entered (<i>'.$_POST['recipient'].'</i>) is invalid.';
Print_Footer();
die();
}
Put that section just after the similar code checking $_POST['email'].
But it would appear from the code spammers could still send emails if you have the recipient email address on the form but with the added code they could only send one at a time.
Another suggestion would be to alter the function Print_Footer():
If a spammer G00gles for some of the words in that section they can easily find the sites they can exploit. The same applies to the last section:
"You have access this page from an invalid location". It might be an idea to personalise this.