Jump to content

rob31

New Members
  • Posts

    1
  • Joined

  • Last visited

rob31's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi, I really don't know much about php code and need help. Could you tell me what I need to add to this email form php code to stop spammers from email header injection? My hosting account recently was sending spam emails that I did not send and I thought this might be the problem. Thanks. Here is what I have now: <?php $to = "email@mydomain.com"; $subject = "Pottery Question"; $email = $_REQUEST['email'] ; $name = $_REQUEST['name'] ; $questions = $_REQUEST['questions'] ; $spam = $_REQUEST['spamcheck'] ; { if ($spam == 4){ $message .= "Name: \n"; $message .= $name; $message .= "\n"; $message .= "\n"; $message .= "Email: \n"; $message .= $email; $message .= "\n"; $message .= "\n"; $message .= "Questions: \n"; $message .= $questions; $headers = "From: $email"; $sent = mail($to, $subject, $message, $headers) ; if($sent) {print "Your message was sent successfully"; } else {print "We encountered an error sending your mail"; } } else {header( "Location: http://www.go.away" ); die();} } ?>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.