A feedback form on my website (http://www.ldbsa.co.uk) has started getting spam. I would therefore like to add some security to the feedback form to prevent this.
What I'd like to do is have a PHP script that I can include in the form page which generates a "captcha" image that the user has to enter the auto generated text characters into a form field before being allowed to submit the form.
I've found various incarnations of this, but have been unable to get it to work with my form. The HTML page is http://www.ldbsa.co.uk/feedback.php, and the sendmail.php code is as follows:
Is anybody able to help at all?
What I'd like to do is have a PHP script that I can include in the form page which generates a "captcha" image that the user has to enter the auto generated text characters into a form field before being allowed to submit the form.
I've found various incarnations of this, but have been unable to get it to work with my form. The HTML page is http://www.ldbsa.co.uk/feedback.php, and the sendmail.php code is as follows:
| Code: |
|
<?php $contactname = $_REQUEST['contactname'] ; $email = $_REQUEST['email'] ; $email2 = 'me@domain.co.uk' ; $club = $_REQUEST['club'] ; $query = $_REQUEST['query'] ; $comments = $_REQUEST['comments'] ; if (!isset($_REQUEST['email'])) { header( "Location: http://www.ldbsa.co.uk/feedback.php" ); } elseif (empty($email) || empty($club) || empty($query) || empty($comments) || empty($contactname)) { echo ' <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head> <meta http-equiv="Content-Type" content="text/html; charset=shift_jis" /> <title>Leamington and District Billiards and Snooker Association - Feedback Form Error</title> <link rel="stylesheet" type="text/css" href="css/css_main.css" /> </head> <body> <div id="header"> <?php include "includes/header.php";?> </div> <div id="sponsors"> <?php include "sponsors.php";?> </div> <div id="wrapper"> <div class="leftMenu"> <?php include "includes/nav.php";?> </div> <div class="content"> <h1>ERROR</h1> <p>Not all fields have been filled in. Please try again.</p> <p><a href="feedback.php"><< Back to form</a> </div> <div class="rightMenu"> <?php include "includes/right.php";?> </div> </div> <div id="footer"> <?php include "includes/footer.php";?> </div> </body> </html> '; } else { mail( "$email, $email2", "Thank you for your feedback/questions", "Leamington and District Billiards and Snooker Association", "Thank you for your e-mail. We will be in touch soon.\n\nHere are the details of the message you sent:\n\n------------------------------------------------------------\n\nName: $contactname\n\nE-Mail Address: $email\n\nYour club: $club\n\nYour query was regarding: $query\n\nComments/Questions: $comments.\n\n------------------------------------------------------------\n\nMany thanks once again.\n\nKind regards\n\nLDBSA Committee") ; header( "Location: http://www.ldbsa.co.uk/thanks.php" ); } ?> |
Is anybody able to help at all?
