Skip to content
Snippets Groups Projects
Verified Commit 15b36397 authored by Jonas Leder's avatar Jonas Leder
Browse files

remove old endpoint for creating comments

parent b818a962
No related branches found
No related tags found
1 merge request!8Rewrite API endpoint to graphql
Pipeline #7243 passed
<?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.";
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment