Sunday, May 23, 2010

Email() php security?

Hallo





I have written the following php code that will take information from 3 fields on a web form and then emails it to my email address:





%26lt;?php


$email = $_REQUEST['emailfield'] ;


$subject = $_REQUEST['subjectfield'];


$message = $_REQUEST['messagefield'] ;





if (!isset($_REQUEST['emailfield'])) {


header( "Location: http://www.example.com/contactus.html" );


}


elseif (empty($email) || empty($subject) || empty($message)) {


header( "Location: http://www.example.com/error.html" );


}


else {


mail( "info@example.com", $subject,


$message, "From: $email" );


header( "Location: http://www.example.com/thankyou.html" );


}


?%26gt;





However, this code is not very secure and spiders and email farmers can easily use this code to send junk mail to my address.





How can I improve the security of this code?





Thanks
Email() php security?
Maybe Captcha: http://www.white-hat-web-design.co.uk/ar...

No comments:

Post a Comment

 


email security © 2008. Design by: Pocket Web Hosting