WordPress: Using Really Simple Captcha

All WordPress plugin developers, you can integrate a security captcha image into your own WordPress plugin using the Really Simple Captcha plugin. It is a plugin in itself but it serves as an API and doesn’t have any purpose on its own without other plugins using it.

This is an example of how to use the Really Simple Captcha plugin API with your own WordPress plugin.

 check($_POST['captcha_prefix'], $_POST['captcha_code'])) {
                $captcha_correct = true; //the captcha has been proven as correct
            }
        } else {
            $captcha_word = $captcha -> generate_random_word(); //generate a random string with letters
            $captcha_prefix = mt_rand(); //random number
            $captcha_image = $captcha -> generate_image($captcha_prefix, $captcha_word); //generate the image file. it returns the file name
            $captcha_file = rtrim(get_bloginfo('wpurl'), '/') . '/wp-content/plugins/really-simple-captcha/tmp/' . $captcha_image; //construct the absolute URL of the captcha image
        }
    }
}
?>

    

Comments