From bca75e38bc41cf6da5ee99b0f813f5fef5320118 Mon Sep 17 00:00:00 2001
From: TheOnlyMace <0815cracky@gmail.com>
Date: Tue, 6 Jan 2026 21:57:55 +0100
Subject: [PATCH] Refactor contact form handling and enhance Mail Gateway page:
Centralized subject mapping for contact requests, improved CSRF token
validation, and optimized AJAX CORS handling. Updated Mail Gateway page
layout and content for better clarity and user engagement, including new
package details and security features.
---
public/assets/js/main.js | 42 ++--
public/contact-handler.php | 98 ++++-----
public/includes/footer.php | 2 +-
public/includes/functions.php | 28 ++-
public/mail-gateway.php | 399 ++++++++++++++++++++++------------
5 files changed, 340 insertions(+), 229 deletions(-)
diff --git a/public/assets/js/main.js b/public/assets/js/main.js
index 8dacfdd..c227c52 100644
--- a/public/assets/js/main.js
+++ b/public/assets/js/main.js
@@ -87,29 +87,39 @@
// Header scroll effect - always visible with transparency change
const header = document.querySelector('.header');
+ const hero = document.querySelector('.hero');
- window.addEventListener('scroll', function() {
+ // Kombinierter, optimierter Scroll-Handler mit requestAnimationFrame
+ let ticking = false;
+
+ function handleScroll() {
const scrollTop = window.pageYOffset || document.documentElement.scrollTop;
- if (scrollTop > 50) {
- // Scrolled down - make header more opaque
- header.classList.add('scrolled');
- } else {
- // At top - make header more transparent
- header.classList.remove('scrolled');
+ // Header-Effekt
+ if (header) {
+ if (scrollTop > 50) {
+ header.classList.add('scrolled');
+ } else {
+ header.classList.remove('scrolled');
+ }
}
- });
-
- // Add parallax effect to hero section
- const hero = document.querySelector('.hero');
- if (hero) {
- window.addEventListener('scroll', function() {
- const scrolled = window.pageYOffset;
- const rate = scrolled * -0.5;
+
+ // Parallax-Effekt für Hero
+ if (hero) {
+ const rate = scrollTop * -0.5;
hero.style.transform = `translateY(${rate}px)`;
- });
+ }
+
+ ticking = false;
}
+ window.addEventListener('scroll', function() {
+ if (!ticking) {
+ requestAnimationFrame(handleScroll);
+ ticking = true;
+ }
+ }, { passive: true });
+
// Form validation (for contact forms)
const forms = document.querySelectorAll('form');
forms.forEach(form => {
diff --git a/public/contact-handler.php b/public/contact-handler.php
index d553bac..f98749f 100644
--- a/public/contact-handler.php
+++ b/public/contact-handler.php
@@ -15,13 +15,42 @@ require_once 'config.php';
// Konfiguration verwenden
$config = getHexaHostConfig();
-// CSRF-Token validieren
+// Betreff-Mapping (zentral definiert)
+const SUBJECT_MAP = [
+ 'allgemeine-anfrage' => 'Allgemeine Anfrage',
+ 'vpc-anfrage' => 'Virtual Private Container Anfrage',
+ 'vps-anfrage' => 'Virtual Private Server Anfrage',
+ 'mail-gateway-anfrage' => 'Mail Gateway Anfrage',
+ 'webhosting-anfrage' => 'Webhosting Anfrage',
+ 'support' => 'Technischer Support',
+ 'beratung' => 'Persönliche Beratung',
+ 'migration' => 'Migration/Umzug',
+ 'sonstiges' => 'Sonstige Anfrage'
+];
+
+// CSRF-Token validieren und invalidieren (verhindert Replay-Attacks)
function validateCSRFToken($token) {
- return isset($_SESSION['csrf_token']) && hash_equals($_SESSION['csrf_token'], $token);
+ if (isset($_SESSION['csrf_token']) && hash_equals($_SESSION['csrf_token'], $token)) {
+ // Token nach erfolgreicher Validierung invalidieren
+ unset($_SESSION['csrf_token']);
+ return true;
+ }
+ return false;
+}
+
+// CORS Headers für AJAX-Requests (nur eigene Domain erlauben)
+$allowed_origins = [
+ 'https://hexahost.de',
+ 'https://www.hexahost.de',
+ 'http://localhost', // Für Entwicklung
+ 'http://127.0.0.1' // Für Entwicklung
+];
+
+$origin = $_SERVER['HTTP_ORIGIN'] ?? '';
+if (in_array($origin, $allowed_origins)) {
+ header('Access-Control-Allow-Origin: ' . $origin);
}
-// CORS Headers für AJAX-Requests
-header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: POST');
header('Access-Control-Allow-Headers: Content-Type');
header('Content-Type: application/json; charset=utf-8');
@@ -114,20 +143,8 @@ function sendEmail($data) {
// Empfänger
$mail->addAddress($config['to_email'], $config['to_name']);
- // Betreff
- $subject_map = [
- 'allgemeine-anfrage' => 'Allgemeine Anfrage',
- 'vpc-anfrage' => 'Virtual Private Container Anfrage',
- 'vps-anfrage' => 'Virtual Private Server Anfrage',
- 'mail-gateway-anfrage' => 'Mail Gateway Anfrage',
- 'webhosting-anfrage' => 'Webhosting Anfrage',
- 'support' => 'Technischer Support',
- 'beratung' => 'Persönliche Beratung',
- 'migration' => 'Migration/Umzug',
- 'sonstiges' => 'Sonstige Anfrage'
- ];
-
- $subject = isset($subject_map[$data['subject']]) ? $subject_map[$data['subject']] : 'Neue Kontaktanfrage';
+ // Betreff (nutzt zentrale SUBJECT_MAP Konstante)
+ $subject = SUBJECT_MAP[$data['subject']] ?? 'Neue Kontaktanfrage';
$mail->Subject = '[HexaHost.de] ' . $subject;
// HTML E-Mail-Inhalt
@@ -158,19 +175,8 @@ function sendEmail($data) {
function sendEmailNative($data) {
global $config;
- $subject_map = [
- 'allgemeine-anfrage' => 'Allgemeine Anfrage',
- 'vpc-anfrage' => 'Virtual Private Container Anfrage',
- 'vps-anfrage' => 'Virtual Private Server Anfrage',
- 'mail-gateway-anfrage' => 'Mail Gateway Anfrage',
- 'webhosting-anfrage' => 'Webhosting Anfrage',
- 'support' => 'Technischer Support',
- 'beratung' => 'Persönliche Beratung',
- 'migration' => 'Migration/Umzug',
- 'sonstiges' => 'Sonstige Anfrage'
- ];
-
- $subject = isset($subject_map[$data['subject']]) ? $subject_map[$data['subject']] : 'Neue Kontaktanfrage';
+ // Betreff (nutzt zentrale SUBJECT_MAP Konstante)
+ $subject = SUBJECT_MAP[$data['subject']] ?? 'Neue Kontaktanfrage';
$subject = '[HexaHost.de] ' . $subject;
// Headers für Spam-Schutz
@@ -193,19 +199,8 @@ function sendEmailNative($data) {
// HTML E-Mail-Template
function generateEmailHTML($data) {
- $subject_map = [
- 'allgemeine-anfrage' => 'Allgemeine Anfrage',
- 'vpc-anfrage' => 'Virtual Private Container Anfrage',
- 'vps-anfrage' => 'Virtual Private Server Anfrage',
- 'mail-gateway-anfrage' => 'Mail Gateway Anfrage',
- 'webhosting-anfrage' => 'Webhosting Anfrage',
- 'support' => 'Technischer Support',
- 'beratung' => 'Persönliche Beratung',
- 'migration' => 'Migration/Umzug',
- 'sonstiges' => 'Sonstige Anfrage'
- ];
-
- $subject_text = isset($subject_map[$data['subject']]) ? $subject_map[$data['subject']] : 'Neue Kontaktanfrage';
+ // Betreff (nutzt zentrale SUBJECT_MAP Konstante)
+ $subject_text = SUBJECT_MAP[$data['subject']] ?? 'Neue Kontaktanfrage';
$html = '
@@ -295,19 +290,8 @@ function generateEmailHTML($data) {
// Text-Version der E-Mail
function generateEmailText($data) {
- $subject_map = [
- 'allgemeine-anfrage' => 'Allgemeine Anfrage',
- 'vpc-anfrage' => 'Virtual Private Container Anfrage',
- 'vps-anfrage' => 'Virtual Private Server Anfrage',
- 'mail-gateway-anfrage' => 'Mail Gateway Anfrage',
- 'webhosting-anfrage' => 'Webhosting Anfrage',
- 'support' => 'Technischer Support',
- 'beratung' => 'Persönliche Beratung',
- 'migration' => 'Migration/Umzug',
- 'sonstiges' => 'Sonstige Anfrage'
- ];
-
- $subject_text = isset($subject_map[$data['subject']]) ? $subject_map[$data['subject']] : 'Neue Kontaktanfrage';
+ // Betreff (nutzt zentrale SUBJECT_MAP Konstante)
+ $subject_text = SUBJECT_MAP[$data['subject']] ?? 'Neue Kontaktanfrage';
$text = "NEUE KONTAKTANFRAGE - HexaHost.de\n";
$text .= "=====================================\n\n";
diff --git a/public/includes/footer.php b/public/includes/footer.php
index c3c8830..60c4169 100644
--- a/public/includes/footer.php
+++ b/public/includes/footer.php
@@ -41,7 +41,7 @@
diff --git a/public/includes/functions.php b/public/includes/functions.php
index 2bfb38d..b944d8d 100644
--- a/public/includes/functions.php
+++ b/public/includes/functions.php
@@ -11,21 +11,25 @@ if (session_status() === PHP_SESSION_NONE) {
/**
* Set page configuration and include header
*
- * @param string $page_title The page title
- * @param string $page_description The page description
- * @param string $current_page The current page identifier
- * @param array $additional_scripts Additional scripts to include
+ * @param string $title The page title
+ * @param string $description The page description
+ * @param string $page The current page identifier
+ * @param array $scripts Additional scripts to include
*/
-function includeHeader($page_title = '', $page_description = '', $current_page = '', $additional_scripts = []) {
+function includeHeader($title = '', $description = '', $page = '', $scripts = []) {
global $page_title, $page_description, $current_page, $additional_scripts;
- // Set default values if not provided
- if (empty($page_title)) {
- $page_title = 'HexaHost.de - Zuverlässiges Hosting aus Niederbayern';
- }
- if (empty($page_description)) {
- $page_description = 'HexaHost.de - Zuverlässiges und preiswertes Hosting aus Niederbayern. VPS, VPC, Mail Gateway und Webhosting Lösungen.';
- }
+ // Set page configuration from parameters
+ $page_title = !empty($title)
+ ? $title
+ : 'HexaHost.de - Zuverlässiges Hosting aus Niederbayern';
+
+ $page_description = !empty($description)
+ ? $description
+ : 'HexaHost.de - Zuverlässiges und preiswertes Hosting aus Niederbayern. VPS, VPC, Mail Gateway und Webhosting Lösungen.';
+
+ $current_page = $page;
+ $additional_scripts = $scripts;
include 'includes/header.php';
}
diff --git a/public/mail-gateway.php b/public/mail-gateway.php
index 3d0e89a..dd3916b 100644
--- a/public/mail-gateway.php
+++ b/public/mail-gateway.php
@@ -2,8 +2,8 @@
require_once 'includes/functions.php';
// Page configuration
-$page_title = 'Mail Gateway - HexaHost.de';
-$page_description = 'Professionelle E-Mail-Lösungen für Unternehmen. Spam-Schutz, Virus-Schutz und E-Mail-Archivierung von HexaHost.de';
+$page_title = 'Mail Gateway - Professionelle E-Mail-Lösungen | HexaHost.de';
+$page_description = 'Professionelle Mail Gateway Lösungen für Unternehmen. Spam-Schutz, E-Mail-Archivierung und sichere E-Mail-Kommunikation bei HexaHost.de';
$current_page = 'mail-gateway';
// Include header
@@ -11,192 +11,302 @@ includeHeader($page_title, $page_description, $current_page);
?>
-
-
- 'Home', 'url' => 'index.php'],
- ['title' => 'Mail Gateway', 'url' => '']
- ]);
- ?>
-
-
-
-
-
-
-
- Professionelle E-Mail-Lösungen
+
+
+
+
+ 'Home', 'url' => 'index.php'],
+ ['title' => 'Mail Gateway', 'url' => '']
+ ]);
+ ?>
+
+ Mail Gateway
+ für Unternehmen
-
- Schützen Sie Ihr Unternehmen mit unseren professionellen Mail Gateway-Lösungen.
- Von Spam-Schutz bis hin zu E-Mail-Archivierung - wir haben die perfekte Lösung
- für Ihre E-Mail-Sicherheit.
+
+ Professionelle E-Mail-Infrastruktur mit maximalem Schutz vor Spam und Malware.
+ Sichern Sie Ihre geschäftliche Kommunikation mit unseren Mail Gateway Lösungen.
-
-
-
-
-
+
+
+
+
+
+
Spam & Virus Schutz
+
+
+
-
99.9% Spam-Schutz
-
Zuverlässige E-Mail-Sicherheit
-
-
+
+
-
-
-
+
+
+
+
+
+
+ Postfächer:
+ 5
+
+
+ Speicher/Postfach:
+ 5 GB
+
+
+ Domains:
+ 1
+
+
+ E-Mails/Tag:
+ 500
+
+
+
+
✓ Spam-Filter
+
✓ Virus-Schutz
+
✓ Webmail
+
✓ IMAP/POP3
+
✓ SSL/TLS Verschlüsselung
+
+
Jetzt bestellen
+
+
+
+
+
Beliebt
+
+
+
+ Postfächer:
+ 25
+
+
+ Speicher/Postfach:
+ 10 GB
+
+
+ Domains:
+ 3
+
+
+ E-Mails/Tag:
+ 2.000
+
+
+
+
✓ Spam-Filter (erweitert)
+
✓ Virus-Schutz
+
✓ Webmail
+
✓ IMAP/POP3
+
✓ SSL/TLS Verschlüsselung
+
✓ E-Mail Archivierung (30 Tage)
+
✓ Kalender & Kontakte
+
+
Jetzt bestellen
+
+
+
+
+
+
+
+ Postfächer:
+ 100
+
+
+ Speicher/Postfach:
+ 25 GB
+
+
+ Domains:
+ 10
+
+
+ E-Mails/Tag:
+ 10.000
+
+
+
+
✓ Spam-Filter (KI-gestützt)
+
✓ Virus-Schutz
+
✓ Webmail
+
✓ IMAP/POP3
+
✓ SSL/TLS Verschlüsselung
+
✓ E-Mail Archivierung (1 Jahr)
+
✓ Kalender & Kontakte
+
✓ ActiveSync für Mobile
+
+
Jetzt bestellen
+
+
+
+
+
+
+
+ Postfächer:
+ Unbegrenzt
+
+
+ Speicher/Postfach:
+ 50 GB
+
+
+ Domains:
+ Unbegrenzt
+
+
+ E-Mails/Tag:
+ Unbegrenzt
+
+
+
+
✓ Spam-Filter (KI-gestützt)
+
✓ Virus-Schutz
+
✓ Webmail
+
✓ IMAP/POP3
+
✓ SSL/TLS Verschlüsselung
+
✓ E-Mail Archivierung (10 Jahre)
+
✓ Kalender & Kontakte
+
✓ ActiveSync für Mobile
+
✓ Dedizierte IP
+
✓ Priority Support
+
+
Jetzt bestellen
+
+
+
+
+
+
+
+
+
+
+
+
Spam-Schutz
-
Fortschrittliche Spam-Filterung mit maschinellem Lernen
+
Mehrstufiger Spam-Filter mit KI-gestützter Erkennung filtert über 99% aller unerwünschten E-Mails zuverlässig heraus.
-
-
+
+
Virus-Schutz
-
Echtzeit-Virus-Erkennung und -Entfernung
+
Echtzeit-Virenscanner prüft alle eingehenden und ausgehenden E-Mails auf Schadsoftware und blockiert gefährliche Anhänge.
-
-
+
+
+
Verschlüsselung
+
TLS-Verschlüsselung für sichere Übertragung. Optional S/MIME und PGP für Ende-zu-Ende-verschlüsselte Kommunikation.
+
+
+
-
E-Mail-Archivierung
-
Sichere und konforme E-Mail-Archivierung
-
-
-
-
24/7 Support
-
Professioneller Support rund um die Uhr
+
E-Mail Archivierung
+
DSGVO-konforme Archivierung aller E-Mails. Revisionssichere Aufbewahrung für rechtliche Anforderungen.
-
-
+
+
-
-
-
-
-
✓ Bis zu 1.000 E-Mails/Tag
-
✓ Spam-Schutz
-
✓ Virus-Schutz
-
✓ E-Mail-Archivierung (30 Tage)
-
✓ SSL/TLS-Verschlüsselung
-
✓ 24/7 Monitoring
-
-
Jetzt bestellen
+
+
+
Kleine Unternehmen
+
Professionelle E-Mail-Adressen mit eigener Domain für ein seriöses Erscheinungsbild Ihres Unternehmens.
-
-
-
Beliebt
-
-
-
✓ Bis zu 5.000 E-Mails/Tag
-
✓ Erweiterter Spam-Schutz
-
✓ Virus-Schutz
-
✓ E-Mail-Archivierung (90 Tage)
-
✓ SSL/TLS-Verschlüsselung
-
✓ Backup-Service
-
✓ Snapshot-Funktion
-
-
Jetzt bestellen
+
+
Mittelstand
+
Skalierbare E-Mail-Infrastruktur mit Archivierung und erweitertem Spam-Schutz für wachsende Teams.
-
-
-
-
-
✓ Bis zu 15.000 E-Mails/Tag
-
✓ Premium Spam-Schutz
-
✓ Virus-Schutz
-
✓ E-Mail-Archivierung (1 Jahr)
-
✓ SSL/TLS-Verschlüsselung
-
✓ Backup-Service
-
✓ Priority Support
-
-
Jetzt bestellen
+
+
Großunternehmen
+
Enterprise-Lösungen mit unbegrenzten Postfächern, langfristiger Archivierung und dedizierter Infrastruktur.
-
-
-
-
-
✓ Unbegrenzte E-Mails/Tag
-
✓ Enterprise Spam-Schutz
-
✓ Virus-Schutz
-
✓ E-Mail-Archivierung (unbegrenzt)
-
✓ SSL/TLS-Verschlüsselung
-
✓ Backup-Service
-
✓ Individuelle Konfiguration
-
-
Jetzt bestellen
+
+
Behörden & Institutionen
+
DSGVO-konforme E-Mail-Lösungen mit höchsten Sicherheitsstandards und revisionssicherer Archivierung.
@@ -205,8 +315,8 @@ includeHeader($page_title, $page_description, $current_page);
-
-
Bereit für professionelle E-Mail-Sicherheit?
+
+
Bereit für professionelle E-Mail-Kommunikation?
Starten Sie noch heute mit unserem Mail Gateway
Jetzt bestellen
@@ -217,4 +327,7 @@ includeHeader($page_title, $page_description, $current_page);
-
\ No newline at end of file
+