Skip to content
Snippets Groups Projects
Unverified Commit 285438ea authored by Jonas Leder's avatar Jonas Leder
Browse files

fix comment pubish and use guzzle for web requests

parent 94eb50d3
No related branches found
No related tags found
No related merge requests found
......@@ -3,7 +3,6 @@ class commentsDisplay extends HTMLElement {
super();
let path = window.location.pathname;
let pageName = path.split("/").pop();
pageName = pageName.split(".")[0]
let xhr = new XMLHttpRequest();
xhr.onreadystatechange = () => {
......
......@@ -16,7 +16,7 @@ class newComment extends HTMLElement {
<input type="text" id="email" name="email"><br><br>
<label for="comment">Kommentar:</label><br>
<textarea name="commebodynt" id="comment"></textarea><br><br>
<textarea name="comment" id="comment"></textarea><br><br>
<div class="h-captcha" data-theme="dark" data-sitekey="${sitekey}"></div><br>
......
{
"require": {
"aws/aws-sdk-php": "^3.181",
"symforge/chilkat-php": "9.5.0.66"
"symforge/chilkat-php": "9.5.0.66",
"guzzlehttp/guzzle": "^7.0"
}
}
......@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "f1824e693565797fc0614d71a8f79648",
"content-hash": "2183fbeff4a5ee254a85bd0ba5c86597",
"packages": [
{
"name": "aws/aws-sdk-php",
......@@ -670,5 +670,5 @@
"prefer-lowest": false,
"platform": [],
"platform-dev": [],
"plugin-api-version": "2.0.0"
"plugin-api-version": "2.1.0"
}
<?php
include("./lib/config.php");
require("./vendor/autoload.php");
use GuzzleHttp\Client;
$data = array(
'secret' => $secretkey,
'response' => $_POST['h-captcha-response']
);
$client = new Client();
$verify = curl_init();
curl_setopt($verify, CURLOPT_URL, "https://hcaptcha.com/siteverify");
curl_setopt($verify, CURLOPT_POST, true);
curl_setopt($verify, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt($verify, CURLOPT_RETURNTRANSFER, true);
$response_ = curl_exec($verify);
$responseData = json_decode($response_);
$response = $client->post("https://hcaptcha.com/siteverify", [
"form_params" => $data
]);
$responseData = json_decode($response->getBody());
if($responseData->success) {
echo("$contactmail");
} else {
......
<?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']
);
$verify = curl_init();
curl_setopt($verify, CURLOPT_URL, "https://hcaptcha.com/siteverify");
curl_setopt($verify, CURLOPT_POST, true);
curl_setopt($verify, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt($verify, CURLOPT_RETURNTRANSFER, true);
$response_ = curl_exec($verify);
$responseData = json_decode($response_);
$client = new Client();
$response = $client->post("https://hcaptcha.com/siteverify", [
"form_params" => $data
]);
$responseData = json_decode($response->getBody());
......
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