mirror of
https://github.com/openvk/commitcaptcha.git
synced 2024-11-14 19:19:09 +03:00
25 lines
709 B
PHP
25 lines
709 B
PHP
<?php declare(strict_types=1);
|
|
use commitcaptcha\CaptchaManager;
|
|
|
|
function captcha_template(): string
|
|
{
|
|
$html = <<<'HTML'
|
|
<div class="captcha">
|
|
<img src="/commitcaptcha/captcha.webp" alt="Captcha" style="margin-bottom: 8px; width: 130px;" />
|
|
<br/>
|
|
<input type="text" name="captcha" placeholder="Enter 8 characters" />
|
|
</div>
|
|
HTML;
|
|
|
|
return COMMITCAPTCHA_ROOT_CONF["commitcaptcha"]["enable"] ? $html : "You have already verified that you are not a robot.";
|
|
}
|
|
|
|
function check_captcha(?string $input = NULL): bool
|
|
{
|
|
if(!$input)
|
|
$input = $_POST["captcha"] ?? 0;
|
|
|
|
return CaptchaManager::i()->verifyCaptcha((string) $input);
|
|
}
|
|
|
|
return (function() {});
|