Hi
I always thought that using mail() was a sure way of not getting spammed from my website - but last night i uploaded a new version of my contact page and this morning I've started getting automatic spams from that page - I know it's coming from that page because the subject line is the one i use in my $subject
how on earth can they be spamming me from that page? is it my code (see below) that has a hole in it ? or is it a server security problem ? what can i do to prevent this ?
here's my code :
<?
if(isset($_POST['_SEND']) && ($_POST['name'] != "") && ($_POST['email'] != "") && ($_POST['message'] != "")){
$to = 'info@hugoscott.com';
$subject = 'Un message du site';
$message = 'Un message envoyé par '.$_POST['name']."\n";
$message .= stripslashes(wordwrap($_POST['message'], 70));
$headers = 'From: ' . $_POST['email'] . "\n" .
'X-Mailer: PHP/' . phpversion();
$sm = mail($to, $subject, $message, $headers);
echo '<div>';
if (!$sm) {
print "<div><span style=\"color:red\">Votre message n'a pas pu être envoyé</span></div>";
}else{
print "<div>Votre message est envoyé, merci</div>";
}
echo '</div>';
}else{
if(isset($_POST['_SEND']) && ($_POST['name'] == "")){
$nameError = '<span style="color:red">Vous ne m\'avez pas dit votre nom : </span><br />';
}else{
$nameError = '';
}
if(isset($_POST['_SEND']) && ($_POST['email'] == "")){
$emailError = '<span style="color:red">Vous ne m\'avez pas dit votre e-mail : </span><br />';
}else{
$emailError = '';
}
if(isset($_POST['_SEND']) && ($_POST['message'] == "")){
$messageError = '<span style="color:red">Vous ne m\'avez pas laissé un message : </span><br />';
}else{
$messageError = '';
}
echo '<div>
<div id="mailholder"><form name="mailform" action="contact.php" method="post">
'.$nameError.'
<label for="name">Nom : </label>
<input type="text" name="name" value="'.$_POST['name'].'" /><br />
'.$emailError.'
<label for="email">Email :</label>
<input type="text" name="email" value="'.$_POST['email'].'" /><br />
'.$messageError.'
<label for="message">Message :</label>
<textarea name="message">'.$_POST['message'].'</textarea><br />
<input type="submit" name="_SEND" id="submitbutton" value="Submit" />
</form>
</div>
</div>';
}
?>
and this is what the e-mails look like :
Un message envoyé par
Content-Type: multipart/alternative;
boundary=b535d413b7bde9f53bb9b606d741dbc5
Subject:
cc: buletmann@aol.com
--b535d413b7bde9f53bb9b606d741dbc5
Content-Transfer-Encoding: 7bit
Content-Type: text/plain
--b535d413b7bde9f53bb9b606d741dbc5
Content-Transfer-Encoding: base64
Content-Type: text/plain
--b535d413b7bde9f53bb9b606d741dbc5--
Since I started typing this message I've received another 10 or so mails from the same spam thing
arg !
help !!