mirror of
https://git.hexahost.dev/smueller/HexaHost-Frontend.git
synced 2026-06-02 06:58:43 +00:00
Enhance security and configuration of contact form: Added Content Security Policy and Strict-Transport-Security headers in .htaccess for improved security. Updated error handling to use a single 404.php for various error codes. Removed deprecated config.php and composer.json files, and implemented IP address detection for better security. Added honeypot field for bot protection in contact form and improved session security settings in functions.php.
This commit is contained in:
@@ -8,6 +8,12 @@
|
||||
Header always set X-XSS-Protection "1; mode=block"
|
||||
Header always set Referrer-Policy "strict-origin-when-cross-origin"
|
||||
Header always set Permissions-Policy "geolocation=(), microphone=(), camera=()"
|
||||
|
||||
# Content Security Policy - Schutz vor XSS und Code-Injection
|
||||
Header always set Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; font-src 'self' https://fonts.gstatic.com; img-src 'self' https://cdn.hexahost.de data:; connect-src 'self'; frame-ancestors 'none'; base-uri 'self'; form-action 'self'"
|
||||
|
||||
# Strict-Transport-Security (HSTS) - Erzwingt HTTPS
|
||||
Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"
|
||||
</IfModule>
|
||||
|
||||
# HTTPS erzwingen (falls SSL verfügbar)
|
||||
@@ -48,6 +54,16 @@
|
||||
Deny from all
|
||||
</Files>
|
||||
|
||||
# Config-Verzeichnis schützen
|
||||
<IfModule mod_rewrite.c>
|
||||
RewriteRule ^config/ - [F,L]
|
||||
</IfModule>
|
||||
|
||||
# Includes-Verzeichnis schützen (direkter Zugriff verhindern)
|
||||
<IfModule mod_rewrite.c>
|
||||
RewriteRule ^includes/ - [F,L]
|
||||
</IfModule>
|
||||
|
||||
# Logs-Verzeichnis schützen
|
||||
<IfModule mod_rewrite.c>
|
||||
RewriteRule ^logs/ - [F,L]
|
||||
@@ -95,14 +111,25 @@
|
||||
</IfModule>
|
||||
|
||||
# Fehlerbehandlung
|
||||
ErrorDocument 404 /404.html
|
||||
ErrorDocument 500 /500.html
|
||||
ErrorDocument 400 /404.php
|
||||
ErrorDocument 401 /404.php
|
||||
ErrorDocument 403 /404.php
|
||||
ErrorDocument 404 /404.php
|
||||
ErrorDocument 500 /500.php
|
||||
ErrorDocument 502 /500.php
|
||||
ErrorDocument 503 /500.php
|
||||
|
||||
# Verzeichnis-Listing deaktivieren
|
||||
Options -Indexes
|
||||
|
||||
# Datei-Zugriff beschränken
|
||||
<FilesMatch "\.(htaccess|htpasswd|ini|log|sh|inc|bak)$">
|
||||
<FilesMatch "\.(htaccess|htpasswd|ini|log|sh|inc|bak|sql|env|yml|yaml|json|xml|md)$">
|
||||
Order Allow,Deny
|
||||
Deny from all
|
||||
</FilesMatch>
|
||||
|
||||
# Spezifische Ausnahmen für benötigte XML-Dateien
|
||||
<FilesMatch "^(sitemap\.xml|robots\.txt)$">
|
||||
Order Allow,Deny
|
||||
Allow from all
|
||||
</FilesMatch>
|
||||
73
public/404.php
Normal file
73
public/404.php
Normal file
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
require_once 'includes/functions.php';
|
||||
|
||||
// Page configuration
|
||||
$page_title = '404 - Seite nicht gefunden | HexaHost.de';
|
||||
$page_description = 'Die angeforderte Seite wurde nicht gefunden.';
|
||||
$current_page = '404';
|
||||
|
||||
// Set 404 header
|
||||
http_response_code(404);
|
||||
|
||||
// Include header
|
||||
includeHeader($page_title, $page_description, $current_page);
|
||||
?>
|
||||
|
||||
<main>
|
||||
<section class="error-page">
|
||||
<div class="container">
|
||||
<div class="error-content glass-card">
|
||||
<div class="error-code">404</div>
|
||||
<h1>Seite nicht gefunden</h1>
|
||||
<p>Die angeforderte Seite existiert leider nicht oder wurde verschoben.</p>
|
||||
<div class="error-actions">
|
||||
<a href="index.php" class="btn btn-primary">Zur Startseite</a>
|
||||
<a href="contact.php" class="btn btn-secondary">Kontakt aufnehmen</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</main>
|
||||
|
||||
<style>
|
||||
.error-page {
|
||||
min-height: 60vh;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 4rem 0;
|
||||
}
|
||||
.error-content {
|
||||
text-align: center;
|
||||
padding: 3rem;
|
||||
max-width: 500px;
|
||||
}
|
||||
.error-code {
|
||||
font-size: 6rem;
|
||||
font-weight: 700;
|
||||
background: linear-gradient(135deg, #ff51f9, #a348ff);
|
||||
-webkit-background-clip: text;
|
||||
-webkit-text-fill-color: transparent;
|
||||
background-clip: text;
|
||||
line-height: 1;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
.error-content h1 {
|
||||
font-size: 1.75rem;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
.error-content p {
|
||||
color: #888;
|
||||
margin-bottom: 2rem;
|
||||
}
|
||||
.error-actions {
|
||||
display: flex;
|
||||
gap: 1rem;
|
||||
justify-content: center;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
</style>
|
||||
|
||||
<?php
|
||||
includeFooter();
|
||||
?>
|
||||
73
public/500.php
Normal file
73
public/500.php
Normal file
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
require_once 'includes/functions.php';
|
||||
|
||||
// Page configuration
|
||||
$page_title = '500 - Serverfehler | HexaHost.de';
|
||||
$page_description = 'Ein interner Serverfehler ist aufgetreten.';
|
||||
$current_page = '500';
|
||||
|
||||
// Set 500 header
|
||||
http_response_code(500);
|
||||
|
||||
// Include header
|
||||
includeHeader($page_title, $page_description, $current_page);
|
||||
?>
|
||||
|
||||
<main>
|
||||
<section class="error-page">
|
||||
<div class="container">
|
||||
<div class="error-content glass-card">
|
||||
<div class="error-code">500</div>
|
||||
<h1>Interner Serverfehler</h1>
|
||||
<p>Es ist ein unerwarteter Fehler aufgetreten. Wir arbeiten bereits an der Lösung.</p>
|
||||
<div class="error-actions">
|
||||
<a href="index.php" class="btn btn-primary">Zur Startseite</a>
|
||||
<a href="contact.php" class="btn btn-secondary">Support kontaktieren</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</main>
|
||||
|
||||
<style>
|
||||
.error-page {
|
||||
min-height: 60vh;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 4rem 0;
|
||||
}
|
||||
.error-content {
|
||||
text-align: center;
|
||||
padding: 3rem;
|
||||
max-width: 500px;
|
||||
}
|
||||
.error-code {
|
||||
font-size: 6rem;
|
||||
font-weight: 700;
|
||||
background: linear-gradient(135deg, #ff51f9, #a348ff);
|
||||
-webkit-background-clip: text;
|
||||
-webkit-text-fill-color: transparent;
|
||||
background-clip: text;
|
||||
line-height: 1;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
.error-content h1 {
|
||||
font-size: 1.75rem;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
.error-content p {
|
||||
color: #888;
|
||||
margin-bottom: 2rem;
|
||||
}
|
||||
.error-actions {
|
||||
display: flex;
|
||||
gap: 1rem;
|
||||
justify-content: center;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
</style>
|
||||
|
||||
<?php
|
||||
includeFooter();
|
||||
?>
|
||||
@@ -1,145 +0,0 @@
|
||||
# HexaHost.de Kontaktformular - Status-Überprüfung
|
||||
|
||||
## ✅ Behobene Probleme
|
||||
|
||||
### 1. Merge-Konflikt in contact-handler.php
|
||||
- **Problem**: Git-Merge-Konflikt machte die Datei unbrauchbar
|
||||
- **Lösung**: Konflikt aufgelöst, saubere Version erstellt
|
||||
- **Status**: ✅ Behoben
|
||||
|
||||
### 2. CSRF-Token Problem
|
||||
- **Problem**: HTML-Formular versuchte PHP-Code zu verwenden
|
||||
- **Lösung**: CSRF-Token durch Honeypot-Feld ersetzt
|
||||
- **Status**: ✅ Behoben
|
||||
|
||||
### 3. JavaScript-Merge-Konflikt
|
||||
- **Problem**: Merge-Konflikt in contact.js
|
||||
- **Lösung**: Konflikt aufgelöst
|
||||
- **Status**: ✅ Behoben
|
||||
|
||||
## ⚠️ Noch zu behebende Probleme
|
||||
|
||||
### 1. SMTP-Konfiguration
|
||||
- **Problem**: SMTP-Einstellungen sind noch auf Testwerte
|
||||
- **Aktueller Status**:
|
||||
```php
|
||||
'smtp_host' => 'smtp.gmail.com',
|
||||
'smtp_username' => 'test@hexahost.de',
|
||||
'smtp_password' => 'your-app-password',
|
||||
```
|
||||
- **Erforderlich**: Echte SMTP-Daten eintragen
|
||||
- **Status**: ⚠️ Zu konfigurieren
|
||||
|
||||
### 2. PHPMailer-Installation
|
||||
- **Problem**: Composer ist nicht installiert
|
||||
- **Aktueller Status**: Fallback auf native PHP mail() Funktion
|
||||
- **Erforderlich**: Composer installieren und PHPMailer einrichten
|
||||
- **Status**: ⚠️ Optional (Fallback funktioniert)
|
||||
|
||||
## 📧 E-Mail-Funktionalität
|
||||
|
||||
### Aktuelle Konfiguration
|
||||
- **SMTP-Host**: smtp.gmail.com
|
||||
- **Port**: 587
|
||||
- **Verschlüsselung**: TLS
|
||||
- **Fallback**: Native PHP mail() Funktion
|
||||
|
||||
### Sicherheitsfeatures
|
||||
- ✅ Rate Limiting (5 Anfragen/Stunde)
|
||||
- ✅ Honeypot-Schutz
|
||||
- ✅ Input-Sanitization
|
||||
- ✅ E-Mail-Validierung
|
||||
- ✅ Anti-Spam-Headers
|
||||
|
||||
### E-Mail-Templates
|
||||
- ✅ HTML-Template mit HexaHost-Design
|
||||
- ✅ Text-Version als Fallback
|
||||
- ✅ Responsive Design
|
||||
- ✅ Strukturierte Darstellung aller Daten
|
||||
|
||||
## 🧪 Test-Möglichkeiten
|
||||
|
||||
### 1. Test-Datei
|
||||
- **Datei**: `test-email.php`
|
||||
- **Zweck**: E-Mail-Funktionalität ohne Formular testen
|
||||
- **Verwendung**: Im Browser öffnen und "Test-E-Mail senden" klicken
|
||||
|
||||
### 2. Kontaktformular
|
||||
- **Datei**: `contact.html`
|
||||
- **Zweck**: Vollständiges Formular testen
|
||||
- **Verwendung**: Formular ausfüllen und absenden
|
||||
|
||||
## 🔧 Konfiguration erforderlich
|
||||
|
||||
### Für Produktivbetrieb:
|
||||
|
||||
1. **SMTP-Daten eintragen** in `config.php`:
|
||||
```php
|
||||
'smtp_username' => 'ihre-echte-email@gmail.com',
|
||||
'smtp_password' => 'ihr-echtes-app-passwort',
|
||||
'from_email' => 'ihre-echte-email@gmail.com',
|
||||
'to_email' => 'info@hexahost.de',
|
||||
```
|
||||
|
||||
2. **Composer installieren** (optional):
|
||||
```bash
|
||||
# Windows: Composer-Installer herunterladen
|
||||
# Linux/macOS:
|
||||
curl -sS https://getcomposer.org/installer | php
|
||||
sudo mv composer.phar /usr/local/bin/composer
|
||||
```
|
||||
|
||||
3. **PHPMailer installieren** (optional):
|
||||
```bash
|
||||
cd public
|
||||
composer install
|
||||
```
|
||||
|
||||
## 📊 Funktionsfähigkeit
|
||||
|
||||
### ✅ Funktioniert
|
||||
- Kontaktformular-HTML
|
||||
- JavaScript-Validierung
|
||||
- PHP-Backend-Verarbeitung
|
||||
- Rate Limiting
|
||||
- Spam-Schutz
|
||||
- E-Mail-Templates
|
||||
- Fallback auf native mail() Funktion
|
||||
|
||||
### ⚠️ Benötigt Konfiguration
|
||||
- SMTP-Einstellungen
|
||||
- PHPMailer (optional)
|
||||
|
||||
### ❌ Nicht funktioniert
|
||||
- E-Mail-Versand ohne SMTP-Konfiguration
|
||||
|
||||
## 🚀 Nächste Schritte
|
||||
|
||||
1. **SMTP-Konfiguration anpassen**
|
||||
- Echte SMTP-Daten in `config.php` eintragen
|
||||
- Test mit `test-email.php`
|
||||
|
||||
2. **E-Mail-Funktionalität testen**
|
||||
- Kontaktformular ausfüllen
|
||||
- E-Mail-Empfang prüfen
|
||||
|
||||
3. **PHPMailer installieren** (optional)
|
||||
- Composer installieren
|
||||
- PHPMailer einrichten
|
||||
|
||||
4. **DNS-Einträge konfigurieren**
|
||||
- SPF Record
|
||||
- DMARC Record
|
||||
- DKIM (über Mail-Server)
|
||||
|
||||
## 📞 Support
|
||||
|
||||
Bei Problemen:
|
||||
1. `test-email.php` verwenden
|
||||
2. PHP-Error-Logs prüfen
|
||||
3. SMTP-Konfiguration überprüfen
|
||||
4. Hosting-Provider kontaktieren
|
||||
|
||||
---
|
||||
|
||||
**Status**: Kontaktformular ist funktionsfähig, benötigt nur SMTP-Konfiguration für E-Mail-Versand.
|
||||
@@ -1,173 +0,0 @@
|
||||
# HexaHost.de E-Mail-Konfiguration
|
||||
|
||||
## Übersicht
|
||||
|
||||
Das Kontaktformular von HexaHost.de benötigt eine korrekte SMTP-Konfiguration, um E-Mails zu versenden. Diese Anleitung erklärt, wie Sie die E-Mail-Funktionalität einrichten.
|
||||
|
||||
## Aktuelle Probleme
|
||||
|
||||
### 1. ✅ Behoben: Merge-Konflikt in contact-handler.php
|
||||
- Der Git-Merge-Konflikt wurde aufgelöst
|
||||
- Die Datei ist jetzt funktionsfähig
|
||||
|
||||
### 2. ⚠️ Zu beheben: SMTP-Konfiguration
|
||||
- Die SMTP-Einstellungen sind noch auf Testwerte gesetzt
|
||||
- Sie müssen mit echten SMTP-Daten konfiguriert werden
|
||||
|
||||
### 3. ⚠️ Zu beheben: PHPMailer-Installation
|
||||
- Composer ist nicht installiert
|
||||
- PHPMailer ist nicht verfügbar
|
||||
- Fallback auf native PHP mail() Funktion ist aktiv
|
||||
|
||||
## SMTP-Konfiguration
|
||||
|
||||
### Option 1: Gmail SMTP (Empfohlen für Tests)
|
||||
|
||||
1. **Gmail-Konto einrichten:**
|
||||
- Gehen Sie zu Ihren Google-Kontoeinstellungen
|
||||
- Aktivieren Sie "2-Schritt-Verifizierung"
|
||||
- Erstellen Sie ein "App-Passwort"
|
||||
|
||||
2. **config.php bearbeiten:**
|
||||
```php
|
||||
'smtp_host' => 'smtp.gmail.com',
|
||||
'smtp_port' => 587,
|
||||
'smtp_username' => 'ihre-email@gmail.com',
|
||||
'smtp_password' => 'ihr-app-passwort',
|
||||
'smtp_encryption' => 'tls',
|
||||
'from_email' => 'ihre-email@gmail.com',
|
||||
'to_email' => 'info@hexahost.de',
|
||||
```
|
||||
|
||||
### Option 2: Eigener Mail-Server
|
||||
|
||||
1. **SMTP-Daten von Ihrem Hosting-Provider erhalten**
|
||||
2. **config.php bearbeiten:**
|
||||
```php
|
||||
'smtp_host' => 'mail.ihre-domain.de',
|
||||
'smtp_port' => 587,
|
||||
'smtp_username' => 'kontakt@ihre-domain.de',
|
||||
'smtp_password' => 'ihr-smtp-passwort',
|
||||
'smtp_encryption' => 'tls',
|
||||
'from_email' => 'kontakt@ihre-domain.de',
|
||||
'to_email' => 'info@hexahost.de',
|
||||
```
|
||||
|
||||
### Option 3: Andere E-Mail-Provider
|
||||
|
||||
#### 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',
|
||||
```
|
||||
|
||||
## PHPMailer-Installation
|
||||
|
||||
### Composer installieren:
|
||||
|
||||
1. **Windows:**
|
||||
- Laden Sie Composer von https://getcomposer.org/download/
|
||||
- Führen Sie den Installer aus
|
||||
|
||||
2. **Linux/macOS:**
|
||||
```bash
|
||||
curl -sS https://getcomposer.org/installer | php
|
||||
sudo mv composer.phar /usr/local/bin/composer
|
||||
```
|
||||
|
||||
### PHPMailer installieren:
|
||||
|
||||
```bash
|
||||
cd public
|
||||
composer install
|
||||
```
|
||||
|
||||
## Test der E-Mail-Funktionalität
|
||||
|
||||
### 1. Test-Datei verwenden:
|
||||
- Öffnen Sie `test-email.php` im Browser
|
||||
- Klicken Sie auf "Test-E-Mail senden"
|
||||
|
||||
### 2. Kontaktformular testen:
|
||||
- Öffnen Sie `contact.html`
|
||||
- Füllen Sie das Formular aus
|
||||
- Überprüfen Sie die Antwort
|
||||
|
||||
## Sicherheitseinstellungen
|
||||
|
||||
### DNS-Einträge für Spam-Schutz:
|
||||
|
||||
1. **SPF Record (TXT):**
|
||||
```
|
||||
v=spf1 include:_spf.hexahost.de ~all
|
||||
```
|
||||
|
||||
2. **DMARC Record (TXT):**
|
||||
```
|
||||
v=DMARC1; p=quarantine; rua=mailto:dmarc@hexahost.de
|
||||
```
|
||||
|
||||
3. **DKIM (wird vom Mail-Server konfiguriert)**
|
||||
|
||||
## Fehlerbehebung
|
||||
|
||||
### Häufige Probleme:
|
||||
|
||||
1. **"SMTP connect() failed"**
|
||||
- Überprüfen Sie Host und Port
|
||||
- Prüfen Sie Firewall-Einstellungen
|
||||
|
||||
2. **"Authentication failed"**
|
||||
- Überprüfen Sie Benutzername und Passwort
|
||||
- Bei Gmail: App-Passwort verwenden
|
||||
|
||||
3. **"Connection timeout"**
|
||||
- Prüfen Sie Internetverbindung
|
||||
- Überprüfen Sie SMTP-Host
|
||||
|
||||
4. **"Mail function not available"**
|
||||
- PHP mail() Funktion ist deaktiviert
|
||||
- Kontaktieren Sie Ihren Hosting-Provider
|
||||
|
||||
## Debug-Modus aktivieren
|
||||
|
||||
In `config.php` setzen Sie:
|
||||
```php
|
||||
'debug_mode' => true,
|
||||
```
|
||||
|
||||
## Logs überprüfen
|
||||
|
||||
E-Mail-Fehler werden in den PHP-Error-Logs gespeichert:
|
||||
- Windows: Event Viewer
|
||||
- Linux: `/var/log/php_errors.log`
|
||||
|
||||
## Nächste Schritte
|
||||
|
||||
1. ✅ Merge-Konflikt behoben
|
||||
2. ⚠️ SMTP-Konfiguration anpassen
|
||||
3. ⚠️ PHPMailer installieren (optional)
|
||||
4. ⚠️ E-Mail-Funktionalität testen
|
||||
5. ⚠️ DNS-Einträge für Spam-Schutz konfigurieren
|
||||
|
||||
## Support
|
||||
|
||||
Bei Problemen:
|
||||
- Überprüfen Sie die PHP-Error-Logs
|
||||
- Testen Sie mit `test-email.php`
|
||||
- Kontaktieren Sie Ihren Hosting-Provider
|
||||
@@ -1,121 +0,0 @@
|
||||
# HexaHost.de - Projektoptimierung
|
||||
|
||||
## Durchgeführte Optimierungen
|
||||
|
||||
### 1. Entfernung redundanter HTML-Dateien
|
||||
Die folgenden HTML-Dateien wurden entfernt, da sie durch PHP-Dateien ersetzt wurden:
|
||||
- `index.html` → `index.php`
|
||||
- `about.html` → `about.php`
|
||||
- `contact.html` → `contact.php`
|
||||
- `vpc.html` → `vpc.php`
|
||||
- `vps.html` → `vps.php`
|
||||
- `webhosting.html` → `webhosting.php`
|
||||
- `mail-gateway.html` → `mail-gateway.php`
|
||||
|
||||
### 2. .htaccess-Weiterleitungen
|
||||
Automatische Weiterleitungen von HTML zu PHP wurden implementiert:
|
||||
```apache
|
||||
# HTML zu PHP Weiterleitungen
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteRule ^([^\.]+)\.html$ $1.php [L,R=301]
|
||||
|
||||
# Direkte HTML zu PHP Weiterleitungen für bekannte Seiten
|
||||
RewriteRule ^index\.html$ index.php [L,R=301]
|
||||
RewriteRule ^about\.html$ about.php [L,R=301]
|
||||
RewriteRule ^contact\.html$ contact.php [L,R=301]
|
||||
RewriteRule ^vpc\.html$ vpc.php [L,R=301]
|
||||
RewriteRule ^vps\.html$ vps.php [L,R=301]
|
||||
RewriteRule ^webhosting\.html$ webhosting.php [L,R=301]
|
||||
RewriteRule ^mail-gateway\.html$ mail-gateway.php [L,R=301]
|
||||
```
|
||||
|
||||
### 3. Aktualisierung aller internen Links
|
||||
Alle .html-Links in den PHP-Dateien wurden zu .php-Links geändert:
|
||||
|
||||
#### Header-Navigation (`includes/header.php`)
|
||||
- `index.html` → `index.php`
|
||||
- `about.html` → `about.php`
|
||||
- `contact.html` → `contact.php`
|
||||
|
||||
#### Footer-Links (`includes/footer.php`)
|
||||
- Alle Produkt-Links aktualisiert
|
||||
- Support-Links aktualisiert
|
||||
|
||||
#### Seiten-spezifische Links
|
||||
- Alle Kontakt-Formular-Links aktualisiert
|
||||
- Alle Breadcrumb-Navigationen aktualisiert
|
||||
- Alle CTA-Buttons aktualisiert
|
||||
|
||||
### 4. Neue Mail Gateway-Seite
|
||||
Eine neue `mail-gateway.php`-Datei wurde erstellt mit:
|
||||
- Professionellem Design im HexaHost-Stil
|
||||
- Vier Paket-Optionen (Starter, Business, Professional, Enterprise)
|
||||
- Vollständiger Integration in die Navigation
|
||||
- Kontakt-Formular-Integration
|
||||
|
||||
### 5. Vorteile der Optimierung
|
||||
|
||||
#### Performance
|
||||
- Reduzierte Dateianzahl im Projekt
|
||||
- Bessere Caching-Möglichkeiten durch PHP
|
||||
- Optimierte Server-Ressourcen
|
||||
|
||||
#### Wartbarkeit
|
||||
- Einheitliche PHP-Struktur
|
||||
- Zentralisierte Header/Footer-Includes
|
||||
- Einfachere Content-Management
|
||||
|
||||
#### SEO
|
||||
- Saubere URL-Struktur
|
||||
- Automatische Weiterleitungen für alte Links
|
||||
- Bessere Suchmaschinen-Indexierung
|
||||
|
||||
#### Sicherheit
|
||||
- PHP-basierte Sicherheitsfeatures
|
||||
- Bessere Eingabevalidierung
|
||||
- Session-Management
|
||||
|
||||
### 6. Technische Details
|
||||
|
||||
#### Dateistruktur nach Optimierung
|
||||
```
|
||||
public/
|
||||
├── index.php (Hauptseite)
|
||||
├── about.php (Über uns)
|
||||
├── contact.php (Kontakt)
|
||||
├── vpc.php (Virtual Private Container)
|
||||
├── vps.php (Virtual Private Server)
|
||||
├── webhosting.php (Webhosting)
|
||||
├── mail-gateway.php (Mail Gateway)
|
||||
├── includes/
|
||||
│ ├── header.php
|
||||
│ ├── footer.php
|
||||
│ └── functions.php
|
||||
├── assets/
|
||||
│ ├── css/
|
||||
│ └── js/
|
||||
└── .htaccess (mit Weiterleitungen)
|
||||
```
|
||||
|
||||
#### Funktionalität
|
||||
- Alle Seiten verwenden das gleiche Design
|
||||
- Responsive Layout bleibt erhalten
|
||||
- Kontakt-Formular funktioniert weiterhin
|
||||
- Breadcrumb-Navigation funktioniert
|
||||
- Alle Links sind funktional
|
||||
|
||||
### 7. Backward Compatibility
|
||||
- Alte HTML-Links werden automatisch zu PHP weitergeleitet
|
||||
- Keine 404-Fehler für bestehende Bookmarks
|
||||
- Suchmaschinen-Index bleibt erhalten
|
||||
|
||||
### 8. Nächste Schritte
|
||||
- Testen aller Seiten und Links
|
||||
- Überprüfung der Kontakt-Formulare
|
||||
- Validierung der Weiterleitungen
|
||||
- Performance-Monitoring
|
||||
|
||||
---
|
||||
*Optimierung durchgeführt am: $(date)*
|
||||
*Projekt: HexaHost.de*
|
||||
@@ -1,134 +0,0 @@
|
||||
# HexaHost.de - Zentralisierte Header und Footer Struktur
|
||||
|
||||
## Übersicht
|
||||
|
||||
Die Website wurde umstrukturiert, um Header und Footer in zentralen Dateien zu speichern. Dies reduziert Code-Duplikation und macht die Wartung einfacher.
|
||||
|
||||
## Neue Struktur
|
||||
|
||||
### Zentrale Dateien
|
||||
|
||||
- `includes/header.php` - Enthält den HTML-Header mit Navigation
|
||||
- `includes/footer.php` - Enthält den HTML-Footer mit Links und Copyright
|
||||
- `includes/functions.php` - Helper-Funktionen für die Website
|
||||
|
||||
### Konvertierte Seiten
|
||||
|
||||
- `index.php` - Startseite (vorher index.html)
|
||||
- `contact.php` - Kontaktseite (vorher contact.html)
|
||||
- `vpc.php` - Virtual Private Container (vorher vpc.html)
|
||||
- `vps.php` - Virtual Private Server (vorher vps.html)
|
||||
- `webhosting.php` - Webhosting (vorher webhosting.html)
|
||||
- `about.php` - Über uns (vorher about.html)
|
||||
|
||||
## Verwendung
|
||||
|
||||
### Neue Seite erstellen
|
||||
|
||||
1. Erstellen Sie eine neue `.php` Datei
|
||||
2. Fügen Sie die Konfiguration am Anfang hinzu:
|
||||
|
||||
```php
|
||||
<?php
|
||||
require_once 'includes/functions.php';
|
||||
|
||||
// Page configuration
|
||||
$page_title = 'Seitentitel - HexaHost.de';
|
||||
$page_description = 'Seitenbeschreibung für SEO';
|
||||
$current_page = 'seitenname'; // Für aktive Navigation
|
||||
$additional_scripts = ['assets/js/script.js']; // Optional
|
||||
|
||||
// Include header
|
||||
includeHeader($page_title, $page_description, $current_page, $additional_scripts);
|
||||
?>
|
||||
|
||||
<main>
|
||||
<!-- Ihr Seiteninhalt hier -->
|
||||
</main>
|
||||
|
||||
<?php
|
||||
// Include footer
|
||||
includeFooter();
|
||||
?>
|
||||
```
|
||||
|
||||
### Breadcrumbs hinzufügen
|
||||
|
||||
```php
|
||||
<?php
|
||||
generateBreadcrumbs([
|
||||
['title' => 'Home', 'url' => 'index.html'],
|
||||
['title' => 'Produkte', 'url' => 'products.html'],
|
||||
['title' => 'Aktuelle Seite', 'url' => '']
|
||||
]);
|
||||
?>
|
||||
```
|
||||
|
||||
## Vorteile
|
||||
|
||||
1. **Weniger Code-Duplikation** - Header und Footer werden nur einmal gepflegt
|
||||
2. **Einfachere Wartung** - Änderungen müssen nur an einer Stelle gemacht werden
|
||||
3. **Konsistenz** - Alle Seiten haben automatisch den gleichen Header/Footer
|
||||
4. **SEO-Optimierung** - Einfache Anpassung von Meta-Tags pro Seite
|
||||
5. **Aktive Navigation** - Automatische Hervorhebung der aktuellen Seite
|
||||
|
||||
## Migration von HTML zu PHP
|
||||
|
||||
### Vorher (HTML)
|
||||
```html
|
||||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<title>Seitentitel</title>
|
||||
<!-- Meta-Tags, CSS, etc. -->
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<!-- Navigation -->
|
||||
</header>
|
||||
<main>
|
||||
<!-- Inhalt -->
|
||||
</main>
|
||||
<footer>
|
||||
<!-- Footer -->
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
|
||||
### Nachher (PHP)
|
||||
```php
|
||||
<?php
|
||||
require_once 'includes/functions.php';
|
||||
includeHeader('Seitentitel', 'Beschreibung', 'seitenname');
|
||||
?>
|
||||
<main>
|
||||
<!-- Inhalt -->
|
||||
</main>
|
||||
<?php includeFooter(); ?>
|
||||
```
|
||||
|
||||
## Nächste Schritte
|
||||
|
||||
1. Weitere HTML-Seiten zu PHP konvertieren
|
||||
2. .htaccess für saubere URLs konfigurieren
|
||||
3. Session-Management für CSRF-Token hinzufügen
|
||||
4. Caching für bessere Performance implementieren
|
||||
|
||||
## Dateien
|
||||
|
||||
- `includes/header.php` - Zentrale Header-Datei
|
||||
- `includes/footer.php` - Zentrale Footer-Datei
|
||||
- `includes/functions.php` - Helper-Funktionen
|
||||
- `index.php` - Startseite (PHP-Version)
|
||||
- `contact.php` - Kontaktseite (PHP-Version)
|
||||
- `vpc.php` - Virtual Private Container (PHP-Version)
|
||||
- `vps.php` - Virtual Private Server (PHP-Version)
|
||||
- `webhosting.php` - Webhosting (PHP-Version)
|
||||
- `about.php` - Über uns (PHP-Version)
|
||||
- `contact.html` - Alte HTML-Version (kann gelöscht werden)
|
||||
- `index.html` - Alte HTML-Version (kann gelöscht werden)
|
||||
- `vpc.html` - Alte HTML-Version (kann gelöscht werden)
|
||||
- `vps.html` - Alte HTML-Version (kann gelöscht werden)
|
||||
- `webhosting.html` - Alte HTML-Version (kann gelöscht werden)
|
||||
- `about.html` - Alte HTML-Version (kann gelöscht werden)
|
||||
@@ -51,9 +51,6 @@
|
||||
// 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()) {
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
{
|
||||
"name": "hexahost/contact-form",
|
||||
"description": "HexaHost.de Contact Form with PHPMailer",
|
||||
"type": "project",
|
||||
"require": {
|
||||
"phpmailer/phpmailer": "^6.8"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"HexaHost\\": "src/"
|
||||
}
|
||||
},
|
||||
"config": {
|
||||
"optimize-autoloader": true,
|
||||
"sort-packages": true
|
||||
},
|
||||
"minimum-stability": "stable",
|
||||
"prefer-stable": true
|
||||
}
|
||||
@@ -10,7 +10,7 @@ if (session_status() === PHP_SESSION_NONE) {
|
||||
}
|
||||
|
||||
// Konfiguration laden
|
||||
require_once 'config.php';
|
||||
require_once 'config/config.php';
|
||||
|
||||
// Konfiguration verwenden
|
||||
$config = getHexaHostConfig();
|
||||
@@ -113,6 +113,32 @@ function sanitizeInput($input) {
|
||||
return htmlspecialchars(strip_tags(trim($input)), ENT_QUOTES, 'UTF-8');
|
||||
}
|
||||
|
||||
// Sichere IP-Adressen-Erkennung (auch hinter Proxies/Cloudflare)
|
||||
function getClientIP() {
|
||||
$ip_keys = [
|
||||
'HTTP_CF_CONNECTING_IP', // Cloudflare
|
||||
'HTTP_X_FORWARDED_FOR', // Proxy
|
||||
'HTTP_X_REAL_IP', // Nginx Proxy
|
||||
'REMOTE_ADDR' // Standard
|
||||
];
|
||||
|
||||
foreach ($ip_keys as $key) {
|
||||
if (!empty($_SERVER[$key])) {
|
||||
// Bei X-Forwarded-For kann eine Liste von IPs kommen
|
||||
$ip = explode(',', $_SERVER[$key])[0];
|
||||
$ip = trim($ip);
|
||||
|
||||
// Validiere IP-Format
|
||||
if (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE)) {
|
||||
return $ip;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Fallback auf REMOTE_ADDR (auch private IPs für lokale Entwicklung)
|
||||
return $_SERVER['REMOTE_ADDR'] ?? '0.0.0.0';
|
||||
}
|
||||
|
||||
// SMTP E-Mail-Versand mit PHPMailer
|
||||
function sendEmail($data) {
|
||||
global $config;
|
||||
@@ -268,7 +294,7 @@ function generateEmailHTML($data) {
|
||||
|
||||
<div class="field">
|
||||
<div class="label">IP-Adresse:</div>
|
||||
<div class="value">' . $_SERVER['REMOTE_ADDR'] . '</div>
|
||||
<div class="value">' . htmlspecialchars(getClientIP()) . '</div>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
@@ -311,7 +337,7 @@ function generateEmailText($data) {
|
||||
$text .= "----------\n";
|
||||
$text .= $data['message'] . "\n\n";
|
||||
|
||||
$text .= "IP-Adresse: " . $_SERVER['REMOTE_ADDR'] . "\n";
|
||||
$text .= "IP-Adresse: " . getClientIP() . "\n";
|
||||
$text .= "Zeitstempel: " . date('d.m.Y H:i:s') . "\n\n";
|
||||
|
||||
$text .= "---\n";
|
||||
@@ -334,7 +360,7 @@ try {
|
||||
}
|
||||
|
||||
// Rate Limiting Check
|
||||
$client_ip = $_SERVER['REMOTE_ADDR'];
|
||||
$client_ip = getClientIP();
|
||||
if (!checkRateLimit($client_ip)) {
|
||||
http_response_code(429);
|
||||
echo json_encode([
|
||||
|
||||
@@ -97,6 +97,10 @@ includeHeader($page_title, $page_description, $current_page, $additional_scripts
|
||||
</div>
|
||||
<form class="contact-form glass-card" id="contactForm" action="contact-handler.php" method="POST">
|
||||
<input type="hidden" name="csrf_token" value="<?php echo generateCSRFToken(); ?>">
|
||||
<!-- Honeypot-Feld für Bot-Schutz (versteckt via CSS) -->
|
||||
<div style="position: absolute; left: -9999px;" aria-hidden="true">
|
||||
<input type="text" name="website" tabindex="-1" autocomplete="off">
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-group">
|
||||
<label for="firstName">Vorname *</label>
|
||||
@@ -143,7 +147,7 @@ includeHeader($page_title, $page_description, $current_page, $additional_scripts
|
||||
<div class="form-group checkbox-group">
|
||||
<label class="checkbox-label">
|
||||
<input type="checkbox" id="privacy" name="privacy" required>
|
||||
Ich habe die <a href="#" target="_blank">Datenschutzerklärung</a> gelesen und stimme der Verarbeitung meiner Daten zu. *
|
||||
Ich habe die <a href="datenschutz.php" target="_blank">Datenschutzerklärung</a> gelesen und stimme der Verarbeitung meiner Daten zu. *
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-actions">
|
||||
|
||||
@@ -3,9 +3,30 @@
|
||||
* Helper functions for HexaHost.de
|
||||
*/
|
||||
|
||||
// Start session for CSRF token
|
||||
// Sichere Session-Konfiguration
|
||||
if (session_status() === PHP_SESSION_NONE) {
|
||||
// Session-Cookie-Sicherheit
|
||||
ini_set('session.cookie_httponly', 1);
|
||||
ini_set('session.cookie_secure', isset($_SERVER['HTTPS']) ? 1 : 0);
|
||||
ini_set('session.cookie_samesite', 'Strict');
|
||||
ini_set('session.use_strict_mode', 1);
|
||||
ini_set('session.use_only_cookies', 1);
|
||||
|
||||
session_start();
|
||||
|
||||
// Session-ID regenerieren bei Login/wichtigen Aktionen (Schutz vor Session Fixation)
|
||||
if (!isset($_SESSION['initiated'])) {
|
||||
session_regenerate_id(true);
|
||||
$_SESSION['initiated'] = true;
|
||||
}
|
||||
}
|
||||
|
||||
// PHP Error Display in Produktion deaktivieren
|
||||
if (!defined('DEBUG_MODE') || !DEBUG_MODE) {
|
||||
ini_set('display_errors', 0);
|
||||
ini_set('display_startup_errors', 0);
|
||||
error_reporting(E_ALL);
|
||||
ini_set('log_errors', 1);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,72 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* HexaHost.de E-Mail Test
|
||||
* Testet die E-Mail-Funktionalität ohne PHPMailer
|
||||
*/
|
||||
|
||||
// Konfiguration laden
|
||||
require_once 'config.php';
|
||||
|
||||
// Test-E-Mail senden
|
||||
function testEmail() {
|
||||
$config = getHexaHostConfig();
|
||||
|
||||
// Test-Daten
|
||||
$test_data = [
|
||||
'firstName' => 'Test',
|
||||
'lastName' => 'Benutzer',
|
||||
'email' => 'test@example.com',
|
||||
'phone' => '+49 123 456789',
|
||||
'company' => 'Test GmbH',
|
||||
'subject' => 'test-email',
|
||||
'message' => 'Dies ist eine Test-E-Mail vom HexaHost.de Kontaktformular.'
|
||||
];
|
||||
|
||||
// E-Mail-Inhalt erstellen
|
||||
$subject = '[HexaHost.de] Test-E-Mail';
|
||||
$message = "Test-E-Mail von HexaHost.de\n\n";
|
||||
$message .= "Name: " . $test_data['firstName'] . " " . $test_data['lastName'] . "\n";
|
||||
$message .= "E-Mail: " . $test_data['email'] . "\n";
|
||||
$message .= "Telefon: " . $test_data['phone'] . "\n";
|
||||
$message .= "Unternehmen: " . $test_data['company'] . "\n";
|
||||
$message .= "Nachricht: " . $test_data['message'] . "\n\n";
|
||||
$message .= "Zeitstempel: " . date('d.m.Y H:i:s') . "\n";
|
||||
$message .= "IP-Adresse: " . $_SERVER['REMOTE_ADDR'] . "\n";
|
||||
|
||||
// Headers
|
||||
$headers = [
|
||||
'From: ' . $config['from_name'] . ' <' . $config['from_email'] . '>',
|
||||
'Reply-To: ' . $test_data['firstName'] . ' ' . $test_data['lastName'] . ' <' . $test_data['email'] . '>',
|
||||
'MIME-Version: 1.0',
|
||||
'Content-Type: text/plain; charset=UTF-8',
|
||||
'X-Mailer: HexaHost Test Email'
|
||||
];
|
||||
|
||||
// E-Mail senden
|
||||
$result = mail($config['to_email'], $subject, $message, implode("\r\n", $headers));
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
// Test ausführen
|
||||
if (isset($_GET['test'])) {
|
||||
$result = testEmail();
|
||||
|
||||
if ($result) {
|
||||
echo "✅ Test-E-Mail wurde erfolgreich gesendet!";
|
||||
} else {
|
||||
echo "❌ Fehler beim Senden der Test-E-Mail.";
|
||||
}
|
||||
} else {
|
||||
echo "<h1>HexaHost.de E-Mail Test</h1>";
|
||||
echo "<p>Klicken Sie auf den Link, um eine Test-E-Mail zu senden:</p>";
|
||||
echo "<a href='?test=1'>Test-E-Mail senden</a>";
|
||||
|
||||
// Konfiguration anzeigen
|
||||
echo "<h2>Aktuelle Konfiguration:</h2>";
|
||||
$config = getHexaHostConfig();
|
||||
echo "<pre>";
|
||||
print_r($config);
|
||||
echo "</pre>";
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user