added php files

This commit is contained in:
Andreas Hnida 2024-02-23 09:15:32 +00:00
commit cbb49c7bd3
3 changed files with 25 additions and 26 deletions

5
.gitignore vendored
View file

@ -14,4 +14,7 @@ resources
jsconfig.json
hugo_stats.json
go.sum
yarn.lock
yarn.lock
# don't ignore public/php
!public/php

View file

@ -1,6 +1,6 @@
window.onload = function () {
const FORMDEBUG = false;
const FORMDEBUG = true;
// initieiere Zeitmessung zur Botprevention
var startTime = Date.now();
@ -22,18 +22,17 @@ window.onload = function () {
e.preventDefault();
const form = e.target;
const data = new FormData(form);
const notification = document.getElementById('notification');
const btn = document.getElementById('bestellformular-btn');
const zsrTooltip = document.getElementById('zsr-tooltip');
var endTime = Date.now();
var timeSpent = (endTime - startTime) / 1000; // Zeit in Sekunden
// Setze die Werte für die Botvalidierung zum Auswerten in PHP
document.getElementById("age").value = timeSpent;
document.getElementById("hobbies").value = userInteracted ? "true" : "false";
// Validierung der ZSR-Nummer
const zsrNummer = form.elements['zsr_nummer'].value;
const isNumberOrBeantragt = /^\d+$|^beantragt$/i.test(zsrNummer);
@ -45,7 +44,7 @@ window.onload = function () {
zsrTooltip.scrollIntoView({ behavior: "smooth", block: "center", inline: "nearest" });
return;
}
if (FORMDEBUG) {
console.log("userInteracted: " + userInteracted);
console.log("timeSpent: " + timeSpent);
@ -53,8 +52,9 @@ window.onload = function () {
console.log("age: " + document.getElementById("age").value);
console.log("verify_email(honeypot): " + document.getElementById("verify_email").value);
}
// Formulardaten an den Server senden
const data = new FormData(form);
fetch(form.action, {
method: 'POST',
mode: 'cors',

View file

@ -21,7 +21,6 @@ title = 'Zusatzmodule Freiberufliche'
{{% /aligncenter %}}
<form action="https://verua.dev-1.andreashnida.de/php/ajaxmail.php" method="POST" id="formular">
<div id="formPartOne">
<input type="hidden" name="formularart" value="Zusatzmodule Freiberufliche">
<div>
<label for="gender">Geschlecht</label>
@ -47,14 +46,14 @@ title = 'Zusatzmodule Freiberufliche'
<input type="text" id="vorname" name="vorname" required >
</div>
<div>
<input type="text" id="hobbies" name="hobbies" >
<input type="text" id="hobbies" name="hobbies" autocomplete="off">
</div>
<div>
<label for="strasse">Strasse</label>
<input type="text" id="strasse" name="strasse" required >
</div>
<div>
<input type="text" id="age" name="age">
<input type="text" id="age" name="age" autocomplete="off">
</div>
<div>
<label for="plz_ort">PLZ Ort</label>
@ -69,35 +68,32 @@ title = 'Zusatzmodule Freiberufliche'
<input type="email" id="email" name="email" required >
</div>
<div>
<input type="verify_email" id="verify_email" name="verify_email" >
<input type="verify_email" id="verify_email" name="verify_email" autocomplete="off">
</div>
<div id="zsr-tooltip" data-tooltip="Bitte geben Sie eine gültie ZSR-Nummer, oder 'beantragt' ein.">
<label for="zsr_nummer">ZSR Nummer</label>
<input type="text" id="zsr_nummer" name="zsr_nummer" required >
</div>
<div>
<label for="checkbox-group">Welche Erweiterungen möchten Sie hinzubuchen?</label>
<div><br><br>
<h5>Welche Erweiterungen möchten Sie hinzubuchen?</h5><br>
<div id="checkbox-group">
<input type="checkbox" id="zusatzmodul-pop2" name="zusatzmodul-pop2" value="Zusatzmodul POP2">
<input type="checkbox" id="zusatzmodul-pop2" name="zusatzmodul-pop2" value="Ja">
<label for="zusatzmodul-pop2">Zusatzmodul POP2 für 480 CHF</label>
<br>
<input type="checkbox" id="zusatzmodul-materialverwaltung" name="zusatzmodul-materialverwaltung" value="Zusatzmodul Materialverwaltung">
<input type="checkbox" id="zusatzmodul-materialverwaltung" name="zusatzmodul-materialverwaltung" value="Ja">
<label for="zusatzmodul-materialverwaltung">Zusatzmodul Materialverwaltung für 480 CHF</label>
<br>
<input type="checkbox" id="zusatzmodul-qr-code" name="zusatzmodul-qr-code" value="Zusatzmodul QR-Code">
<input type="checkbox" id="zusatzmodul-qr-code" name="zusatzmodul-qr-code" value="Ja">
<label for="zusatzmodul-qr-code">Zusatzmodul QR-Code für 36.00 CHF jährlich, Ausschaltgebühr einmalig pro Instanz 50.00 CHF</label>
<br>
<input type="checkbox" id="zusatzmodul-perigon" name="zusatzmodul-perigon" value="Zusatzmodul Perigon">
<input type="checkbox" id="zusatzmodul-perigon" name="zusatzmodul-perigon" value="Ja">
<label for="zusatzmodul-perigon">Zusatzmodul Perigon, Ausschaltgebühr einmalig 50.00 CHF</label>
</div>
<div>
</div>
<div class="w-full flex justify-center">
<button id="bestellformular-btn" type="submit" class="submitbutton text-white mx-auto submit-after-valid-captcha-bak">Kostenpflichtig bestellen</button>
<div id="notification" class="bg-blue-500 text-white rounded invisible opacity-0 hidden">Notification</div>
</div>
<div><br><br>
<div class="w-full flex justify-center">
<button id="bestellformular-btn" type="submit" class="submitbutton text-white mx-auto submit-after-valid-captcha-bak">Kostenpflichtig bestellen</button>
<div id="notification" class="bg-blue-500 text-white rounded invisible opacity-0 hidden">Notification</div>
</div>
</form>