First, the source code for the e-mail address part below is credited to Nic with his forum post here. Since the spam I've seen puts these words, not in the address, but the body, I modified it and added checking of the body field which seems to work (use at your own risk, back up your original files, do not blame me if your site breaks). The list and code seems to work with both later versions of Mambo and early versions of Joomla. Recent Joomla versions allow you to add these banned words via the admin. But... this code produces a kinda ugly 403 failure. Any idea how to pretty it up? It stops the spam for those words but it would be nice to tweak it a bit. // Prevent form submission if one of the banned words is found in the submitted E-mail body $badWords = array ( "poker", "p0ker", "viagra", "cialis", "levitra", "soma", "lipitor", "zoloft", "xanax", "phentermine", "diazepam", "tramadol", "valium", "acroduke" ); // <--- add more "forbidden" words here foreach ($badWords as $value) { if ( stristr($text, $value) ) { header("HTTP/1.0 403 Forbidden"); die("Forbidden - You are not authorized to view this page"); } } // Prevent form submission if one of the banned words is found in the submitted E-mail-address $badWords = array ( "poker", "p0ker", "viagra", "cialis", "levitra", "soma", "lipitor", "zoloft", "xanax", "phentermine", "diazepam", "tramadol", "valium", "acroduke" ); // <--- add more "forbidden" words here foreach ($badWords as $value) { if ( stristr($email, $value) ) { header("HTTP/1.0 403 Forbidden"); die("Forbidden - You are not authorized to view this page"); } } Code (markup): Nic suggests: And that worked for me too. Thanks!
Thanks. I am getting 100+ spam messages a day via the contact form (and mambo was automatically sending that many auto-replies as well)... hopefully with this I can eliminate or severely cut down on the spam.
Just building on the work of others as noted and trying to spread the help around as they did! Have you tried it yet? Any better?