MOON
Server: Apache
System: Linux server30c.hostingraja.org 5.14.0-611.49.2.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Apr 30 09:05:08 EDT 2026 x86_64
User: seoprovi (1222)
PHP: 5.6.40
Disabled: NONE
Upload Files
File: /home/seoprovi/seoprovider.online/submit/src/ReCaptchaValidator.php
<?php
namespace FormGuide\Handlx;

class ReCaptchaValidator
{
	private $enabled;
	private $secret;
	public function __construct()
	{
		$this->enabled=false;
	}
	
	public function isEnabled()
	{
		return $this->enabled;	
	}

	public function enable($enable)
	{
		$this->enabled = $enable;
	}

	public function initSecretKey($key)
	{
		$this->secret = $key;
	}

	public function validate()
	{
		if(empty($_POST['g-recaptcha-response']))
		{
			return false;
		}

		$captcha=$_POST['g-recaptcha-response'];

		$url = 
		'https://www.google.com/recaptcha/api/siteverify?secret='.$this->secret.'&response='.$captcha.'&remoteip='.$_SERVER['REMOTE_ADDR'];

		$resp_raw = file_get_contents($url);

		$response=json_decode($resp_raw, true);

		if(!empty($response['success']) && $response['success'])
		{
			return true;
		}
		return false;
	}
}