Aktualisierung der Kontaktseite: Ersetzung von Live Chat durch Discord-Support, Anpassung des Kontaktformulars mit Honeypot-Feld für Bot-Schutz und Verbesserung der Formularvalidierung. Hinzufügung von CSS-Stilen für neue Abschnitte und Optimierung der responsiven Darstellung.

This commit is contained in:
Samuel Müller
2025-07-31 16:30:05 +02:00
parent 3df2a0efea
commit a0b315c13f
6 changed files with 959 additions and 21 deletions

View File

@@ -0,0 +1,199 @@
# HexaHost.de E-Mail-System Setup
## 📧 Kontaktformular E-Mail-Versand
Dieses System ermöglicht den E-Mail-Versand über das Kontaktformular mit SMTP-Integration und umfassendem Spam-Schutz.
## 🚀 Installation
### 1. SMTP-Konfiguration
Öffnen Sie die Datei `config.php` und tragen Sie Ihre SMTP-Daten ein:
```php
$smtp_config = [
'smtp_host' => 'smtp.gmail.com', // Ihr SMTP-Server
'smtp_port' => 587, // Port (587 für TLS, 465 für SSL)
'smtp_username' => 'info@hexahost.de', // Ihr SMTP-Benutzername
'smtp_password' => 'IHR_PASSWORT', // Ihr SMTP-Passwort
'smtp_encryption' => 'tls', // 'tls' oder 'ssl'
'from_email' => 'info@hexahost.de', // Absender-E-Mail
'to_email' => 'info@hexahost.de', // Empfänger-E-Mail
];
```
### 2. E-Mail-Provider Beispiele
#### Gmail
```php
'smtp_host' => 'smtp.gmail.com',
'smtp_port' => 587,
'smtp_encryption' => 'tls',
```
**Hinweis:** Aktivieren Sie "Weniger sichere Apps" oder verwenden Sie App-Passwörter.
#### Outlook/Hotmail
```php
'smtp_host' => 'smtp-mail.outlook.com',
'smtp_port' => 587,
'smtp_encryption' => 'tls',
```
#### GMX
```php
'smtp_host' => 'mail.gmx.net',
'smtp_port' => 587,
'smtp_encryption' => 'tls',
```
#### Web.de
```php
'smtp_host' => 'smtp.web.de',
'smtp_port' => 587,
'smtp_encryption' => 'tls',
```
#### Eigener Mail-Server
```php
'smtp_host' => 'mail.ihre-domain.de',
'smtp_port' => 587, // oder 465 für SSL
'smtp_encryption' => 'tls', // oder 'ssl'
```
## 🔒 Sicherheitsfeatures
### Anti-Spam Schutz
- **Rate Limiting**: Max. 5 Anfragen pro Stunde pro IP
- **Honeypot**: Verstecktes Feld für Bot-Schutz
- **Input-Validierung**: Sanitization aller Eingaben
- **E-Mail-Validierung**: Format-Prüfung
### E-Mail-Headers für Spam-Schutz
```php
X-Mailer: HexaHost Contact Form
X-Priority: 3
X-MSMail-Priority: Normal
Importance: Normal
X-Report-Abuse: Please report abuse here: abuse@hexahost.de
```
## 📧 E-Mail-Template
### HTML-E-Mail
- Responsive Design
- HexaHost Branding
- Strukturierte Darstellung aller Formulardaten
- IP-Adresse und Zeitstempel für Tracking
### Text-Version
- Fallback für E-Mail-Clients ohne HTML-Support
- Alle wichtigen Informationen enthalten
## 🛠️ DNS-Konfiguration für Spam-Schutz
### SPF Record (TXT Record)
```
v=spf1 include:_spf.hexahost.de ~all
```
### DMARC Record (TXT Record)
```
v=DMARC1; p=quarantine; rua=mailto:dmarc@hexahost.de
```
### DKIM
- Wird über Ihren Mail-Server konfiguriert
- Erhöht die Zustellbarkeit erheblich
## 🔧 Debugging
### Debug-Modus aktivieren
```php
$debug_config = [
'debug_mode' => true,
'log_errors' => true,
'log_file' => 'contact_form_errors.log',
];
```
### Log-Datei prüfen
```bash
tail -f contact_form_errors.log
```
## 📋 Dateistruktur
```
public/
├── contact-handler.php # E-Mail-Verarbeitung
├── config.php # SMTP-Konfiguration
├── contact.html # Kontaktformular
├── assets/
│ ├── css/
│ │ └── style.css # Styling
│ └── js/
│ └── contact.js # Frontend-Logic
└── README-EMAIL-SETUP.md # Diese Anleitung
```
## 🧪 Testing
### 1. Konfiguration testen
```bash
php -f config.php
```
### 2. E-Mail-Versand testen
1. Öffnen Sie `contact.html`
2. Füllen Sie das Formular aus
3. Senden Sie eine Test-Nachricht
4. Prüfen Sie Ihr E-Mail-Postfach
### 3. Fehlerbehebung
- Prüfen Sie die Browser-Konsole (F12)
- Prüfen Sie die PHP-Fehler-Logs
- Aktivieren Sie den Debug-Modus
## 🔧 Erweiterte Konfiguration
### PHPMailer Integration
Falls PHPMailer verfügbar ist, wird es automatisch verwendet:
```bash
composer require phpmailer/phpmailer
```
### Fallback
Falls PHPMailer nicht verfügbar ist, wird die native PHP `mail()` Funktion verwendet.
## 📊 Monitoring
### Erfolgreiche E-Mails
- Empfangen Sie strukturierte HTML-E-Mails
- Alle Formulardaten werden übersichtlich dargestellt
- IP-Adresse und Zeitstempel für Tracking
### Fehlerbehandlung
- Detaillierte Fehlermeldungen im Log
- Benutzerfreundliche Frontend-Meldungen
- Rate-Limiting-Schutz
## 🚨 Wichtige Hinweise
1. **Sicherheit**: Ändern Sie die Standard-Konfiguration
2. **Passwörter**: Verwenden Sie sichere SMTP-Passwörter
3. **SSL/TLS**: Verwenden Sie immer verschlüsselte Verbindungen
4. **DNS**: Konfigurieren Sie SPF, DMARC und DKIM
5. **Backups**: Sichern Sie die Konfigurationsdateien
## 📞 Support
Bei Problemen:
1. Prüfen Sie die Log-Dateien
2. Aktivieren Sie den Debug-Modus
3. Testen Sie die SMTP-Verbindung
4. Kontaktieren Sie Ihren Hosting-Provider
---
**© 2024 HexaHost.de - Alle Rechte vorbehalten**

View File

@@ -509,6 +509,97 @@ body {
font-size: var(--font-size-sm);
}
/* How it Works Section */
.how-it-works {
padding: var(--spacing-3xl) 0;
background: rgba(255, 255, 255, 0.02);
}
.steps-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
gap: var(--spacing-xl);
margin-top: var(--spacing-2xl);
}
.step-item {
padding: var(--spacing-xl);
text-align: center;
position: relative;
}
.step-number {
width: 60px;
height: 60px;
background: linear-gradient(135deg, var(--primary-color), var(--accent-color-1));
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
font-size: var(--font-size-xl);
font-weight: 700;
color: var(--white);
margin: 0 auto var(--spacing-lg);
box-shadow: 0 8px 32px 0 rgba(255, 81, 249, 0.3);
}
.step-item h3 {
font-size: var(--font-size-lg);
font-weight: 600;
margin-bottom: var(--spacing-md);
color: var(--text-primary);
}
.step-item p {
color: var(--text-secondary);
line-height: 1.6;
font-size: var(--font-size-base);
}
/* Mail Features Section */
.mail-features {
padding: var(--spacing-3xl) 0;
background: rgba(255, 255, 255, 0.03);
}
/* Benefits Section */
.benefits {
padding: var(--spacing-3xl) 0;
background: rgba(255, 255, 255, 0.02);
}
.benefits-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
gap: var(--spacing-xl);
margin-top: var(--spacing-2xl);
}
.benefit-item {
padding: var(--spacing-xl);
text-align: center;
}
.benefit-icon {
width: 48px;
height: 48px;
margin: 0 auto var(--spacing-lg);
color: var(--primary-color);
}
.benefit-item h3 {
font-size: var(--font-size-lg);
font-weight: 600;
margin-bottom: var(--spacing-md);
color: var(--text-primary);
}
.benefit-item p {
color: var(--text-secondary);
line-height: 1.6;
font-size: var(--font-size-base);
}
/* CTA Section */
.cta {
padding: var(--spacing-3xl) 0;
@@ -1263,6 +1354,19 @@ body {
transition: all var(--transition-base);
}
/* Spezielle Styling für Select-Elemente */
.form-group select {
background: rgba(255, 255, 255, 0.1);
backdrop-filter: blur(10px);
-webkit-backdrop-filter: blur(10px);
}
.form-group select option {
background: rgba(13, 8, 33, 0.95);
color: var(--text-primary);
padding: var(--spacing-sm);
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
@@ -1444,6 +1548,16 @@ body {
grid-template-columns: 1fr;
}
.steps-grid {
grid-template-columns: 1fr;
gap: var(--spacing-lg);
}
.benefits-grid {
grid-template-columns: 1fr;
gap: var(--spacing-lg);
}
.story-content {
grid-template-columns: 1fr;
}

View File

@@ -50,12 +50,16 @@
// Get form data
const formData = new FormData(form);
// Add honeypot field (hidden field for bot protection)
formData.append('website', ''); // Honeypot field
// Basic validation
const data = {};
for (let [key, value] of formData.entries()) {
data[key] = value;
}
// Basic validation
if (!validateForm(data)) {
return;
}
@@ -66,21 +70,49 @@
submitBtn.textContent = 'Wird gesendet...';
submitBtn.disabled = true;
// Simulate form submission (replace with actual endpoint)
setTimeout(() => {
// Send form data to PHP backend
fetch('contact-handler.php', {
method: 'POST',
body: formData
})
.then(response => response.json())
.then(data => {
if (data.success) {
// Reset form
form.reset();
// Show success message
showNotification('Ihre Nachricht wurde erfolgreich gesendet! Wir melden uns in Kürze bei Ihnen.', 'success');
// Reset button
submitBtn.textContent = originalText;
submitBtn.disabled = false;
showNotification(data.message, 'success');
// Scroll to top
window.scrollTo({ top: 0, behavior: 'smooth' });
}, 2000);
} else {
// Show error message
showNotification(data.message, 'error');
// Highlight missing fields if provided
if (data.missing_fields) {
data.missing_fields.forEach(field => {
const fieldElement = document.getElementById(field);
if (fieldElement) {
fieldElement.style.borderColor = '#ff4d6d';
setTimeout(() => {
fieldElement.style.borderColor = '';
}, 3000);
}
});
}
}
})
.catch(error => {
console.error('Error:', error);
showNotification('Ein Fehler ist aufgetreten. Bitte versuchen Sie es später erneut.', 'error');
})
.finally(() => {
// Reset button
submitBtn.textContent = originalText;
submitBtn.disabled = false;
});
});
}

171
public/config.php Normal file
View File

@@ -0,0 +1,171 @@
<?php
/**
* HexaHost.de SMTP Konfiguration
*
* WICHTIG: Ändern Sie diese Werte entsprechend Ihren SMTP-Einstellungen!
*
* Beispiele für verschiedene E-Mail-Provider:
*
* Gmail:
* - smtp_host: smtp.gmail.com
* - smtp_port: 587
* - smtp_encryption: tls
*
* Outlook/Hotmail:
* - smtp_host: smtp-mail.outlook.com
* - smtp_port: 587
* - smtp_encryption: tls
*
* GMX:
* - smtp_host: mail.gmx.net
* - smtp_port: 587
* - smtp_encryption: tls
*
* Web.de:
* - smtp_host: smtp.web.de
* - smtp_port: 587
* - smtp_encryption: tls
*
* Eigener Mail-Server:
* - smtp_host: mail.ihre-domain.de
* - smtp_port: 587 (oder 465 für SSL)
* - smtp_encryption: tls (oder ssl)
*/
// SMTP Konfiguration - HIER IHRE WERTE EINTRAGEN
$smtp_config = [
// SMTP Server-Einstellungen
'smtp_host' => 'YOUR_SMTP_HOST', // z.B. smtp.gmail.com
'smtp_port' => 587, // 587 für TLS, 465 für SSL
'smtp_username' => 'YOUR_SMTP_USERNAME', // z.B. info@hexahost.de
'smtp_password' => 'YOUR_SMTP_PASSWORD', // Ihr SMTP-Passwort
'smtp_encryption' => 'tls', // 'tls' oder 'ssl'
// Absender-Einstellungen
'from_email' => 'info@hexahost.de', // Absender-E-Mail
'from_name' => 'HexaHost.de Kontaktformular', // Absender-Name
// Empfänger-Einstellungen
'to_email' => 'info@hexahost.de', // Empfänger-E-Mail
'to_name' => 'HexaHost Support', // Empfänger-Name
// Sicherheitseinstellungen
'max_requests_per_hour' => 5, // Max. Anfragen pro Stunde pro IP
'honeypot_field' => 'website', // Verstecktes Feld für Bot-Schutz
// E-Mail-Template-Einstellungen
'email_template' => 'html', // 'html' oder 'text'
'include_ip_address' => true, // IP-Adresse in E-Mail anzeigen
'include_timestamp' => true, // Zeitstempel in E-Mail anzeigen
];
// DNS-Einstellungen für Spam-Schutz (werden über DNS konfiguriert)
$dns_config = [
// SPF Record (TXT Record in DNS)
'spf_record' => 'v=spf1 include:_spf.hexahost.de ~all',
// DMARC Record (TXT Record in DNS)
'dmarc_record' => 'v=DMARC1; p=quarantine; rua=mailto:dmarc@hexahost.de',
// DKIM wird über den Mail-Server konfiguriert
];
// Debug-Einstellungen (nur für Entwicklung)
$debug_config = [
'debug_mode' => false, // Debug-Modus aktivieren
'log_errors' => true, // Fehler loggen
'log_file' => 'contact_form_errors.log', // Log-Datei
];
// Exportiere Konfiguration für andere Dateien
if (!defined('HEXAHOST_CONFIG_LOADED')) {
define('HEXAHOST_CONFIG_LOADED', true);
// Globale Variablen für andere Dateien
$GLOBALS['hexahost_smtp_config'] = $smtp_config;
$GLOBALS['hexahost_dns_config'] = $dns_config;
$GLOBALS['hexahost_debug_config'] = $debug_config;
}
// Hilfsfunktion zum Abrufen der Konfiguration
function getHexaHostConfig($key = null) {
global $smtp_config, $dns_config, $debug_config;
if ($key === null) {
return array_merge($smtp_config, $dns_config, $debug_config);
}
if (isset($smtp_config[$key])) {
return $smtp_config[$key];
}
if (isset($dns_config[$key])) {
return $dns_config[$key];
}
if (isset($debug_config[$key])) {
return $debug_config[$key];
}
return null;
}
// Debug-Funktion
function hexahostDebug($message, $type = 'info') {
global $debug_config;
if (!$debug_config['debug_mode']) {
return;
}
$timestamp = date('Y-m-d H:i:s');
$log_message = "[$timestamp] [$type] $message" . PHP_EOL;
if ($debug_config['log_errors']) {
error_log($log_message, 3, $debug_config['log_file']);
}
if ($debug_config['debug_mode']) {
echo "<!-- HexaHost Debug: $message -->\n";
}
}
// Validierung der SMTP-Konfiguration
function validateSMTPConfig() {
$config = getHexaHostConfig();
$errors = [];
// Prüfe ob alle erforderlichen Felder ausgefüllt sind
$required_fields = ['smtp_host', 'smtp_username', 'smtp_password', 'from_email', 'to_email'];
foreach ($required_fields as $field) {
if (empty($config[$field]) || $config[$field] === 'YOUR_SMTP_' . strtoupper(substr($field, 5))) {
$errors[] = "Konfigurationsfehler: $field ist nicht korrekt eingestellt.";
}
}
// Prüfe SMTP-Port
if (!is_numeric($config['smtp_port']) || $config['smtp_port'] < 1 || $config['smtp_port'] > 65535) {
$errors[] = "Konfigurationsfehler: Ungültiger SMTP-Port.";
}
// Prüfe E-Mail-Format
if (!filter_var($config['from_email'], FILTER_VALIDATE_EMAIL)) {
$errors[] = "Konfigurationsfehler: Ungültige Absender-E-Mail.";
}
if (!filter_var($config['to_email'], FILTER_VALIDATE_EMAIL)) {
$errors[] = "Konfigurationsfehler: Ungültige Empfänger-E-Mail.";
}
return $errors;
}
// Zeige Konfigurationsfehler an (nur im Debug-Modus)
if (getHexaHostConfig('debug_mode')) {
$config_errors = validateSMTPConfig();
if (!empty($config_errors)) {
hexahostDebug('SMTP-Konfigurationsfehler: ' . implode(', ', $config_errors), 'error');
}
}
?>

424
public/contact-handler.php Normal file
View File

@@ -0,0 +1,424 @@
<?php
/**
* HexaHost.de Contact Form Handler
* E-Mail-Verarbeitung mit SMTP-Integration und Spam-Schutz
*/
// Konfiguration laden
require_once 'config.php';
// Konfiguration verwenden
$config = getHexaHostConfig();
// 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');
// Nur POST-Requests erlauben
if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
http_response_code(405);
echo json_encode(['success' => false, 'message' => 'Method not allowed']);
exit;
}
// Rate Limiting
function checkRateLimit($ip) {
global $config;
$cache_file = sys_get_temp_dir() . '/hexahost_contact_' . md5($ip) . '.txt';
$current_time = time();
if (file_exists($cache_file)) {
$data = json_decode(file_get_contents($cache_file), true);
if ($data && isset($data['requests'])) {
// Entferne alte Einträge (älter als 1 Stunde)
$data['requests'] = array_filter($data['requests'], function($timestamp) use ($current_time) {
return ($current_time - $timestamp) < 3600;
});
if (count($data['requests']) >= $config['max_requests_per_hour']) {
return false;
}
}
}
// Füge aktuellen Request hinzu
$data = isset($data) ? $data : ['requests' => []];
$data['requests'][] = $current_time;
file_put_contents($cache_file, json_encode($data));
return true;
}
// Honeypot Check
function checkHoneypot($data) {
global $config;
$honeypot_field = $config['honeypot_field'];
// Das Honeypot-Feld sollte leer sein (verstecktes Feld)
if (!empty($data[$honeypot_field])) {
return false;
}
return true;
}
// E-Mail-Validierung
function validateEmail($email) {
return filter_var($email, FILTER_VALIDATE_EMAIL) !== false;
}
// Input-Sanitization
function sanitizeInput($input) {
return htmlspecialchars(strip_tags(trim($input)), ENT_QUOTES, 'UTF-8');
}
// SMTP E-Mail-Versand mit PHPMailer
function sendEmail($data) {
global $config;
// PHPMailer laden (falls verfügbar)
if (!class_exists('PHPMailer\PHPMailer\PHPMailer')) {
// Fallback: Native PHP mail() Funktion
return sendEmailNative($data);
}
try {
$mail = new PHPMailer\PHPMailer\PHPMailer(true);
// Server-Einstellungen
$mail->isSMTP();
$mail->Host = $config['smtp_host'];
$mail->SMTPAuth = true;
$mail->Username = $config['smtp_username'];
$mail->Password = $config['smtp_password'];
$mail->SMTPSecure = $config['smtp_encryption'];
$mail->Port = $config['smtp_port'];
$mail->CharSet = 'UTF-8';
// Absender
$mail->setFrom($config['from_email'], $config['from_name']);
$mail->addReplyTo($data['email'], $data['firstName'] . ' ' . $data['lastName']);
// 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';
$mail->Subject = '[HexaHost.de] ' . $subject;
// HTML E-Mail-Inhalt
$html_content = generateEmailHTML($data);
$mail->isHTML(true);
$mail->Body = $html_content;
$mail->AltBody = generateEmailText($data);
// Anti-Spam Headers
$mail->addCustomHeader('X-Mailer', 'HexaHost Contact Form');
$mail->addCustomHeader('X-Priority', '3');
$mail->addCustomHeader('X-MSMail-Priority', 'Normal');
$mail->addCustomHeader('Importance', 'Normal');
$mail->addCustomHeader('X-Report-Abuse', 'Please report abuse here: abuse@hexahost.de');
// DKIM, SPF, DMARC werden über DNS konfiguriert
$mail->send();
return true;
} catch (Exception $e) {
error_log('HexaHost Contact Form Error: ' . $e->getMessage());
return false;
}
}
// Fallback: Native PHP mail() Funktion
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';
$subject = '[HexaHost.de] ' . $subject;
// Headers für Spam-Schutz
$headers = [
'From: ' . $config['from_name'] . ' <' . $config['from_email'] . '>',
'Reply-To: ' . $data['firstName'] . ' ' . $data['lastName'] . ' <' . $data['email'] . '>',
'MIME-Version: 1.0',
'Content-Type: text/html; charset=UTF-8',
'X-Mailer: HexaHost Contact Form',
'X-Priority: 3',
'X-MSMail-Priority: Normal',
'Importance: Normal',
'X-Report-Abuse: Please report abuse here: abuse@hexahost.de'
];
$message = generateEmailHTML($data);
return mail($config['to_email'], $subject, $message, implode("\r\n", $headers));
}
// 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';
return '
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Neue Kontaktanfrage - HexaHost.de</title>
<style>
body { font-family: Arial, sans-serif; line-height: 1.6; color: #333; }
.container { max-width: 600px; margin: 0 auto; padding: 20px; }
.header { background: linear-gradient(135deg, #ff51f9, #a348ff); color: white; padding: 20px; text-align: center; }
.content { background: #f9f9f9; padding: 20px; }
.field { margin-bottom: 15px; }
.label { font-weight: bold; color: #666; }
.value { color: #333; }
.message { background: white; padding: 15px; border-left: 4px solid #ff51f9; margin: 15px 0; }
.footer { text-align: center; padding: 20px; color: #666; font-size: 12px; }
</style>
</head>
<body>
<div class="container">
<div class="header">
<h1>Neue Kontaktanfrage</h1>
<p>HexaHost.de Kontaktformular</p>
</div>
<div class="content">
<div class="field">
<div class="label">Betreff:</div>
<div class="value">' . $subject_text . '</div>
</div>
<div class="field">
<div class="label">Name:</div>
<div class="value">' . $data['firstName'] . ' ' . $data['lastName'] . '</div>
</div>
<div class="field">
<div class="label">E-Mail:</div>
<div class="value">' . $data['email'] . '</div>
</div>';
if (!empty($data['phone'])) {
$html .= '
<div class="field">
<div class="label">Telefon:</div>
<div class="value">' . $data['phone'] . '</div>
</div>';
}
if (!empty($data['company'])) {
$html .= '
<div class="field">
<div class="label">Unternehmen:</div>
<div class="value">' . $data['company'] . '</div>
</div>';
}
$html .= '
<div class="field">
<div class="label">Nachricht:</div>
<div class="message">' . nl2br($data['message']) . '</div>
</div>
<div class="field">
<div class="label">Newsletter-Anmeldung:</div>
<div class="value">' . (!empty($data['newsletter']) ? 'Ja' : 'Nein') . '</div>
</div>
<div class="field">
<div class="label">IP-Adresse:</div>
<div class="value">' . $_SERVER['REMOTE_ADDR'] . '</div>
</div>
<div class="field">
<div class="label">Zeitstempel:</div>
<div class="value">' . date('d.m.Y H:i:s') . '</div>
</div>
</div>
<div class="footer">
<p>Diese E-Mail wurde automatisch vom HexaHost.de Kontaktformular generiert.</p>
<p>© 2024 HexaHost.de - Alle Rechte vorbehalten</p>
</div>
</div>
</body>
</html>';
return $html;
}
// 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';
$text = "NEUE KONTAKTANFRAGE - HexaHost.de\n";
$text .= "=====================================\n\n";
$text .= "Betreff: " . $subject_text . "\n";
$text .= "Name: " . $data['firstName'] . " " . $data['lastName'] . "\n";
$text .= "E-Mail: " . $data['email'] . "\n";
if (!empty($data['phone'])) {
$text .= "Telefon: " . $data['phone'] . "\n";
}
if (!empty($data['company'])) {
$text .= "Unternehmen: " . $data['company'] . "\n";
}
$text .= "\nNachricht:\n";
$text .= "----------\n";
$text .= $data['message'] . "\n\n";
$text .= "Newsletter-Anmeldung: " . (!empty($data['newsletter']) ? "Ja" : "Nein") . "\n";
$text .= "IP-Adresse: " . $_SERVER['REMOTE_ADDR'] . "\n";
$text .= "Zeitstempel: " . date('d.m.Y H:i:s') . "\n\n";
$text .= "---\n";
$text .= "Diese E-Mail wurde automatisch vom HexaHost.de Kontaktformular generiert.\n";
$text .= "© 2024 HexaHost.de - Alle Rechte vorbehalten";
return $text;
}
// Hauptverarbeitung
try {
// Rate Limiting Check
$client_ip = $_SERVER['REMOTE_ADDR'];
if (!checkRateLimit($client_ip)) {
http_response_code(429);
echo json_encode([
'success' => false,
'message' => 'Zu viele Anfragen. Bitte versuchen Sie es später erneut.'
]);
exit;
}
// Honeypot Check
if (!checkHoneypot($_POST)) {
http_response_code(400);
echo json_encode([
'success' => false,
'message' => 'Ungültige Anfrage.'
]);
exit;
}
// Pflichtfelder prüfen
$required_fields = ['firstName', 'lastName', 'email', 'subject', 'message', 'privacy'];
$missing_fields = [];
foreach ($required_fields as $field) {
if (empty($_POST[$field])) {
$missing_fields[] = $field;
}
}
if (!empty($missing_fields)) {
http_response_code(400);
echo json_encode([
'success' => false,
'message' => 'Bitte füllen Sie alle Pflichtfelder aus.',
'missing_fields' => $missing_fields
]);
exit;
}
// E-Mail-Validierung
if (!validateEmail($_POST['email'])) {
http_response_code(400);
echo json_encode([
'success' => false,
'message' => 'Bitte geben Sie eine gültige E-Mail-Adresse ein.'
]);
exit;
}
// Daten sanitieren
$data = [
'firstName' => sanitizeInput($_POST['firstName']),
'lastName' => sanitizeInput($_POST['lastName']),
'email' => sanitizeInput($_POST['email']),
'phone' => sanitizeInput($_POST['phone'] ?? ''),
'company' => sanitizeInput($_POST['company'] ?? ''),
'subject' => sanitizeInput($_POST['subject']),
'message' => sanitizeInput($_POST['message']),
'newsletter' => isset($_POST['newsletter']) ? true : false,
'privacy' => isset($_POST['privacy']) ? true : false
];
// E-Mail senden
if (sendEmail($data)) {
echo json_encode([
'success' => true,
'message' => 'Ihre Nachricht wurde erfolgreich gesendet! Wir melden uns in Kürze bei Ihnen.'
]);
} else {
http_response_code(500);
echo json_encode([
'success' => false,
'message' => 'Beim Senden der Nachricht ist ein Fehler aufgetreten. Bitte versuchen Sie es später erneut.'
]);
}
} catch (Exception $e) {
error_log('HexaHost Contact Form Error: ' . $e->getMessage());
http_response_code(500);
echo json_encode([
'success' => false,
'message' => 'Ein unerwarteter Fehler ist aufgetreten. Bitte versuchen Sie es später erneut.'
]);
}
?>

View File

@@ -97,11 +97,11 @@
<path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"/>
</svg>
</div>
<h3>Live Chat</h3>
<p>Direkter Support über unseren Live Chat für schnelle Hilfe.</p>
<button class="contact-link chat-btn" onclick="openLiveChat()">Chat starten</button>
<p class="contact-hours">Mo-Fr: 9:00-18:00 Uhr</p>
<h3>Discord</h3>
<p>Direkter Support über unseren Discord für schnelle Hilfe.</p>
<button class="contact-link chat-btn" onclick="window.open('https://discord.gg/DEIN-EINLADUNGS-LINK', '_blank')">Discord beitreten</button>
</div>
<div class="contact-item glass-card">
<div class="contact-icon">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
@@ -174,17 +174,15 @@
<div class="form-group checkbox-group">
<label class="checkbox-label">
<input type="checkbox" id="privacy" name="privacy" required>
<span class="checkmark"></span>
Ich habe die <a href="#" target="_blank">Datenschutzerklärung</a> gelesen und stimme der Verarbeitung meiner Daten zu. *
</label>
</div>
<div class="form-group checkbox-group">
<!-- <div class="form-group checkbox-group">
<label class="checkbox-label">
<input type="checkbox" id="newsletter" name="newsletter">
<span class="checkmark"></span>
Ich möchte den HexaHost.de Newsletter mit Informationen zu neuen Produkten und Angeboten erhalten.
</label>
</div>
</div> -->
<div class="form-actions">
<button type="submit" class="btn btn-primary">Nachricht senden</button>
<button type="reset" class="btn btn-secondary">Formular zurücksetzen</button>