From 15b36397ae93cb14b77add54ac8eb1b0cc7404a9 Mon Sep 17 00:00:00 2001 From: Jonas Leder <jonas.leder@jobrouter.com> Date: Mon, 14 Mar 2022 15:39:38 +0100 Subject: [PATCH] remove old endpoint for creating comments --- public/API/newComment.php | 39 --------------------------------------- 1 file changed, 39 deletions(-) delete mode 100644 public/API/newComment.php diff --git a/public/API/newComment.php b/public/API/newComment.php deleted file mode 100644 index ab8d298..0000000 --- a/public/API/newComment.php +++ /dev/null @@ -1,39 +0,0 @@ -<?php -require './vendor/autoload.php'; -include("./lib/config.php"); -include("./lib/mysql.php"); - -use GuzzleHttp\Client; - -$data = array( - 'secret' => $secretkey, - 'response' => $_POST['h-captcha-response'] -); - -$client = new Client(); - -$response = $client->post("https://hcaptcha.com/siteverify", [ - "form_params" => $data -]); - -$responseData = json_decode($response->getBody()); - - - -if($responseData->success) { - - $article =$conn->escape_string($_POST["pagename"]); - $name = $conn->escape_string($_POST["name"]); - $email = $conn->escape_string($_POST["email"]); - $comment = $conn->escape_string($_POST["comment"]); - - $sql = "INSERT INTO comments (name, email, comment, article) VALUES ('$name', '$email', '$comment', '$article')"; - - if ($conn->query($sql) === TRUE) { - header("Location: " . $_SERVER["HTTP_REFERER"]); - } else { - echo "Error: " . $sql . "<br>" . $conn->error; - } -} else { - echo "Failed to verify captcha."; -} -- GitLab