Small Web Whois update

This commit is contained in:
Pinga 2023-08-11 17:59:46 +03:00
parent 11c158be04
commit 7ded823b5c
2 changed files with 6 additions and 4 deletions

View file

@ -1,4 +1,7 @@
<?php
require 'vendor/autoload.php';
use Gregwar\Captcha\PhraseBuilder;
session_start();
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
@ -7,7 +10,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
exit;
}
if ($_POST['captcha'] !== $_SESSION['captcha']) {
if (PhraseBuilder::comparePhrases($_SESSION['captcha'], $_POST['captcha'])) {
echo json_encode(['error' => 'Incorrect Captcha.']);
exit;
}

View file

@ -3,10 +3,9 @@ require 'vendor/autoload.php';
use Gregwar\Captcha\CaptchaBuilder;
session_start();
$builder = new CaptchaBuilder;
$builder = new CaptchaBuilder();
$builder->build();
session_start();
$_SESSION['captcha'] = $builder->getPhrase();
?>
<!DOCTYPE html>