added php files
This commit is contained in:
parent
022802a9a5
commit
cbb49c7bd3
3 changed files with 25 additions and 26 deletions
|
|
@ -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',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue