-
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
-> Code cleanup -> Fix every SQL injection -> Code formating -> Removed old code -> Some more namespaces changes -> Now using a SettingsManager -> Fixed some problems and bugs
- Loading branch information
Showing
96 changed files
with
1,103 additions
and
925 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
namespace MythicalDash\CloudFlare; | ||
|
||
class Captcha | ||
{ | ||
public static function validate_captcha($cf_turnstile_response, $cf_connecting_ip, $cf_secret_key) | ||
{ | ||
$data = array( | ||
"secret" => $cf_secret_key, | ||
"response" => $cf_turnstile_response, | ||
"remoteip" => $cf_connecting_ip | ||
); | ||
|
||
$url = "https://challenges.cloudflare.com/turnstile/v0/siteverify"; | ||
|
||
$options = array( | ||
"http" => array( | ||
"header" => "Content-Type: application/x-www-form-urlencoded\r\n", | ||
"method" => "POST", | ||
"content" => http_build_query($data) | ||
) | ||
); | ||
$context = stream_context_create($options); | ||
$result = file_get_contents($url, false, $context); | ||
|
||
if ($result == false) { | ||
return false; | ||
} | ||
|
||
$result = json_decode($result, true); | ||
|
||
return $result["success"]; | ||
} | ||
|
||
} | ||
?> |
Oops, something went wrong.