refactor(test): move web audio synth to /test with admin links, remove cooles-feature, and remove crt-overlay from admin

This commit is contained in:
Philipp Urbschat 2026-09-12 23:23:57 +02:00
parent 76640d8bbf
commit d970270d91
Signed by: Phili
SSH key fingerprint: SHA256:ZSQWnldzrYiABzOV6vTICPe0h19pTpus7sCbm2S0po0
7 changed files with 354 additions and 309 deletions

View file

@ -1,286 +0,0 @@
<?php
// Session starten, falls noch nicht geschehen
if (session_status() === PHP_SESSION_NONE) {
session_start();
}
// Einfache Logout-Logik direkt in dieser Datei
if (isset($_GET['logout'])) {
session_destroy();
// Seite neu laden ohne Parameter
header("Location: index.php");
exit;
}
// 1. Projekt identifizieren und schützen
$current_project = 'cooles-feature';
require_once '../auth.php';
// 2. Nutzerdaten abrufen
$loggedInUser = isset($_SESSION['user_email']) ? $_SESSION['user_email'] : 'neuankoemmling@beispiel.de';
?>
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Erster Login-Check: Erfolgreich!</title>
<style>
:root {
--primary: #ff00ff;
--secondary: #00ff00;
--bg: #222;
--text: #fff;
--accent: #ffff00;
}
body {
background-color: var(--bg);
color: var(--text);
font-family: 'Comic Sans MS', 'Comic Sans', cursive, sans-serif;
margin: 0;
padding: 20px;
overflow-x: hidden;
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
}
.container {
background: #333;
border: 8px solid var(--primary);
padding: 40px;
max-width: 600px;
width: 100%;
border-radius: 30px;
transform: rotate(-1.5deg);
box-shadow: 20px 20px 0px var(--secondary);
position: relative;
}
.header {
text-align: center;
border-bottom: 4px dashed var(--accent);
margin-bottom: 20px;
transform: rotate(2deg);
}
h1 {
color: var(--secondary);
text-shadow: 3px 3px 0px var(--primary);
font-size: 2.2rem;
margin-bottom: 5px;
line-height: 1.2;
}
.user-info {
background: #444;
padding: 5px 15px;
display: inline-block;
border-radius: 10px;
margin-bottom: 10px;
border: 2px solid var(--accent);
}
.main-content {
text-align: center;
margin: 30px 0;
}
#whoopee-cushion {
width: 160px;
height: 160px;
background: #ff4d4d;
border-radius: 50%;
border: 6px solid #b30000;
cursor: pointer;
display: flex;
justify-content: center;
align-items: center;
font-size: 14px;
font-weight: bold;
color: white;
text-align: center;
margin: 0 auto;
position: relative;
user-select: none;
transition: transform 0.05s;
box-shadow: 0 12px 0 #b30000;
}
#whoopee-cushion:active {
transform: translateY(10px) scale(0.92);
box-shadow: 0 2px 0 #b30000;
}
#whoopee-cushion::after {
content: "HIER DRÜCKEN!";
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.fart-cloud {
position: absolute;
background: rgba(180, 255, 100, 0.7);
border-radius: 50%;
pointer-events: none;
z-index: 10;
animation: float-up 1.5s ease-out forwards;
filter: blur(5px);
}
@keyframes float-up {
0% { transform: translateY(0) scale(0.5); opacity: 0.8; }
100% { transform: translateY(-150px) scale(4); opacity: 0; }
}
.logout-btn {
display: block;
width: fit-content;
margin: 30px auto 0;
background: var(--accent);
color: #000;
padding: 12px 25px;
text-decoration: none;
font-weight: bold;
border-radius: 10px;
transform: rotate(-2deg);
border: 4px solid #000;
transition: 0.2s;
}
.logout-btn:hover {
transform: rotate(0deg) scale(1.1);
background: #ff3300;
color: #fff;
}
.shake {
animation: shake 0.4s cubic-bezier(.36,.07,.19,.97) both;
}
@keyframes shake {
10%, 90% { transform: translate3d(-2px, 0, 0) rotate(-1.5deg); }
20%, 80% { transform: translate3d(4px, 0, 0) rotate(-2deg); }
30%, 50%, 70% { transform: translate3d(-6px, 0, 0) rotate(-1deg); }
40%, 60% { transform: translate3d(6px, 0, 0) rotate(-1.8deg); }
}
</style>
</head>
<body>
<div class="container" id="app-container">
<header class="header">
<h1>Willkommen beim ersten Check! 🎉</h1>
<div class="user-info">
Eingeloggt als: <strong><?php echo htmlspecialchars($loggedInUser); ?></strong>
</div>
</header>
<main class="main-content">
<p><strong>Glückwunsch!</strong> Deine Zugangsdaten sind korrekt und du bist erfolgreich im System gelandet.</p>
<p style="font-size: 0.9rem;">Um sicherzugehen, dass auch interaktive Elemente bei dir funktionieren, teste bitte unser hochmodernes Belohnungsmodul:</p>
<div class="fart-section" style="margin-top: 30px;">
<div id="whoopee-cushion" title="Funktionstest für Sound und Animation"></div>
<p id="status-msg" style="margin-top: 20px; font-style: italic; color: #888;">Hinweis: Sound bitte einschalten!</p>
</div>
</main>
<footer>
<!-- Link angepasst auf Parameter-Logout -->
<a href="?logout=1" class="logout-btn">Test beendet? Hier abmelden!</a>
</footer>
</div>
<script>
const cushion = document.getElementById('whoopee-cushion');
const container = document.getElementById('app-container');
const statusMsg = document.getElementById('status-msg');
function playOrganicFart() {
const audioCtx = new (window.AudioContext || window.webkitAudioContext)();
if (audioCtx.state === 'suspended') audioCtx.resume();
const duration = 0.4 + Math.random() * 0.5;
const mainGain = audioCtx.createGain();
const osc = audioCtx.createOscillator();
const oscGain = audioCtx.createGain();
osc.type = 'sawtooth';
osc.frequency.setValueAtTime(45 + Math.random() * 20, audioCtx.currentTime);
osc.frequency.exponentialRampToValueAtTime(20, audioCtx.currentTime + duration);
const lfo = audioCtx.createOscillator();
const lfoGain = audioCtx.createGain();
lfo.type = 'square';
lfo.frequency.setValueAtTime(14 + Math.random() * 8, audioCtx.currentTime);
lfoGain.gain.setValueAtTime(0.8, audioCtx.currentTime);
lfo.connect(lfoGain);
lfoGain.connect(oscGain.gain);
const bufferSize = audioCtx.sampleRate * duration;
const noiseBuffer = audioCtx.createBuffer(1, bufferSize, audioCtx.sampleRate);
const noiseData = noiseBuffer.getChannelData(0);
for (let i = 0; i < bufferSize; i++) {
noiseData[i] = Math.random() * 2 - 1;
}
const noise = audioCtx.createBufferSource();
noise.buffer = noiseBuffer;
const noiseFilter = audioCtx.createBiquadFilter();
noiseFilter.type = 'bandpass';
noiseFilter.frequency.setValueAtTime(400, audioCtx.currentTime);
const lowPass = audioCtx.createBiquadFilter();
lowPass.type = 'lowpass';
lowPass.frequency.setValueAtTime(450, audioCtx.currentTime);
lowPass.frequency.exponentialRampToValueAtTime(80, audioCtx.currentTime + duration);
mainGain.gain.setValueAtTime(0, audioCtx.currentTime);
mainGain.gain.linearRampToValueAtTime(0.5, audioCtx.currentTime + 0.05);
mainGain.gain.exponentialRampToValueAtTime(0.01, audioCtx.currentTime + duration);
osc.connect(oscGain);
oscGain.connect(lowPass);
noise.connect(noiseFilter);
noiseFilter.connect(lowPass);
lowPass.connect(mainGain);
mainGain.connect(audioCtx.destination);
osc.start();
lfo.start();
noise.start();
osc.stop(audioCtx.currentTime + duration);
lfo.stop(audioCtx.currentTime + duration);
noise.stop(audioCtx.currentTime + duration);
statusMsg.textContent = "Interaktionstest: Bestanden! 👍";
}
function createCloud() {
const cloud = document.createElement('div');
cloud.classList.add('fart-cloud');
const size = Math.random() * 60 + 20;
cloud.style.width = size + 'px';
cloud.style.height = size + 'px';
const rect = cushion.getBoundingClientRect();
cloud.style.left = (rect.left + rect.width / 2 - size / 2 + (Math.random() * 100 - 50)) + 'px';
cloud.style.top = (rect.top + rect.height / 2 - size / 2) + 'px';
document.body.appendChild(cloud);
setTimeout(() => cloud.remove(), 1500);
}
cushion.addEventListener('click', () => {
playOrganicFart();
container.classList.add('shake');
setTimeout(() => container.classList.remove('shake'), 400);
for(let i = 0; i < 12; i++) {
setTimeout(createCloud, i * 80);
}
});
</script>
</body>
</html>

View file

@ -25,19 +25,11 @@ class ModuleService {
'path' => '/storymachine',
'adminOnly' => false
],
'cooles-feature' => [
'slug' => 'cooles-feature',
'name' => 'Web Audio Synth',
'badge' => 'Audio Lab',
'description' => 'Interaktive Web Audio API Synthese',
'path' => '/cooles-feature',
'adminOnly' => false
],
'test' => [
'slug' => 'test',
'name' => 'Test Environment',
'badge' => 'Sandbox',
'description' => 'Test- und Entwicklungsumgebung',
'name' => 'Web Audio Synth',
'badge' => 'Audio / Test',
'description' => 'Interaktive Web Audio API Synthese & Soundtest',
'path' => '/test',
'adminOnly' => false
]

View file

@ -27,7 +27,7 @@ switch ($action) {
'email' => $email,
'is_admin' => 1,
'status' => 'Active',
'projects' => ModuleService::getAll() ? array_keys(ModuleService::getAll()) : ['dinos','plants','storymachine','cooles-feature','test']
'projects' => ModuleService::getAll() ? array_keys(ModuleService::getAll()) : ['dinos','plants','storymachine','test']
];
if (!empty($password)) {
$data['password'] = $password;

File diff suppressed because one or more lines are too long

View file

@ -13,7 +13,6 @@
<link rel="shortcut icon" href="/favicon.ico">
</head>
<body class="bg-[#020617] text-slate-300 min-h-screen font-sans selection-pink">
<div class="crt-overlay pointer-events-none"></div>
<header class="px-6 py-4 border-b border-slate-800/80 bg-slate-950/80 backdrop-blur-xl sticky top-0 z-50">
<div class="max-w-7xl mx-auto flex justify-between items-center">
<div class="flex items-center gap-3">

View file

@ -16,8 +16,6 @@ $baseUrl = rtrim(Config::get('BASE_URL', 'https://philippurbschat.de/'), '/');
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
</head>
<body class="bg-[#0b1120] text-slate-300 min-h-screen flex flex-col justify-center items-center p-4 sm:p-6 font-sans relative overflow-x-hidden selection-pink">
<div class="crt-overlay pointer-events-none"></div>
<div class="max-w-md w-full my-8 relative z-10">
<!-- Logo / Brand Header -->
<div class="text-center mb-8">

View file

@ -1,22 +1,364 @@
<?php
// DATEI: ./test/index.php
if (session_status() === PHP_SESSION_NONE) {
session_start();
}
// 1. Name des Projekts definieren (muss exakt wie im Admin-Dashboard heißen)
// 1. Projekt identifizieren und schützen
$current_project = 'test';
// 2. Zentralen Türsteher aus dem Root einbinden
require_once __DIR__ . '/../auth.php';
// Ab hier ist die Seite sicher!
// 2. Nutzerdaten abrufen
$loggedInUser = isset($_SESSION['user_email']) ? $_SESSION['user_email'] : 'Gast';
$isAdmin = !empty($_SESSION['is_admin']);
?>
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8">
<title>Test Projekt</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Web Audio Synth | Test-Modul</title>
<style>
:root {
--primary: #06b6d4;
--secondary: #10b981;
--bg: #020617;
--surface: #0b1120;
--card-border: #1e293b;
--text: #f8fafc;
--muted: #94a3b8;
--accent: #d946ef;
}
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
body {
background-color: var(--bg);
color: var(--text);
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
min-height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 20px;
overflow-x: hidden;
position: relative;
}
/* Top Bar */
.top-nav {
position: fixed;
top: 16px;
left: 20px;
right: 20px;
display: flex;
justify-content: space-between;
align-items: center;
z-index: 50;
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
font-size: 12px;
}
.nav-links {
display: flex;
gap: 12px;
align-items: center;
}
.top-nav a {
color: var(--muted);
text-decoration: none;
padding: 8px 14px;
background: rgba(11, 17, 32, 0.85);
border: 1px solid var(--card-border);
border-radius: 10px;
backdrop-filter: blur(8px);
transition: all 0.2s ease;
}
.top-nav a:hover {
color: var(--primary);
border-color: rgba(6, 182, 212, 0.4);
}
.top-nav a.admin-link {
color: var(--primary);
border-color: rgba(6, 182, 212, 0.3);
background: rgba(6, 182, 212, 0.08);
}
.top-nav a.admin-link:hover {
background: rgba(6, 182, 212, 0.18);
}
/* Container */
.container {
background: var(--surface);
border: 1px solid var(--card-border);
padding: 40px;
max-width: 540px;
width: 100%;
border-radius: 28px;
box-shadow: 0 0 50px rgba(6, 182, 212, 0.08);
position: relative;
text-align: center;
}
.container::before {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
height: 2px;
background: linear-gradient(90deg, transparent, var(--primary), transparent);
border-radius: 28px 28px 0 0;
}
.header {
margin-bottom: 24px;
}
.badge {
display: inline-block;
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
font-size: 10px;
text-transform: uppercase;
letter-spacing: 0.15em;
color: var(--primary);
background: rgba(6, 182, 212, 0.1);
border: 1px solid rgba(6, 182, 212, 0.25);
padding: 4px 10px;
border-radius: 9999px;
margin-bottom: 12px;
}
h1 {
color: var(--text);
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
font-size: 1.6rem;
font-weight: 800;
letter-spacing: -0.02em;
margin-bottom: 8px;
}
.user-info {
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
font-size: 11px;
color: var(--muted);
}
.main-content {
margin: 28px 0;
}
.description {
font-size: 13px;
color: var(--muted);
line-height: 1.6;
margin-bottom: 28px;
}
/* Sound Button */
#whoopee-cushion {
width: 140px;
height: 140px;
background: radial-gradient(circle, #f43f5e 0%, #be123c 100%);
border-radius: 50%;
border: 4px solid #e11d48;
cursor: pointer;
display: flex;
justify-content: center;
align-items: center;
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
font-size: 11px;
font-weight: bold;
color: white;
text-align: center;
margin: 0 auto;
position: relative;
user-select: none;
transition: transform 0.08s, box-shadow 0.08s;
box-shadow: 0 10px 0 #881337, 0 15px 25px rgba(244, 63, 94, 0.3);
text-transform: uppercase;
letter-spacing: 0.05em;
}
#whoopee-cushion:active {
transform: translateY(8px) scale(0.95);
box-shadow: 0 2px 0 #881337, 0 5px 15px rgba(244, 63, 94, 0.2);
}
.fart-cloud {
position: absolute;
background: rgba(16, 185, 129, 0.4);
border-radius: 50%;
pointer-events: none;
z-index: 10;
animation: float-up 1.2s ease-out forwards;
filter: blur(8px);
}
@keyframes float-up {
0% { transform: translateY(0) scale(0.6); opacity: 0.7; }
100% { transform: translateY(-130px) scale(3.5); opacity: 0; }
}
.status-msg {
margin-top: 20px;
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
font-size: 11px;
color: var(--muted);
}
.shake {
animation: shake 0.35s cubic-bezier(.36,.07,.19,.97) both;
}
@keyframes shake {
10%, 90% { transform: translate3d(-2px, 0, 0); }
20%, 80% { transform: translate3d(3px, 0, 0); }
30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
40%, 60% { transform: translate3d(4px, 0, 0); }
}
</style>
</head>
<body>
<h1>Zugriff gewährt!</h1>
<p>Willkommen im Test-Projekt, <?= htmlspecialchars($_SESSION['user_email']) ?>.</p>
<!-- Top Navigation -->
<nav class="top-nav">
<div class="nav-links">
<a href="/"> Website</a>
<?php if ($isAdmin): ?>
<a href="/admin" class="admin-link">Admin Dashboard</a>
<a href="/admin/users" class="admin-link">Benutzerverwaltung</a>
<?php endif; ?>
</div>
<div class="nav-links">
<a href="/login/logout" style="color: #f43f5e;">Logout</a>
</div>
</nav>
<div class="container" id="app-container">
<header class="header">
<span class="badge">Web Audio API / Test-Modul</span>
<h1>Web Audio Synth</h1>
<div class="user-info">
Angemeldet: <span><?php echo htmlspecialchars($loggedInUser); ?></span>
</div>
</header>
<main class="main-content">
<p class="description">
Interaktiver Audiotest zur dynamischen Klangsynthese mit Oszillatoren, Rauschgeneratoren und Filtern über die HTML5 Web Audio API.
</p>
<div class="synth-section">
<div id="whoopee-cushion" role="button" tabindex="0">TRIGGER</div>
<p id="status-msg" class="status-msg">Klicke auf den Button, um den Soundtest zu starten.</p>
</div>
</main>
</div>
<script>
const cushion = document.getElementById('whoopee-cushion');
const container = document.getElementById('app-container');
const statusMsg = document.getElementById('status-msg');
function playOrganicFart() {
const AudioCtx = window.AudioContext || window.webkitAudioContext;
const audioCtx = new AudioCtx();
if (audioCtx.state === 'suspended') audioCtx.resume();
const duration = 0.4 + Math.random() * 0.4;
const mainGain = audioCtx.createGain();
const osc = audioCtx.createOscillator();
const oscGain = audioCtx.createGain();
osc.type = 'sawtooth';
osc.frequency.setValueAtTime(45 + Math.random() * 20, audioCtx.currentTime);
osc.frequency.exponentialRampToValueAtTime(20, audioCtx.currentTime + duration);
const lfo = audioCtx.createOscillator();
const lfoGain = audioCtx.createGain();
lfo.type = 'square';
lfo.frequency.setValueAtTime(14 + Math.random() * 8, audioCtx.currentTime);
lfoGain.gain.setValueAtTime(0.8, audioCtx.currentTime);
lfo.connect(lfoGain);
lfoGain.connect(oscGain.gain);
const bufferSize = audioCtx.sampleRate * duration;
const noiseBuffer = audioCtx.createBuffer(1, bufferSize, audioCtx.sampleRate);
const noiseData = noiseBuffer.getChannelData(0);
for (let i = 0; i < bufferSize; i++) {
noiseData[i] = Math.random() * 2 - 1;
}
const noise = audioCtx.createBufferSource();
noise.buffer = noiseBuffer;
const noiseFilter = audioCtx.createBiquadFilter();
noiseFilter.type = 'bandpass';
noiseFilter.frequency.setValueAtTime(400, audioCtx.currentTime);
const lowPass = audioCtx.createBiquadFilter();
lowPass.type = 'lowpass';
lowPass.frequency.setValueAtTime(450, audioCtx.currentTime);
lowPass.frequency.exponentialRampToValueAtTime(80, audioCtx.currentTime + duration);
mainGain.gain.setValueAtTime(0, audioCtx.currentTime);
mainGain.gain.linearRampToValueAtTime(0.5, audioCtx.currentTime + 0.05);
mainGain.gain.exponentialRampToValueAtTime(0.01, audioCtx.currentTime + duration);
osc.connect(oscGain);
oscGain.connect(lowPass);
noise.connect(noiseFilter);
noiseFilter.connect(lowPass);
lowPass.connect(mainGain);
mainGain.connect(audioCtx.destination);
osc.start();
lfo.start();
noise.start();
osc.stop(audioCtx.currentTime + duration);
lfo.stop(audioCtx.currentTime + duration);
noise.stop(audioCtx.currentTime + duration);
statusMsg.textContent = "Audio-Synthese aktiv. Interaktionstest bestanden.";
statusMsg.style.color = "#10b981";
}
function createCloud() {
const cloud = document.createElement('div');
cloud.classList.add('fart-cloud');
const size = Math.random() * 50 + 20;
cloud.style.width = size + 'px';
cloud.style.height = size + 'px';
const rect = cushion.getBoundingClientRect();
cloud.style.left = (rect.left + rect.width / 2 - size / 2 + (Math.random() * 80 - 40)) + 'px';
cloud.style.top = (rect.top + rect.height / 2 - size / 2) + 'px';
document.body.appendChild(cloud);
setTimeout(() => cloud.remove(), 1200);
}
cushion.addEventListener('click', () => {
playOrganicFart();
container.classList.add('shake');
setTimeout(() => container.classList.remove('shake'), 350);
for(let i = 0; i < 8; i++) {
setTimeout(createCloud, i * 80);
}
});
cushion.addEventListener('keydown', (e) => {
if (e.key === 'Enter' || e.key === ' ') {
e.preventDefault();
cushion.click();
}
});
</script>
</body>
</html>