Besucherzähler für SPA-Landing hinzugefügt

- api/counter.php: PHP-basierter Zähler mit Session-Tracking
- Zähler-Anzeige im Footer der Landingpage
- counter.txt in .gitignore aufgenommen

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
architeur
2025-12-29 13:47:00 +01:00
parent 3e27052cc1
commit dd230196ff
3 changed files with 53 additions and 6 deletions

33
api/counter.php Normal file
View File

@@ -0,0 +1,33 @@
<?php
/**
* Besucherzähler API für SPA-Landing
* Gibt den aktuellen Zählerstand als JSON zurück und zählt bei neuen Sessions
*/
header('Content-Type: application/json');
header('Access-Control-Allow-Origin: *');
$counterFile = __DIR__ . '/counter.txt';
// Zähler lesen oder initialisieren
if (file_exists($counterFile)) {
$count = (int) file_get_contents($counterFile);
} else {
$count = 0;
}
// Session starten für Duplikat-Erkennung
session_start();
// Nur zählen wenn noch nicht in dieser Session gezählt
if (!isset($_SESSION['spa_counted'])) {
$count++;
file_put_contents($counterFile, $count);
$_SESSION['spa_counted'] = true;
}
// JSON-Antwort
echo json_encode([
'count' => $count,
'formatted' => number_format($count, 0, ',', '.')
]);