My website was shutdown when some jerk put a spambot in my email script. Is there anyway to fix it so that this won't happen again?
Here's the code I was using:
<?php
if (($_POST[sender_email]== "") ||($_POST[message] == "")){
header("Location: http://www.myWebsite.net/contact.html");
exit;
}
$msg = "Sender's Name:\t$_POST[sender_name]\n";
$msg .= "Sender's E-mail:$_POST[sender_email]\n";
$msg .= "Message Topic:\t$_POST[topic]\n";
$msg .= "Message:\t$_POST[message]\n\n";
$mailheaders = "From: MY WEBSITE <me@myWebsite.net>\n";
$mailheaders .= "Reply-To: $sender_email\n\n";
mail("myEmail@juno.com", "MY WEBSITE: $_POST[topic]", $msg, $mailheaders);
echo "<h1 align=center>Thank You, $_POST[sender_name]</h1>";
echo "<p align=center>I appreciate your visit, and hope to reply soon!</p>";
?>
It is simple and, unfortunately, vulnerable. Any advice?