From addc5a14a93547f630f23e5b6a79cffa2e37d71a Mon Sep 17 00:00:00 2001 From: lolcat Date: Sat, 17 Feb 2024 23:22:19 -0500 Subject: boobs --- lib/captcha_gen.php | 336 ---------------------------------------------------- 1 file changed, 336 deletions(-) delete mode 100644 lib/captcha_gen.php (limited to 'lib/captcha_gen.php') diff --git a/lib/captcha_gen.php b/lib/captcha_gen.php deleted file mode 100644 index abcab7a..0000000 --- a/lib/captcha_gen.php +++ /dev/null @@ -1,336 +0,0 @@ -loadheader( - $get, - $filters, - $page - ); - } - return; - } - - /* - Validate cookie, if it exists - */ - if(isset($_COOKIE["pass"])){ - - if( - // check if key is not malformed - preg_match( - '/^c[0-9]+\.[A-Za-z0-9]{20}$/', - $_COOKIE["pass"] - ) && - // does key exist - apcu_exists($_COOKIE["pass"]) - ){ - - // exists, increment counter - $inc = apcu_inc($_COOKIE["pass"]); - - // we start counting from 1 - // when it has been incremented to 102, it has reached - // 100 reqs - if($inc >= 102){ - - // reached limit, delete and give captcha - apcu_delete($_COOKIE["pass"]); - }else{ - - // the cookie is OK! dont die() and give results - apcu_inc("real_requests"); - - if($output === true){ - $frontend->loadheader( - $get, - $filters, - $page - ); - } - return; - } - } - } - - 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!!" - ]); - die(); - } - - /* - Validate form data - */ - $lines = - explode( - "\r\n", - file_get_contents("php://input") - ); - - $invalid = false; - $answers = []; - $key = false; - $error = ""; - - foreach($lines as $line){ - - $line = explode("=", $line, 2); - - if(count($line) !== 2){ - - $invalid = true; - break; - } - - preg_match( - '/^c\[([0-9]+)\]$/', - $line[0], - $regex - ); - - if( - $line[1] != "on" || - !isset($regex[0][1]) - ){ - - // check if its k - if( - $line[0] == "k" && - strpos($line[1], "c.") === 0 - ){ - - $key = apcu_fetch($line[1]); - apcu_delete($line[1]); - } - break; - } - - $regex = (int)$regex[1]; - - if( - $regex >= 16 || - $regex <= -1 - ){ - - $invalid = true; - break; - } - - $answers[] = $regex; - } - - if( - !$invalid && - $key !== false - ){ - $check = $key[1]; - - // validate answer - for($i=0; $i time() + 86400, // expires in 24 hours - "samesite" => "Lax", - "path" => "/" - ] - ); - - $frontend->loadheader( - $get, - $filters, - $page - ); - return; - - }else{ - - $error = "
You were kicked out of Mensa. Please try again.
"; - } - } - - // get the positions for the answers - // will return between 3 and 6 answer positions - $range = range(0, 15); - $answer_pos = []; - - array_splice($range, 0, 1); - - for($i=0; $i "", - "right-left" => "", - "right-right" => "", - "left" => - '
' . - '

IQ test

' . - 'Due to getting hit with 20,000 bot requests per day, I had to put this up. Sorry.

' . - 'Solving this captcha will allow you to make 100 searches today. I will add a way for legit users to bypass the captcha later. Sorry /g/tards!!' . - $error . - '
' . - '
' . - '
' . - 'Captcha image' . - '
' . - '' . - '' . - '' . - '' . - '' . - '' . - '' . - '' . - '' . - '' . - '' . - '' . - '' . - '' . - '' . - '' . - '' . - '' . - '' . - '' . - '' . - '' . - '' . - '' . - '' . - '' . - '' . - '' . - '' . - '' . - '' . - '' . - '
' . - '
' . - '
' . - '' . - '' . - '
' . - '
' - ]; - - http_response_code(429); // too many reqs - $frontend->loadheader( - $get, - $filters, - $page - ); - - echo $frontend->load("search.html", $payload); - die(); - } -} -- cgit v1.2.3