From 785452873f0ee0a27fc157b482b7551560f0282d Mon Sep 17 00:00:00 2001 From: lolcat Date: Tue, 7 Nov 2023 08:04:56 -0500 Subject: fix typo --- lib/captcha_gen.php | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) (limited to 'lib/captcha_gen.php') diff --git a/lib/captcha_gen.php b/lib/captcha_gen.php index 80bc665..6728747 100644 --- a/lib/captcha_gen.php +++ b/lib/captcha_gen.php @@ -4,6 +4,19 @@ class captcha{ public function __construct($frontend, $get, $filters, $page, $output){ + // check if we want captcha + if(config::BOT_PROTECTION !== 1){ + + if($output === true){ + $frontend->loadheader( + $get, + $filters, + $page + ); + } + return; + } + /* Validate cookie, if it exists */ @@ -46,6 +59,7 @@ class captcha{ if($output === false){ + http_response_code(429); // too many reqs echo json_encode([ "status" => "The \"pass\" token in your cookies is missing or has expired!!" ]); @@ -184,15 +198,6 @@ class captcha{ } } - /* - Generate random grid data to pass to captcha.php - */ - $dataset = [ - ["birds", 2263], - ["fumo_plushies", 1006], - ["minecraft", 848] - ]; - // get the positions for the answers // will return between 3 and 6 answer positions $range = range(0, 15); @@ -216,17 +221,18 @@ class captcha{ } // choose a dataset - $choosen = &$dataset[random_int(0, count($dataset) - 1)]; + $c = count(config::CAPTCHA_DATASET); + $choosen = config::CAPTCHA_DATASET[random_int(0, $c - 1)]; $choices = []; - for($i=0; $i