Compare commits

...

3 commits

Author SHA1 Message Date
4f1a638b64 removed dummy value in honeypot field
All checks were successful
Build and Deploy Hugo Site / buildAndDeploy (push) Successful in 51s
2024-04-26 23:50:22 +02:00
683342ed6f fixed broken bot feedback 2024-04-26 23:49:59 +02:00
588867c98b added visual aid when debugEnabled to see if considered as bot 2024-04-26 23:49:39 +02:00
3 changed files with 37 additions and 25 deletions

View file

@ -41,6 +41,15 @@ const textInputs = document.querySelectorAll('input[type="text"]')
const captcha = document.querySelectorAll('.captcha')
const captchaInput = document.querySelectorAll('.captcha-input')
const captchaVerifyButton = document.querySelectorAll('.captcha-verify')
const botBadge = document.createElement('div')
if (debugEnabled) {
botBadge.className = 'bot-badge'
document.body.appendChild(botBadge)
botBadge.setAttribute(
'style',
'position: fixed; top: 0; right: 0; z-index: 9999; background-color: red; color: white; font-weight: bold; height:20px; width:20px'
)
}
// Utility variables
let startTime = Date.now()
@ -71,6 +80,7 @@ function setUserInteracted() {
lastInteractionTime = currentTime
userInteracted = true
interactionCount++
checkForBotBehavior()
}
function handleMouseMove(event) {
@ -110,6 +120,11 @@ function checkForBotBehavior() {
honeypotInput2.value !== '' ||
verifyEmailInput.value !== ''
if (debugEnabled)
if (!botDetected) {
botBadge.style.backgroundColor = 'green'
} else {
botBadge.style.backgroundColor = 'red'
}
console.log(
'Bot Detected: ' +
botDetected +

View file

@ -73,7 +73,7 @@ kommentar = 'age und hobbies sind honeypots'
<input type="email" id="email" name="email" requir >
</div>
<div>
<input type="verify_email" id="verify_email" value="someValue" name="verify_email" >
<input type="verify_email" id="verify_email" name="verify_email" >
</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>

View file

@ -23,10 +23,7 @@ try {
$bot = $_POST['tra'] ;
// Überprüfe, ob der Nutzer mit der Seite interagiert hat
$userInteracted = filter_input(INPUT_POST, 'userInteracted');
if ($bot) {
if ($bot == 'true') {
// Es handelt sich wahrscheinlich um einen Bot
$subject = 'Botverdacht - ' . $subject;
}