January 1, 200917 yr Does anyone know any good contact form codes which will be spam free as I keep getting spam and is getting very annoying
January 1, 200917 yr well no contact form will be spam proof, well to a certain extent, i would say your best bet is to use something like re-captcha umm other than that i dont know, if it is a bot, the bots arnt programmed to read the codes so that should stop most of the spam, but unless theres a sad loner that sits there typing out lol.... you can implement re-captcha on any fourm php ect and you can find a good tutorial on how to make contact forms on www.tutorialized.com, make your own so you actually learn something about what your doing, and it will make future projects ect also easier.
January 21, 200917 yr Author Thanks for the replys very helpful. One day I will have the coding skill to beat these bots
January 21, 200917 yr I block the IP addresses in my.htaccess file. You could also try adding a hidden field that isn't visible to the general user, but spam bots will see it and fill it in. Your validator then checks if the field is full or empty and acts accordingly. I implemented this type of thing on a client's contact form and it worked a treat.
January 25, 200917 yr Your best bet is to try setting up reCAPTCHA. Best free anti-spam I've come across.
January 25, 200917 yr Use a regexp to check for http:// and www. usually works well too. Pretty much all my contact forms block these and I've not been spammed yet.
January 25, 200917 yr I use php for mx lookup which ensures a real domain, + a pritty good sendmail config removes the rest. If you want to totaly remove bots from a php mail form, the re-captcha is extremely easy to setup, I use this on user registration forms. http://www.captcha.net/ they also have one specificaly for email: http://mailhide.recaptcha.net/
January 26, 200917 yr You could also try adding a hidden field that isn't visible to the general user, but spam bots will see it and fill it in. Your validator then checks if the field is full or empty and acts accordingly. I implemented this type of thing on a client's contact form and it worked a treat. I did this on my portfolio site a few months ago and the amount of form spam i get has dropped dramatically, in fact i cant remember the last one i got. i think it is defiantly a better option than using a captcha, as a lot of people dont like filling them in i also have an mxlookup to ensure the email address is valid, but that isnt too reliable, because as soon as a bot uses an aol.com,yahoo.co.uk,gmail, etc it gets let through.
January 28, 200917 yr Author Use a regexp to check for http:// and www. usually works well too. Pretty much all my contact forms block these and I've not been spammed yet. Hi I am really interested in using this technique as the captcha says it is not supported :s How would I use this method if my input boxes are: $firstnameField $lastnameField $address1Field $address2Field cannot find much on this in google...
January 29, 200917 yr Author You could try using the code below. It will check all items in the $_POST array for "<a" and "http:" and also common mail hijack attempts by blocking "bcc:" "cc:" etc if (preg_match_all("/<a|http:/i", implode($_POST), $out)) { // check for <a and http: echo "Found some spam"; } if (preg_match( "/bcc:|cc:|multipart|url|Content-Type:/i", implode($_POST))) { // check for spam indicators echo "Found some spam"; } Hey I have added this code to my php process. I get the message saying spam found but it still sends the e-mail here is the page I am trying to secure the form for LINK here is my php code also <?php /* Variables */ $emailSubject = 'Website Message!!'; $webMaster = 'howlomogo@hotmail.com'; /*check for spam */ if (preg_match_all("/<a|http:/i", implode($_POST), $out)) { // check for <a and http: echo "Found some spam"; } if (preg_match( "/bcc:|cc:|multipart|url|Content-Type:/i", implode($_POST))) { // check for spam indicators echo "Found some spam"; } /* Gathering dta variables */ $firstnameField = $_POST['firstname']; $lastnameField = $_POST['lastname']; $address1Field = $_POST['address1']; $address2Field = $_POST['address2']; $countyField = $_POST['county']; $postcodeField = $_POST['postcode']; $telephoneField = $_POST['telephone']; $mobileField = $_POST['mobile']; $emailField = $_POST['email']; $maxrentField = $_POST['maxrent']; $descField = $_POST['desc']; $desc1Field = $_POST['desc1']; /* this EOP is what will be displayed in the email */ $body = <<<EOD <br /><br /> <h1>Landlord Enquiry</h1> Name:$firstnameField $lastnameField<br /><br /> Address:<br /> $address1Field<br /> $address2Field<br /> $countyField<br /> $postcodeField<br /><br /> Telephone:$telephoneField<br /><br /> Mobile:$mobileField<br /><br /> Email:$emailField<br /><br /> Service they want: $desc1Field EOD; $headers = "From: $emailField\r\n"; $headers .= "Content-type: text/html\r\n"; $success = mail($webMaster, $emailSubject, $body, $headers); /*results rendered as html */ $theResults = <<<EOD <!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=ISO-8859-1" /> <title>ABBA,lettings,Portsmouth,Southsea,Rentals,Properties,To,Let</title> <style type="text/css"> <!-- --> </style> <link rel="stylesheet" type="text/css" href="abba_style.css" /> </head> <body> <div class="container"> <div class="header"> <div class="header-left"> </div> </div> <div class="main"> <div id="nav"> <ul> <li><a href="index.html">Home</a></li> <li><a href="property_search.html">Property Search</a></li> <li><a href="tenant_info.html">Tenant Info</a></li> <li><a href="landlord_info.html">Landlord Info</a></li> <li><a href="property_wanted.html">Property Wanted List</a></li> <li><a href="contact_us.html">Contact Us</a></li> </ul> </div> <div class="toptest"></div> <div class="landlord"> <p class="center">Thank you for your enquiry we will get back to you within 48 hours if you do not hear from us please try phoning or e-mailing us directly</p> </div> <div id="footerlinks" class="footer"> <a href="index.html">Home</a> | <a href="property_search.html">Property Search</a> | <a href="tenant_info.html">Tenant Info</a> | <a href="tenant_form.html">Tenant Form</a> | <a href="landlord_info.html">Landlord Info</a> | <a href="landlord_form.html">Landlord Form</a> | <a href="advertise.html">Advertising</a> | <a href="property_wanted.html">Property Wanted List</a> | <a href="contact_us.html">Contact Us</a> <p class="center"><a href="http://www.mdpdesigns.co.uk">Web Design</a> by MDPdesigns</p> </div> </div> </div> </body> </html> EOD; echo "$theResults"; ?> I am not sure what I am doing wrong? If anyone has any ideas please lemme know Cheers Matt
Create an account or sign in to comment