forked from markus/AMPERION_Webpage
Update010920251648
This commit is contained in:
parent
4055e3ae54
commit
29e3a85eae
6 changed files with 162 additions and 36 deletions
32
content/german/danke.md
Normal file
32
content/german/danke.md
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
---
|
||||||
|
title: "Danke"
|
||||||
|
description: ""
|
||||||
|
subtitle : ""
|
||||||
|
lastmod: 2024-07-22T00:00:00
|
||||||
|
layout: "danke"
|
||||||
|
draft: false
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
## Vielen Dank!
|
||||||
|
|
||||||
|
Ihre Nachricht wurde erfolgreich gesendet. Wir melden uns bald bei Ihnen.
|
||||||
|
|
||||||
|
<div style="margin-top: 20px;">
|
||||||
|
<a href="/" class="button">Zurück zu Amperion</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.button {
|
||||||
|
display: inline-block;
|
||||||
|
padding: 10px 20px;
|
||||||
|
background-color: #007BFF;
|
||||||
|
color: white;
|
||||||
|
text-decoration: none;
|
||||||
|
border-radius: 5px;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
.button:hover {
|
||||||
|
background-color: #0056b3;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
@ -112,24 +112,7 @@
|
||||||
|
|
||||||
<!-- ===== Formular ===== -->
|
<!-- ===== Formular ===== -->
|
||||||
<div class="col-lg-7" data-reveal>
|
<div class="col-lg-7" data-reveal>
|
||||||
{{ with site.Params.contact.form }}{{ if .enable }}
|
<form method="POST" action="/send.php" class="card card-pad stack">
|
||||||
{{ $formName := printf "contact_%s" $.Language.Lang }}
|
|
||||||
<form
|
|
||||||
method="POST"
|
|
||||||
class="card card-pad stack"
|
|
||||||
{{ if .use_netlify }}
|
|
||||||
name="{{ $formName }}"
|
|
||||||
netlify
|
|
||||||
data-netlify="true"
|
|
||||||
netlify-honeypot="nhp"
|
|
||||||
action='{{ "/message_sent/" | relLangURL }}'
|
|
||||||
{{ else }}
|
|
||||||
name="contact"
|
|
||||||
action="{{ .action | safeURL }}"
|
|
||||||
{{ end }}
|
|
||||||
>
|
|
||||||
{{ if .use_netlify }}<input type="hidden" name="form-name" value="{{ $formName }}">{{ end }}
|
|
||||||
|
|
||||||
<div class="form-grid">
|
<div class="form-grid">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="name" class="visually-hidden">Name</label>
|
<label for="name" class="visually-hidden">Name</label>
|
||||||
|
|
@ -155,39 +138,27 @@
|
||||||
<label for="message" class="visually-hidden">Ihre Nachricht</label>
|
<label for="message" class="visually-hidden">Ihre Nachricht</label>
|
||||||
<textarea id="message" name="message" class="form-control" rows="6" placeholder="Ihre Nachricht …" required></textarea>
|
<textarea id="message" name="message" class="form-control" rows="6" placeholder="Ihre Nachricht …" required></textarea>
|
||||||
</div>
|
</div>
|
||||||
|
<!-- hCaptcha -->
|
||||||
{{ if .use_netlify }}
|
<div class="form-group full">
|
||||||
<div class="form-group full" style="display:none;">
|
<div class="h-captcha" data-sitekey="15a25108-bbc0-4d02-913c-4ada005ebd20"></div>
|
||||||
<label>Bitte nicht ausfüllen</label>
|
|
||||||
<input name="nhp" type="text">
|
|
||||||
</div>
|
</div>
|
||||||
{{ end }}
|
|
||||||
|
|
||||||
{{ if .use_recaptcha }}
|
|
||||||
<input type="hidden" id="captchaResponse" name="g-recaptcha-response">
|
|
||||||
<div data-netlify-recaptcha="true"></div>
|
|
||||||
{{ end }}
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<p class="form-legal">
|
<p class="form-legal">
|
||||||
<label for="legal-consent">
|
<label for="legal-consent">
|
||||||
<input id="legal-consent" name="legal_consented" type="checkbox" required>
|
<input id="legal-consent" name="legal_consented" type="checkbox" required>
|
||||||
Ich bin mit der Verarbeitung meiner Daten zum Zweck der Kontaktaufnahme einverstanden. (Datenschutzhinweise beachten)
|
Ich bin mit der Verarbeitung meiner Daten zum Zweck der Kontaktaufnahme einverstanden. (Datenschutzhinweise beachten)
|
||||||
</label>
|
</label>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<button class="cta__btn" type="submit" style="--btn-fs:1.5rem; --btn-py:14px; --btn-px:26px;">
|
<button class="cta__btn" type="submit" style="--btn-fs:1.5rem; --btn-py:14px; --btn-px:26px;">
|
||||||
<span aria-hidden="true">➜</span><span>Nachricht senden</span>
|
<span aria-hidden="true">➜</span><span>Nachricht senden</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
{{ end }}{{ end }}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
{{/* Reveal Init (falls global nicht vorhanden) */}}
|
{{/* Reveal Init (falls global nicht vorhanden) */}}
|
||||||
<script>
|
<script>
|
||||||
(function(){
|
(function(){
|
||||||
|
|
@ -205,4 +176,6 @@
|
||||||
els.forEach(e=>io.observe(e));
|
els.forEach(e=>io.observe(e));
|
||||||
})();
|
})();
|
||||||
</script>
|
</script>
|
||||||
|
<!-- hCaptcha-Skript -->
|
||||||
|
<script src="https://js.hcaptcha.com/1/api.js" async defer></script>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
20
layouts/_default/danke.html
Normal file
20
layouts/_default/danke.html
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="de">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Danke für deine Nachricht</title>
|
||||||
|
<meta http-equiv="refresh" content="5; url=/">
|
||||||
|
<style>
|
||||||
|
body { font-family: Arial, sans-serif; line-height: 1.6; text-align: center; padding: 20px; }
|
||||||
|
a { color: #007BFF; text-decoration: none; }
|
||||||
|
a:hover { text-decoration: underline; }
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>Vielen Dank!</h1>
|
||||||
|
<p>Deine Nachricht wurde erfolgreich gesendet. Du wirst in 5 Sekunden weitergeleitet.</p>
|
||||||
|
<p><a href="/">Zurück zu Amperion</a></p>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
||||||
|
|
@ -23,7 +23,7 @@
|
||||||
"bodyPosition": "top",
|
"bodyPosition": "top",
|
||||||
"hashtag": "#tarteaucitron",
|
"hashtag": "#tarteaucitron",
|
||||||
"cookieName": "tarteaucitron",
|
"cookieName": "tarteaucitron",
|
||||||
"orientation": "top",
|
"orientation": "middle",
|
||||||
|
|
||||||
"groupServices": true,
|
"groupServices": true,
|
||||||
"showDetailsOnClick": false,
|
"showDetailsOnClick": false,
|
||||||
|
|
@ -69,3 +69,7 @@
|
||||||
tarteaucitron.user.matomoDontTrackPageView = dontTrackPageView (false | true);
|
tarteaucitron.user.matomoDontTrackPageView = dontTrackPageView (false | true);
|
||||||
tarteaucitron.user.matomoFullTracking = fullTracking (true | false);
|
tarteaucitron.user.matomoFullTracking = fullTracking (true | false);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
(tarteaucitron.job = tarteaucitron.job || []).push('hcaptcha');
|
||||||
|
</script>
|
||||||
97
static/send.php
Normal file
97
static/send.php
Normal file
|
|
@ -0,0 +1,97 @@
|
||||||
|
<?php
|
||||||
|
// PHPMailer laden
|
||||||
|
require '/home/amperion-test/htdocs/test.amperion.at/vendor/phpmailer/src/PHPMailer.php';
|
||||||
|
require '/home/amperion-test/htdocs/test.amperion.at/vendor/phpmailer/src/SMTP.php';
|
||||||
|
require '/home/amperion-test/htdocs/test.amperion.at/vendor/phpmailer/src/Exception.php';
|
||||||
|
|
||||||
|
use PHPMailer\PHPMailer\PHPMailer;
|
||||||
|
use PHPMailer\PHPMailer\Exception;
|
||||||
|
|
||||||
|
// Fehler-Logging
|
||||||
|
ini_set('display_errors', 0);
|
||||||
|
ini_set('log_errors', 1);
|
||||||
|
ini_set('error_log', '/home/amperion-test/private/php_errors.log');
|
||||||
|
|
||||||
|
// SMTP-Konfiguration laden
|
||||||
|
$smtp_config = include '/home/amperion-test/private/smtp_config.php';
|
||||||
|
|
||||||
|
// Formulardaten abrufen
|
||||||
|
$name = $_POST["name"] ?? '';
|
||||||
|
$email = $_POST["email"] ?? '';
|
||||||
|
$company = $_POST["company"] ?? '';
|
||||||
|
$phone = $_POST["phone"] ?? '';
|
||||||
|
$subject = $_POST["subject"] ?? '';
|
||||||
|
$message = $_POST["message"] ?? '';
|
||||||
|
$legal_consented = isset($_POST["legal_consented"]) ? "Ja" : "Nein";
|
||||||
|
$hcaptcha_response = $_POST["h-captcha-response"] ?? '';
|
||||||
|
|
||||||
|
// hCaptcha-Secret aus Environment laden
|
||||||
|
$hcaptcha_secret = getenv('HCAPTCHA_SECRET');
|
||||||
|
if (!$hcaptcha_secret) {
|
||||||
|
error_log("hCaptcha Secret nicht gesetzt!");
|
||||||
|
echo "<p>Server-Konfigurationsfehler. Bitte später erneut versuchen.</p>";
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// hCaptcha-Überprüfung mit cURL
|
||||||
|
$ch = curl_init('https://hcaptcha.com/siteverify');
|
||||||
|
curl_setopt($ch, CURLOPT_POST, true);
|
||||||
|
curl_setopt($ch, CURLOPT_POSTFIELDS, [
|
||||||
|
'secret' => $hcaptcha_secret,
|
||||||
|
'response' => $hcaptcha_response,
|
||||||
|
'remoteip' => $_SERVER['REMOTE_ADDR'] ?? null,
|
||||||
|
]);
|
||||||
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||||
|
|
||||||
|
$response = curl_exec($ch);
|
||||||
|
if ($response === false) {
|
||||||
|
error_log("cURL-Fehler bei hCaptcha: " . curl_error($ch));
|
||||||
|
}
|
||||||
|
curl_close($ch);
|
||||||
|
|
||||||
|
$response_data = json_decode($response, true);
|
||||||
|
|
||||||
|
// E-Mail mit PHPMailer senden, wenn Captcha ok
|
||||||
|
if (!empty($response_data['success']) && $response_data['success'] === true) {
|
||||||
|
$mail = new PHPMailer(true);
|
||||||
|
try {
|
||||||
|
$mail->isSMTP();
|
||||||
|
$mail->Host = $smtp_config['smtp_host'];
|
||||||
|
$mail->Port = $smtp_config['smtp_port'];
|
||||||
|
$mail->SMTPAuth = true;
|
||||||
|
$mail->Username = $smtp_config['smtp_username'];
|
||||||
|
$mail->Password = $smtp_config['smtp_password'];
|
||||||
|
$mail->SMTPSecure = $smtp_config['smtp_encryption'];
|
||||||
|
|
||||||
|
$mail->setFrom($smtp_config['smtp_from'], $smtp_config['smtp_from_name']);
|
||||||
|
$mail->addAddress('office@amperion.at'); // Empfänger
|
||||||
|
if (!empty($email)) {
|
||||||
|
$mail->addReplyTo($email, $name);
|
||||||
|
}
|
||||||
|
|
||||||
|
// UTF-8 für Betreff und Inhalt erzwingen
|
||||||
|
$mail->CharSet = 'UTF-8'; // <-- WICHTIG
|
||||||
|
$mail->Encoding = 'base64'; // <-- WICHTIG
|
||||||
|
|
||||||
|
$mail->Subject = mb_encode_mimeheader("Neue Kontaktanfrage: $subject", 'UTF-8');
|
||||||
|
$mail->Body = "
|
||||||
|
Name: $name
|
||||||
|
E-Mail: $email
|
||||||
|
Unternehmen: $company
|
||||||
|
Telefon: $phone
|
||||||
|
Betreff: $subject
|
||||||
|
Nachricht: $message
|
||||||
|
Datenschutz zugestimmt: $legal_consented
|
||||||
|
";
|
||||||
|
|
||||||
|
$mail->send();
|
||||||
|
header("Location: /danke/"); // Leitet zu /danke/index.html um
|
||||||
|
exit();
|
||||||
|
} catch (Exception $e) {
|
||||||
|
error_log("E-Mail-Fehler: " . $mail->ErrorInfo);
|
||||||
|
echo "<p>Es gab ein Problem beim Senden der Nachricht. Bitte versuche es später erneut.</p>";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
error_log("hCaptcha-Überprüfung fehlgeschlagen: " . print_r($response_data, true));
|
||||||
|
echo "<p>Bitte bestätige, dass du kein Roboter bist.</p>";
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue