Files
fotobox-web/index.php
T
Thies Mueller bbcfaf32f7 initial commit
2026-04-25 23:00:38 +02:00

168 lines
5.6 KiB
PHP

<?php
function isValidHash($str) {
return preg_match('/^([a-fA-F0-9]{32})(\.jpg)?$/', $str);
}
$config = require __DIR__ . '/config.inc.php';
$imgParam = $_GET['img'] ?? null;
$imageExists = false;
$imagePath = "";
$error = "";
if ($imgParam) {
if (!isValidHash($imgParam)) {
$error = "Ungültiger Bildlink.";
} else {
$imgFile = preg_replace('/\.jpg$/i', '', $imgParam);
$imagePath = "images/" . $imgFile . ".jpg";
if (file_exists($imagePath)) {
$imageExists = true;
} else {
$error = "Das Bild wurde nicht gefunden. Es wurde möglicherweise noch nicht hochgeladen oder nach 48 Stunden gelöscht.";
}
}
}
?>
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8">
<title>Fotobox</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="assets/tailwind.css">
<link href="assets/material-icons.css" rel="stylesheet">
</head>
<body class="bg-gray-900 text-white min-h-screen flex flex-col">
<main class="flex-grow flex items-center justify-center">
<?php if (!$imgParam): ?>
<div class="text-center space-y-6">
<img src="/<?php echo $config['home_page_logo'] ?>" class="w-96 object-cover" >
<img src="/<?php echo $config['home_page_logo2'] ?>" class="w-96 object-cover" >
<h1 class="text-4xl font-bold">📸 Fotobox</h1>
<p class="text-gray-300"><?php echo htmlspecialchars($config['home_page_text']); ?></p>
<a href="<?php echo htmlspecialchars($config['home_button_link']); ?>"
class="inline-flex items-center gap-2 bg-blue-500 hover:bg-blue-600 px-6 py-3 rounded-xl text-lg shadow-lg transition">
<span class="material-icons">photo_camera</span>
<?php echo htmlspecialchars($config['home_button_text']); ?>
</a>
</div>
<?php else: ?>
<?php if ($imageExists): ?>
<div class="fixed inset-0 bg-black bg-opacity-90 flex items-center justify-center p-4">
<div class="bg-gray-800 rounded-2xl shadow-2xl p-6 flex flex-col items-center max-w-5xl w-full">
<img src="<?php echo htmlspecialchars($imagePath); ?>"
class="max-h-[65vh] w-auto object-contain rounded-xl mb-6">
<div class="flex gap-4">
<a href="<?php echo htmlspecialchars($imagePath); ?>" download
class="bg-green-500 hover:bg-green-600 px-5 py-3 rounded-xl shadow-lg transition flex items-center gap-2">
<span class="material-icons">download</span>
<span>Download</span>
</a>
<button onclick="shareImage()"
class="bg-blue-500 hover:bg-blue-600 px-5 py-3 rounded-xl shadow-lg transition flex items-center gap-2">
<span class="material-icons">share</span>
<span>Teilen</span>
</button>
</div>
<a href="/"
class="mt-6 text-gray-400 hover:text-white transition flex items-center gap-2">
<span class="material-icons">close</span>
Schließen
</a>
</div>
</div>
<script>
async function shareImage() {
const imageUrl = "<?php echo htmlspecialchars($imagePath); ?>";
const shareText = "<?php echo addslashes($config['share_text']); ?>";
try {
const response = await fetch(imageUrl);
const blob = await response.blob();
const file = new File([blob], "fotobox.jpg", { type: blob.type });
if (navigator.canShare && navigator.canShare({ files: [file] })) {
await navigator.share({
title: 'Fotobox Bild',
text: shareText,
files: [file]
});
} else if (navigator.share) {
await navigator.share({
title: 'Fotobox Bild',
text: shareText,
url: window.location.href
});
} else {
await navigator.clipboard.writeText(window.location.href);
alert("Link wurde kopiert!");
}
} catch (e) {
console.error(e);
alert("Teilen nicht möglich.");
}
}
</script>
<?php else: ?>
<div class="text-center space-y-6">
<h1 class="text-3xl font-bold text-red-400">⚠️ Bild nicht verfügbar</h1>
<p class="text-gray-300 max-w-md mx-auto">
<?php echo htmlspecialchars($error); ?>
</p>
<a href="/"
class="inline-flex items-center gap-2 bg-blue-500 hover:bg-blue-600 px-6 py-3 rounded-xl shadow-lg transition">
<span class="material-icons">arrow_back</span>
Zurück zur Startseite
</a>
</div>
<?php endif; ?>
<?php endif; ?>
</main>
<!-- Footer -->
<footer class="bg-gray-800 text-gray-400 py-6 mt-10">
<div class="max-w-5xl mx-auto px-4 flex flex-col md:flex-row justify-between items-center gap-4">
<div class="text-sm text-center md:text-left">
© <?php echo date("Y"); ?> Thies Mueller Service Solutions
</div>
<div class="flex flex-wrap justify-center gap-4 text-sm">
<a href="/about.html" class="hover:text-white transition">Über die Fotobox</a>
<a href="/contact.html" class="hover:text-white transition">Kontakt / Anfragen</a>
<a href="/delete/" class="hover:text-white transition">Ich möchte mein Bild löschen lassen</a>
<a href="https://legal.tservic.es" target="_blank" class="hover:text-white transition">Impressum / Datenschutz</a>
<a href="https://thiesmueller.de" target="_blank" class="hover:text-white transition">Thies Mueller Service Solutions</a>
<a href="https://regattatech.de" target="_blank" class="hover:text-white transition">RegattaTech.DE</a>
</div>
</div>
</footer>
</body>
</html>