mercredi 4 février 2015

Need php code to secure contact form on website


I'm not php savvy, can someone please provide a good strong code that I can use tailored for my form to prevent injections into my script? I would need to know exactly where to insert this code within my existing code.


Thank you in advance!




$name=addslashes($_POST['name']); $email=addslashes($_POST['email']); $website=addslashes($_POST['website']); $services=addslashes($_POST['services']); $comments=addslashes($_POST['message']);


// you can specify which email you want your contact form to be emailed to here


$toemail = "email@domainname.com"; $subject = "Creative Design Consultation Request";


$headers = "MIME-Version: 1.0\n" ."From: \"".$name."\" <".$email.">\n" ."Content-type: text/html; charset=iso-8859-1\n";


$body = "Name: ".$name."

\n" ."Email: ".$email."

\n" ."Website: ".$website."

\n" ."Services: ".$services."

\n" ."Comments:

\n" .$comments;



mail($toemail, $subject, $body, $headers);
echo "Thank you for submitting your request";




Aucun commentaire:

Enregistrer un commentaire