Vergleich inc/class_captcha.php - 1.8.15 - 1.8.16

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 104Zeile 104
		{
$this->captcha_template = $template;


		{
$this->captcha_template = $template;


			if($this->type == 2)

			if($this->type == 4)

			{

			{

				$this->captcha_template .= "_recaptcha";
}
elseif($this->type == 4){

 
				$this->captcha_template .= "_nocaptcha";

				$this->captcha_template .= "_nocaptcha";

			}
elseif($this->type == 5){


			}
elseif($this->type == 5)
{

				$this->captcha_template .= "_recaptcha_invisible";
}
}

				$this->captcha_template .= "_recaptcha_invisible";
}
}


// 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";
$this->verify_server = "www.google.com";

if($build == true)
{
$this->build_recaptcha();
}
}
elseif(in_array($this->type, array(4, 5)) && $mybb->settings['captchapublickey'] && $mybb->settings['captchaprivatekey'])


// Work on which CAPTCHA we've got installed
if(in_array($this->type, array(4, 5)) && $mybb->settings['captchapublickey'] && $mybb->settings['captchaprivatekey'])












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

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

Zeile 137Zeile 124
			if($build == true)
{
$this->build_recaptcha();

			if($build == true)
{
$this->build_recaptcha();

			}
}

			}
}

		elseif($this->type == 1)
{
if(!function_exists("imagecreatefrompng"))

		elseif($this->type == 1)
{
if(!function_exists("imagecreatefrompng"))

			{

			{

				// We want to use the default CAPTCHA, but it's not installed
return;
}

				// We want to use the default CAPTCHA, but it's not installed
return;
}

Zeile 153Zeile 140
		}

$plugins->run_hooks('captcha_build_end', $args);

		}

$plugins->run_hooks('captcha_build_end', $args);

	}

	}


/**
* @param bool $return Not used


/**
* @param bool $return Not used

Zeile 207Zeile 194
			// Values
$field['hash'] = $db->escape_string($mybb->input['imagehash']);
$field['string'] = $db->escape_string($mybb->input['imagestring']);

			// Values
$field['hash'] = $db->escape_string($mybb->input['imagehash']);
$field['string'] = $db->escape_string($mybb->input['imagestring']);

		}
elseif($this->type == 2)
{
// Names
$hash = "recaptcha_challenge_field";
$string = "recaptcha_response_field";

// Values
$field['hash'] = $mybb->input['recaptcha_challenge_field'];
$field['string'] = $mybb->input['recaptcha_response_field'];

 
		}
elseif($this->type == 3)
{

		}
elseif($this->type == 3)
{

Zeile 244Zeile 221
			$imagestring = $db->escape_string(my_strtolower($mybb->input['imagestring']));

switch($db->type)

			$imagestring = $db->escape_string(my_strtolower($mybb->input['imagestring']));

switch($db->type)

			{

			{

				case 'mysql':
case 'mysqli':
$field = 'imagestring';

				case 'mysql':
case 'mysqli':
$field = 'imagestring';

					break;

					break;

				default:
$field = 'LOWER(imagestring)';
break;

				default:
$field = 'LOWER(imagestring)';
break;

			}

			}


$query = $db->simple_select("captcha", "*", "imagehash = '{$imagehash}' AND {$field} = '{$imagestring}'");
$imgcheck = $db->fetch_array($query);


$query = $db->simple_select("captcha", "*", "imagehash = '{$imagehash}' AND {$field} = '{$imagestring}'");
$imgcheck = $db->fetch_array($query);





			if(!$imgcheck)

			if(!$imgcheck)

			{

			{

				$this->set_error($lang->invalid_captcha_verify);
$db->delete_query("captcha", "imagehash = '{$imagehash}'");

				$this->set_error($lang->invalid_captcha_verify);
$db->delete_query("captcha", "imagehash = '{$imagehash}'");

			}
}
elseif($this->type == 2)
{
$challenge = $mybb->input['recaptcha_challenge_field'];
$response = $mybb->input['recaptcha_response_field'];

if(!$challenge || strlen($challenge) == 0 || !$response || strlen($response) == 0)
{
$this->set_error($lang->invalid_captcha);
}
else
{
// We have a reCAPTCHA to handle
$data = $this->_qsencode(array(
'privatekey' => $mybb->settings['captchaprivatekey'],
'remoteip' => $session->ipaddress,
'challenge' => $challenge,
'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";
$http_request .= "Content-Type: application/x-www-form-urlencoded;\r\n";
$http_request .= "Content-Length: ".strlen($data)."\r\n";
$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)
{
$this->set_error($lang->invalid_captcha_transmit);
}
else
{
// We connected, but is it correct?
fwrite($fs, $http_request);

while(!feof($fs))
{
$response .= fgets($fs, 1160);
}

fclose($fs);

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

if(trim($answer[0]) != 'true')
{
// We got it wrong! Oh no...
$this->set_error($lang->invalid_captcha_verify);
}
}

 
			}
}
elseif(in_array($this->type, array(4, 5)))

			}
}
elseif(in_array($this->type, array(4, 5)))