diff --git a/app.js b/app.js index 2fcfd93..31298e0 100644 --- a/app.js +++ b/app.js @@ -363,6 +363,49 @@ document.addEventListener('DOMContentLoaded', () => { }); } + // --- Tester Registration Logic --- + const testerForm = document.getElementById('tester-form'); + if (testerForm) { + testerForm.addEventListener('submit', async (e) => { + e.preventDefault(); + + const emailInput = document.getElementById('tester-email'); + const submitBtn = document.getElementById('tester-submit-btn'); + const successMsg = document.getElementById('tester-success-msg'); + const errorMsg = document.getElementById('tester-error-msg'); + + submitBtn.disabled = true; + submitBtn.textContent = 'Wird gesendet...'; + successMsg.style.display = 'none'; + errorMsg.style.display = 'none'; + + try { + const response = await fetch('tester_backend.php', { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ email: emailInput.value }) + }); + + const result = await response.json(); + + if (result.success) { + successMsg.style.display = 'block'; + testerForm.reset(); + } else { + errorMsg.innerHTML = ' ' + (result.error || 'Unbekannter Fehler'); + errorMsg.style.display = 'block'; + } + } catch (err) { + console.error(err); + errorMsg.innerHTML = ' Netzwerkfehler. Bitte später erneut versuchen.'; + errorMsg.style.display = 'block'; + } finally { + submitBtn.disabled = false; + submitBtn.textContent = 'Als Tester anmelden'; + } + }); + } + // --- Modal Management for Impressum & Privacy --- const modalTriggers = document.querySelectorAll('.legal-trigger'); const modals = document.querySelectorAll('.modal-overlay'); diff --git a/datenschutz.html b/datenschutz.html index cb6e867..0419f7f 100644 --- a/datenschutz.html +++ b/datenschutz.html @@ -24,6 +24,7 @@ Upload FAQ Feedback Hub + App Testing Admin + + + + +
+
+

Werde App Tester

+

Hilf uns beim finalen Feinschliff! Trage dich als Tester ein und erhalte exklusiven Vorabzugang zu Schnappix im Google Play Store.

+
+
+ + +
+
+ +
+
+ + + + + + + + + + + + + diff --git a/tester_backend.php b/tester_backend.php new file mode 100644 index 0000000..fa4f81d --- /dev/null +++ b/tester_backend.php @@ -0,0 +1,44 @@ + 'Ungültige Eingabe']); + exit; + } + + $email = filter_var($input['email'], FILTER_SANITIZE_EMAIL); + + if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { + http_response_code(400); + echo json_encode(['error' => 'Ungültige E-Mail Adresse']); + exit; + } + + // Send notification to Ntfy + $ntfyUrl = 'https://ntfy.orfel.de/Schnappix-App-Testing'; + $message = "Eine neue Anfrage für das Schnappix App Testing ist eingegangen!\n\nE-Mail: $email\n\nBitte prüfen und ggf. die Registrierungslinks via E-Mail versenden."; + + $ch = curl_init($ntfyUrl); + curl_setopt($ch, CURLOPT_POST, 1); + curl_setopt($ch, CURLOPT_POSTFIELDS, $message); + curl_setopt($ch, CURLOPT_HTTPHEADER, [ + 'Title: Neue Tester-Anmeldung', + 'Tags: mobile_phone,warning,bust_in_silhouette', + 'Click: mailto:' . $email . '?subject=Schnappix%20App%20Testing%20-%20Einladung&body=Hallo,%0A%0Avielen%20Dank%20f%C3%BCr%20dein%20Interesse%20als%20Tester!%20Hier%20sind%20die%20Links:%0A' + ]); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + curl_setopt($ch, CURLOPT_TIMEOUT, 5); + curl_exec($ch); + curl_close($ch); + + echo json_encode(['success' => true]); + exit; +} +http_response_code(405); +echo json_encode(['error' => 'Method not allowed']); diff --git a/upload.html b/upload.html index ec3acfb..dacf915 100644 --- a/upload.html +++ b/upload.html @@ -159,6 +159,7 @@ Upload FAQ Feedback Hub + App Testing Admin