Initial commit

This commit is contained in:
Fill committed 2023-04-10 15:14:23 +03:00
commit dd5c051eb9
6 files changed
+2394

No files matched your search

+38
View File
@@ -0,0 +1,38 @@
<?php
function display_login_captcha() {
require_once get_stylesheet_directory().'/wl_functions/wl_captcha/securimage.php';
$options = array();
$options['input_name'] = 'wl_security_code'; // change the name of input element for form post
// $options['input_id'] = 'captcha_code'; // change id of the input element for form post
// $options['input_text'] = 'Type the text:'; // change text of the label for the captcha text input
// $options['input_attributes'] = array('data-id'=>27); // An array of additional HTML tag attributes to pass to the text input tag
// $options['image_id'] = 'captcha_image'; // change the name of the alt text of the image
// $options['image_attributes'] = array('data-id'=>27); //An array of additional HTML tag attributes to pass to the captcha image tag
// $options['error_html'] = '<div style="color:red">*Some important text!!!</div>'; //Optional HTML markup to be shown above the text input field
// $options['namespace'] = 'some_namespace'; //The optional captcha namespace to use for showing the image. Namespaces are for using multiple captchas on the same page.
echo "<div id='captcha_container'>\n";
echo Securimage::getCaptchaHtml($options);
echo "\n</div>\n";
?>
<?php
}
add_action( "login_form", "display_login_captcha" );
function verify_login_captcha($user, $password) {
$captcha = @$_POST['security_code']; // the user's entry for the captcha code
require_once get_stylesheet_directory().'/wl_functions/wl_captcha/securimage.php';
$securimage = new Securimage();
if ($securimage->check($captcha) == false) {
return new WP_Error("Captcha Invalid", __("<strong>ERROR</strong>: You are a bot. If not, then enable JavaScript"));
}else{
return $user;
}
}
add_filter("wp_authenticate_user", "verify_login_captcha", 10, 2);
Binary file not shown.
+47
View File
@@ -0,0 +1,47 @@
<?php
/*
* @link http://www.phpcaptcha.org Securimage PHP CAPTCHA
* @link http://www.phpcaptcha.org/latest.zip Download Latest Version
* @link http://www.phpcaptcha.org/Securimage_Docs/ Online Documentation
* @copyright 2013 Drew Phillips
* @author Drew Phillips <drew@drew-phillips.com>
* @version 3.5.2 (Feb 15, 2014)
* @package Securimage
*
*/
// Remove the "//" from the following line for debugging problems
// error_reporting(E_ALL); ini_set('display_errors', 1);
require_once dirname(__FILE__) . '/securimage.php';
$img = new Securimage();
// You can customize the image by making changes below, some examples are included - remove the "//" to uncomment
//$img->ttf_file = './Quiff.ttf';
//$img->captcha_type = Securimage::SI_CAPTCHA_MATHEMATIC; // show a simple math problem instead of text
//$img->captcha_type = Securimage::SI_CAPTCHA_STRING; // show a simple text
//$img->case_sensitive = true; // true to use case sensitve codes - not recommended
//$img->image_height = 90; // height in pixels of the image
//$img->image_width = $img->image_height * M_E; // a good formula for image size based on the height
//$img->perturbation = .75; // 1.0 = high distortion, higher numbers = more distortion
//$img->image_bg_color = new Securimage_Color("#0099CC"); // image background color
//$img->text_color = new Securimage_Color("#EAEAEA"); // captcha text color
//$img->num_lines = 8; // how many lines to draw over the image
//$img->line_color = new Securimage_Color("#0000CC"); // color of lines over the image
//$img->signature_color = new Securimage_Color(rand(0, 64),
// rand(64, 128),
// rand(128, 255)); // random signature color
//$img->image_signature = "Something"; // text of signature, shown in right bottom corner
//$img->code_length = 3; // the length of the displayed text
// see securimage.php for more options that can be set
// set namespace if supplied to script via HTTP GET
if (!empty($_GET['namespace'])) $img->setNamespace($_GET['namespace']);
//$img->captcha_type = Securimage::SI_CAPTCHA_MATHEMATIC;
$img->show(); // outputs the image and content headers to the browser
// alternate use:
// $img->show('/path/to/background_image.jpg');
File diff suppressed because it is too large. Load diff