Custom Captcha

We need our own captcha system.

  • WIth a unique system it is far less likely for a bot writer to bother making the effort to include our faucets.
  • Google captcha really sucks, frequently presents 5 or more screens of captcha which usually it says you’re wrong, no matter what, and then gives you the slow fade captchas. Waste of time and very off-putting for users.

Here are some ideas, intended for WP but generally applicable anyway cos it’s just PHP etc. And below is a video about one that looks very good, most of them are things like math puzzles and look very amateur. Code is included – open in youtube it’s in the description. Also downloaded and attached here. Unfortunately he is not using english depite the title being in english.

This one has a link to code in the description.

Previous Attempts

We have a custom plug-in for which changes the password of the WP password protectede pages at a set interval. It’s not really very good, and needs some adjustment. The below may or may not be enlightening…

//Set the WordPress password-protected post cookie expiry time

Filters the life span of the post password cookie.

By default, the cookie expires 10 days from creation. To turn this
into a session cookie, return 0.

@since 3.7.0

@param int $expires The expiry time, as passed to setcookie().
add_filter( 'post_password_expires', 'acp_custom_post_password_expires' );
function acp_custom_post_password_expires( $expires ) {
return time() + 30; // Expire in 30 seconds

Here you need to update time, now its

return time() + 30; // Expire in 30 seconds
change this to
return time() + 600; // Expire in 10 minutes

Previous attempts archived below….

There is a password in the videos. We need somewhere for people to enter that password. I tried using WP’s password pages but its turning out too complex and should be really simple.

Wisdmlabs provides a nice script for a math problem, a simple text q&a should be even simpler I think but I can’t do it!

This would mean I can get rid of wordpress and work on the embedded faucetinabox instead, so it will all be in the one page.

To Add a Simple Mathematical CAPTCHA, you can use the below code:

  1. Generate the Equation and Save the Result: The below code will generate two random numbers, and create an addition or subtraction equation.
session_start(); $digit1 = mt_rand(1,20); $digit2 = mt_rand(1,20); if( mt_rand(0,1) === 1 ) { $math = "$digit1 + $digit2"; $_SESSION['answer'] = $digit1 + $digit2; } else { $math = "$digit1 - $digit2"; $_SESSION['answer'] = $digit1 - $digit2; }
  1. Display the Equation in your Form: You need to display the generated equation as part of your form.
<?php echo $math; ?> = <input name="answer" type="text" />
  1. Validate the Text Entered by the User: The final step is to validate whether the value entered by the user is correct, or not.
<?php session_start(); if ($_SESSION['answer'] == $_POST['answer'] ) { // value entered is correct } else { // value is incorrect, kindly try again }


I’ll see if I can fumble through it

session_start(); $digit1 = password; { $_SESSION[‘answer’] = password }

then into page:

<?php echo $digit1; ?> = <input name=”answer” type=”text” />


<?php session_start(); if ($_SESSION[‘answer’] == $_POST[‘answer’] ) { // value entered is correct } else { // value is incorrect, kindly try again }

hmmm -the captcha thing stores the captchas in showCaptcha.php or something, and displays it in the faucet page,