Custom Captcha

We have a custom plug-in for roflfaucet.com 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 }

Attempt

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” />

validation:

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

hmmm http://btcvic.win/tools/ -the captcha thing stores the captchas in showCaptcha.php or something, and displays it in the faucet page, http://btcvic.win/