Wolverine68 Posted June 9, 2008 Share Posted June 9, 2008 Does anyone have any suggestions for a PHP script that will prevent spammers from injecting e-mails into a request form? I've pasted my html form and php file below: HTML script: <html> <head> <title>Request Form</title> </head> <body background="#EEEEEE"> <div align="center"><img src=""><img src=""></div><br> <h3 align="center"> Information Request Form</h3> <div> <form action="feedback.php" method="post"> <p><font color="blue">Thank you for visiting the web page for "Company Name". If you would like more information, please fill out the information in the form below. When finished, click on the "Submit" button. Be sure to include your e-mail or phone so that the Director can follow up with you.</font></p> <hr width="100%"> <p>Name:     <INPUT TYPE="text" SIZE="35" name="name"></p> <p>E-mail:    <INPUT TYPE="text" SIZE="35" name="email"></p> <p>Phone:    <INPUT TYPE="text" SIZE="35" name="phone"></p> Please add any comments or questions in the box below:<br> <TEXTAREA NAME="comments" ROWS=10 COLS=60> </TEXTAREA> <br><br> <input type="submit" name="submit" value="Submit"><br<br> <hr width="100%"> </div> </body> </html> PHP script: <html> <body> <?php $formBody = "Name:$name\nEmail:$email\nPhone:$phone\nComments:$comments"; $headers = "From:$email"; if ($submit) { mail("[email protected]","Youth Fellowship Information Request",$formBody,$headers); } if ($submit) { print "Thank you, your request has been submitted <br /><br />"; print "Current date and time: "; print date("F j, Y, g:i A T"); } ?> </body> </html> Link to comment https://forums.phpfreaks.com/topic/109335-php-script-to-improve-security/ Share on other sites More sharing options...
.josh Posted June 9, 2008 Share Posted June 9, 2008 Thread closed. Please do not make multiple threads asking the same thing. Link to comment https://forums.phpfreaks.com/topic/109335-php-script-to-improve-security/#findComment-560810 Share on other sites More sharing options...
Recommended Posts