Vergleich inc/class_captcha.php - 1.8.6 - 1.8.11

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 40Zeile 40
	 *
* 1 = Default CAPTCHA
* 2 = reCAPTCHA

	 *
* 1 = Default CAPTCHA
* 2 = reCAPTCHA

	 * 3 = Are You a Human

 
	 * 4 = NoCATPCHA reCAPTCHA
*
* @var int

	 * 4 = NoCATPCHA reCAPTCHA
*
* @var int

Zeile 52Zeile 51
	 *
* @var string
*/

	 *
* @var string
*/

	 public $captch_template = '';

	 public $captcha_template = '';


/**
* CAPTCHA Server URL


/**
* CAPTCHA Server URL

Zeile 67Zeile 66
	 * @var string
*/
public $verify_server = '';

	 * @var string
*/
public $verify_server = '';


/**
* Are You a Human configuration
*
* @var string
*/
public $ayah_web_service_host = '';
public $ayah_publisher_key = '';
public $ayah_scoring_key = '';
public $ayah_debug_mode = '';
public $ayah_use_curl = '';

 

/**
* HTML of the built CAPTCHA


/**
* HTML of the built CAPTCHA

Zeile 119Zeile 107
			if($this->type == 2)
{
$this->captcha_template .= "_recaptcha";

			if($this->type == 2)
{
$this->captcha_template .= "_recaptcha";

			}
else if($this->type == 3)
{
$this->captcha_template .= "_ayah";

 
			}
else if($this->type == 4){
$this->captcha_template .= "_nocaptcha";
}
}

			}
else if($this->type == 4){
$this->captcha_template .= "_nocaptcha";
}
}


// Work on which CAPTCHA we've got installed
if($this->type == 3 && $mybb->settings['ayahpublisherkey'] && $mybb->settings['ayahscoringkey'])
{
// We want to use Are You a Human, set configuration options
$this->ayah_web_service_host = "ws.areyouahuman.com";
$this->ayah_publisher_key = $mybb->settings['ayahpublisherkey'];
$this->ayah_scoring_key = $mybb->settings['ayahscoringkey'];
$this->ayah_debug_mode = false;
$this->ayah_use_curl = true;

if($build == true)
{
$this->build_ayah();
}
}
else if($this->type == 2 && $mybb->settings['captchapublickey'] && $mybb->settings['captchaprivatekey'])


// Work on which CAPTCHA we've got installed
if($this->type == 2 && $mybb->settings['captchapublickey'] && $mybb->settings['captchaprivatekey'])















		{
// We want to use reCAPTCHA, set the server options
$this->server = "//www.google.com/recaptcha/api";

		{
// We want to use reCAPTCHA, set the server options
$this->server = "//www.google.com/recaptcha/api";

Zeile 202Zeile 172
		$db->insert_query("captcha", $insert_array);
eval("\$this->html = \"".$templates->get($this->captcha_template)."\";");
//eval("\$this->html = \"".$templates->get("member_register_regimage")."\";");

		$db->insert_query("captcha", $insert_array);
eval("\$this->html = \"".$templates->get($this->captcha_template)."\";");
//eval("\$this->html = \"".$templates->get("member_register_regimage")."\";");

	}


	}


	function build_recaptcha()

	function build_recaptcha()

	{
global $lang, $mybb, $templates;


	{
global $lang, $mybb, $templates;


		// This will build a reCAPTCHA
$server = $this->server;
$public_key = $mybb->settings['captchapublickey'];

		// This will build a reCAPTCHA
$server = $this->server;
$public_key = $mybb->settings['captchapublickey'];





		eval("\$this->html = \"".$templates->get($this->captcha_template, 1, 0)."\";");
//eval("\$this->html = \"".$templates->get("member_register_regimage_recaptcha")."\";");

		eval("\$this->html = \"".$templates->get($this->captcha_template, 1, 0)."\";");
//eval("\$this->html = \"".$templates->get("member_register_regimage_recaptcha")."\";");

	}

function build_ayah()
{
global $lang, $mybb, $templates;

define('AYAH_PUBLISHER_KEY', $this->ayah_publisher_key);
define('AYAH_SCORING_KEY', $this->ayah_scoring_key);
define('AYAH_USE_CURL', $this->ayah_use_curl);
define('AYAH_DEBUG_MODE', $this->ayah_debug_mode);
define('AYAH_WEB_SERVICE_HOST', $this->ayah_web_service_host);

require_once MYBB_ROOT."inc/3rdparty/ayah/ayah.php";
$ayah = new AYAH();
$output = $ayah->getPublisherHTML();

if(!empty($output))
{
eval("\$this->html = \"".$templates->get($this->captcha_template, 1, 0)."\";");
//eval("\$this->html = \"".$templates->get("member_register_regimage_ayah")."\";");
}

 
	}

/**

	}

/**

Zeile 327Zeile 276
					'privatekey' => $mybb->settings['captchaprivatekey'],
'remoteip' => $session->ipaddress,
'challenge' => $challenge,

					'privatekey' => $mybb->settings['captchaprivatekey'],
'remoteip' => $session->ipaddress,
'challenge' => $challenge,

					'response' => $response
));


					'response' => $response
));


				// Contact Google and see if our reCAPTCHA was successful
$http_request = "POST /recaptcha/api/verify HTTP/1.0\r\n";
$http_request .= "Host: $this->verify_server\r\n";

				// Contact Google and see if our reCAPTCHA was successful
$http_request = "POST /recaptcha/api/verify HTTP/1.0\r\n";
$http_request .= "Host: $this->verify_server\r\n";

Zeile 338Zeile 287
				$http_request .= "User-Agent: reCAPTCHA/PHP\r\n";
$http_request .= "\r\n";
$http_request .= $data;

				$http_request .= "User-Agent: reCAPTCHA/PHP\r\n";
$http_request .= "\r\n";
$http_request .= $data;





				$fs = @fsockopen($this->verify_server, 80, $errno, $errstr, 10);

if($fs == false)

				$fs = @fsockopen($this->verify_server, 80, $errno, $errstr, 10);

if($fs == false)

Zeile 351Zeile 300
					fwrite($fs, $http_request);

while(!feof($fs))

					fwrite($fs, $http_request);

while(!feof($fs))

					{

					{

						$response .= fgets($fs, 1160);
}

						$response .= fgets($fs, 1160);
}





					fclose($fs);

					fclose($fs);





					$response = explode("\r\n\r\n", $response, 2);
$answer = explode("\n", $response[1]);


					$response = explode("\r\n\r\n", $response, 2);
$answer = explode("\n", $response[1]);


Zeile 364Zeile 313
					{
// We got it wrong! Oh no...
$this->set_error($lang->invalid_captcha_verify);

					{
// We got it wrong! Oh no...
$this->set_error($lang->invalid_captcha_verify);

					}

					}

				}
}
}
elseif($this->type == 4)

				}
}
}
elseif($this->type == 4)

		{

		{

			$response = $mybb->input['g-recaptcha-response'];
if(!$response || strlen($response) == 0)
{

			$response = $mybb->input['g-recaptcha-response'];
if(!$response || strlen($response) == 0)
{

Zeile 386Zeile 335
				));

if($response == false)

				));

if($response == false)

				{

				{

					$this->set_error($lang->invalid_nocaptcha_transmit);
}
else

					$this->set_error($lang->invalid_nocaptcha_transmit);
}
else

Zeile 399Zeile 348
						$this->set_error($lang->invalid_nocaptcha);
}
}

						$this->set_error($lang->invalid_nocaptcha);
}
}

			}
}
elseif($this->type == 3)
{
define('AYAH_PUBLISHER_KEY', $this->ayah_publisher_key);
define('AYAH_SCORING_KEY', $this->ayah_scoring_key);
define('AYAH_USE_CURL', $this->ayah_use_curl);
define('AYAH_DEBUG_MODE', $this->ayah_debug_mode);
define('AYAH_WEB_SERVICE_HOST', $this->ayah_web_service_host);

require_once MYBB_ROOT."inc/3rdparty/ayah/ayah.php";
$ayah = new AYAH();

$result = $ayah->scoreResult();

if($result == false)
{
$this->set_error($lang->invalid_ayah_result);

 
			}
}


			}
}