mirror of
https://git.hexahost.dev/smueller/HexaHost-Frontend.git
synced 2026-06-02 06:08:42 +00:00
Update cookie consent functionality: Enhanced the cookie consent banner by adding options for rejecting non-essential cookies and improved the styling for better user experience. Updated related JavaScript to ensure proper functionality and compliance with privacy regulations.
This commit is contained in:
171
public/config/config.php
Normal file
171
public/config/config.php
Normal 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' => 'smtp.gmail.com', // z.B. smtp.gmail.com
|
||||
'smtp_port' => 587, // 587 für TLS, 465 für SSL
|
||||
'smtp_username' => 'test@hexahost.de', // z.B. info@hexahost.de
|
||||
'smtp_password' => 'your-app-password', // Ihr SMTP-Passwort
|
||||
'smtp_encryption' => 'tls', // 'tls' oder 'ssl'
|
||||
|
||||
// Absender-Einstellungen
|
||||
'from_email' => 'test@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');
|
||||
}
|
||||
}
|
||||
?>
|
||||
155
public/config/mail-config.php
Normal file
155
public/config/mail-config.php
Normal file
@@ -0,0 +1,155 @@
|
||||
<?php
|
||||
/**
|
||||
* HexaHost.de Mail Configuration
|
||||
*
|
||||
* Bitte passen Sie die folgenden SMTP-Einstellungen an Ihre E-Mail-Provider an.
|
||||
*
|
||||
* Beispiele für gängige Provider:
|
||||
*
|
||||
* Gmail:
|
||||
* - SMTP_HOST = 'smtp.gmail.com'
|
||||
* - SMTP_PORT = 587
|
||||
* - SMTP_USERNAME = 'ihre-email@gmail.com'
|
||||
* - SMTP_PASSWORD = 'ihr-app-passwort'
|
||||
*
|
||||
* Outlook/Hotmail:
|
||||
* - SMTP_HOST = 'smtp-mail.outlook.com'
|
||||
* - SMTP_PORT = 587
|
||||
*
|
||||
* GMX:
|
||||
* - SMTP_HOST = 'mail.gmx.net'
|
||||
* - SMTP_PORT = 587
|
||||
*
|
||||
* Web.de:
|
||||
* - SMTP_HOST = 'smtp.web.de'
|
||||
* - SMTP_PORT = 587
|
||||
*
|
||||
* 1&1:
|
||||
* - SMTP_HOST = 'smtp.1und1.de'
|
||||
* - SMTP_PORT = 587
|
||||
*
|
||||
* Strato:
|
||||
* - SMTP_HOST = 'smtp.strato.de'
|
||||
* - SMTP_PORT = 587
|
||||
*
|
||||
* Ionos:
|
||||
* - SMTP_HOST = 'smtp.ionos.de'
|
||||
* - SMTP_PORT = 587
|
||||
*/
|
||||
|
||||
// SMTP Server Einstellungen
|
||||
define('SMTP_HOST', 'smtp.ihre-domain.de'); // Ihr SMTP-Server
|
||||
define('SMTP_PORT', 587); // SMTP-Port (meist 587 oder 465)
|
||||
define('SMTP_USERNAME', 'kontakt@ihre-domain.de'); // Ihr SMTP-Benutzername
|
||||
define('SMTP_PASSWORD', 'ihr-smtp-passwort'); // Ihr SMTP-Passwort
|
||||
|
||||
// E-Mail Adressen
|
||||
define('SMTP_FROM_EMAIL', 'kontakt@hexahost.de'); // Absender-E-Mail (muss zu SMTP_USERNAME passen)
|
||||
define('SMTP_TO_EMAIL', 'info@hexahost.de'); // Empfänger-E-Mail für Kontaktformular
|
||||
|
||||
// Sicherheitseinstellungen
|
||||
define('ENABLE_CSRF_PROTECTION', true); // CSRF-Schutz aktivieren
|
||||
define('ENABLE_RATE_LIMITING', true); // Rate-Limiting aktivieren
|
||||
define('MAX_REQUESTS_PER_HOUR', 10); // Max. Anfragen pro Stunde
|
||||
|
||||
// Spam-Schutz Einstellungen
|
||||
define('ENABLE_SPAM_PROTECTION', true); // Spam-Schutz aktivieren
|
||||
define('MAX_MESSAGE_LENGTH', 5000); // Max. Nachrichtenlänge
|
||||
define('MIN_MESSAGE_LENGTH', 10); // Min. Nachrichtenlänge
|
||||
|
||||
// Debug-Einstellungen (nur für Entwicklung)
|
||||
define('DEBUG_MODE', false); // Debug-Modus (true/false)
|
||||
define('LOG_EMAILS', true); // E-Mails loggen (true/false)
|
||||
|
||||
// Zusätzliche Sicherheitsheader
|
||||
define('ADDITIONAL_HEADERS', [
|
||||
'X-Mailer' => 'HexaHost.de Contact Form',
|
||||
'X-Priority' => '3',
|
||||
'X-MSMail-Priority' => 'Normal',
|
||||
'Importance' => 'Normal',
|
||||
'X-Report-Abuse' => 'Please report abuse here: abuse@hexahost.de',
|
||||
'List-Unsubscribe' => '<mailto:unsubscribe@hexahost.de>',
|
||||
'Precedence' => 'bulk'
|
||||
]);
|
||||
|
||||
// Erlaubte Domains für E-Mail-Adressen (optional)
|
||||
define('ALLOWED_EMAIL_DOMAINS', [
|
||||
// Leer lassen für alle Domains zu erlauben
|
||||
// 'gmail.com',
|
||||
// 'outlook.com',
|
||||
// 'web.de',
|
||||
// 'gmx.de'
|
||||
]);
|
||||
|
||||
// Blacklist für E-Mail-Adressen (optional)
|
||||
define('BLACKLISTED_EMAILS', [
|
||||
// 'spam@example.com',
|
||||
// 'test@test.com'
|
||||
]);
|
||||
|
||||
// Validierung der Konfiguration
|
||||
if (!defined('SMTP_HOST') || !defined('SMTP_USERNAME') || !defined('SMTP_PASSWORD')) {
|
||||
die('SMTP-Konfiguration ist unvollständig. Bitte überprüfen Sie die mail-config.php');
|
||||
}
|
||||
|
||||
// Überprüfung der E-Mail-Adressen
|
||||
if (!filter_var(SMTP_FROM_EMAIL, FILTER_VALIDATE_EMAIL)) {
|
||||
die('Ungültige SMTP_FROM_EMAIL Adresse');
|
||||
}
|
||||
|
||||
if (!filter_var(SMTP_TO_EMAIL, FILTER_VALIDATE_EMAIL)) {
|
||||
die('Ungültige SMTP_TO_EMAIL Adresse');
|
||||
}
|
||||
|
||||
// Logging-Funktion
|
||||
function logEmail($type, $data) {
|
||||
if (!LOG_EMAILS) return;
|
||||
|
||||
$logFile = __DIR__ . '/../logs/email.log';
|
||||
$logDir = dirname($logFile);
|
||||
|
||||
if (!is_dir($logDir)) {
|
||||
mkdir($logDir, 0755, true);
|
||||
}
|
||||
|
||||
$timestamp = date('Y-m-d H:i:s');
|
||||
$logEntry = "[$timestamp] $type: " . json_encode($data) . "\n";
|
||||
|
||||
file_put_contents($logFile, $logEntry, FILE_APPEND | LOCK_EX);
|
||||
}
|
||||
|
||||
// Hilfsfunktion für E-Mail-Validierung
|
||||
function isValidEmail($email) {
|
||||
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Prüfe Blacklist
|
||||
if (in_array($email, BLACKLISTED_EMAILS)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Prüfe Domain-Whitelist (falls gesetzt)
|
||||
if (!empty(ALLOWED_EMAIL_DOMAINS)) {
|
||||
$domain = substr(strrchr($email, "@"), 1);
|
||||
if (!in_array($domain, ALLOWED_EMAIL_DOMAINS)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// CSRF Token generieren
|
||||
function generateCSRFToken() {
|
||||
if (!isset($_SESSION['csrf_token'])) {
|
||||
$_SESSION['csrf_token'] = bin2hex(random_bytes(32));
|
||||
}
|
||||
return $_SESSION['csrf_token'];
|
||||
}
|
||||
|
||||
// CSRF Token validieren
|
||||
function validateCSRFToken($token) {
|
||||
return isset($_SESSION['csrf_token']) && hash_equals($_SESSION['csrf_token'], $token);
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user