• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Good, easy, reliable CAPTCHA for PHP form

Explorer ,
Feb 06, 2012 Feb 06, 2012

Copy link to clipboard

Copied

Does anyone know of a reliable (and easy to impliment) CATPCHA for PHP forms? My website is having the hell spammed out of it!

There are loads out there, but I need a recommended one - and one that a novice like me can install!

TOPICS
Server side applications

Views

1.5K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 06, 2012 Feb 06, 2012

Copy link to clipboard

Copied

Are you currently employing any honeypot techniques with your form? If not, I would try that first before resorting to CAPTCHA, as it is transparant to real users. In the end, you may need CAPTCHA, but try a honeypot form field first - it's worked really well for me.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
Feb 08, 2012 Feb 08, 2012

Copy link to clipboard

Copied

The honeypot method has been successful for me too, along with rigorous validation.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Feb 27, 2012 Feb 27, 2012

Copy link to clipboard

Copied

Thanks for the advice. I have managed to get started with this, but don't really know how to execute it - I have created a hidden field that the spambots are completing, and that humans aren't, thus enabling me to filter the results from my database before they get published to the website - but I can't seem to use this to stop the spammers from actually submitting the form in the first place (so I am still having to manually delete all the rogue entries from my database).

What is the code required to say "if this field is populated, throw an error and don't allow it to submit!"?

Thank you so much.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 27, 2012 Feb 27, 2012

Copy link to clipboard

Copied

<?php if (!empty($_POST['ufo'])) { return false; } ?>

<input type="text" name="ufo" style="visibility: hidden;">

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Feb 27, 2012 Feb 27, 2012

Copy link to clipboard

Copied

Thanks osgood - where do I put this (the PHP bit - does it go in the body or in the head)?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 27, 2012 Feb 27, 2012

Copy link to clipboard

Copied

_AJD_TUS_ wrote:

Thanks osgood - where do I put this (the PHP bit - does it go in the body or in the head)?

It goes with the rest of your php that process the form.

Obviously no need for the <?php ?> tag if you insert the code between your existing ones.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Feb 29, 2012 Feb 29, 2012

Copy link to clipboard

Copied

LATEST

Thank you for all your help, but I must be doing something wrong.

The 'hidden' field in my form is called 'ip'. So, I inserted this:

if (!empty($_POST['ip'])) { return false; }

...but they're still getting submitted to my database - complete with information in the "ip" field.

I have insertted it at the following ponit in my php:

  mysql_select_db($database_DB1, $DB1);

  $Result1 = mysql_query($insertSQL, $DB1) or die(mysql_error());

  $insertGoTo = "/thanku.php";

  if (isset($_SERVER['QUERY_STRING'])) {

    $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";

    $insertGoTo .= $_SERVER['QUERY_STRING'];

  }

  header(sprintf("Location: %s", $insertGoTo));

}

Can you offer any other help?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines