208 lines
11 KiB
PHP
208 lines
11 KiB
PHP
<?php
|
||
require_once 'db/config.php';
|
||
|
||
$pdo = db();
|
||
|
||
// Handle POST requests for toggling or deleting todos
|
||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||
$action = $_POST['action'] ?? '';
|
||
|
||
try {
|
||
switch ($action) {
|
||
case 'toggle':
|
||
if (isset($_POST['id'])) {
|
||
$stmt = $pdo->prepare("UPDATE todos SET status = IF(status = 'completed', 'pending', 'completed') WHERE id = ?");
|
||
$stmt->execute([$_POST['id']]);
|
||
}
|
||
break;
|
||
|
||
case 'delete':
|
||
if (isset($_POST['id'])) {
|
||
$stmt = $pdo->prepare("DELETE FROM todos WHERE id = ?");
|
||
$stmt->execute([$_POST['id']]);
|
||
}
|
||
break;
|
||
}
|
||
} catch (PDOException $e) {
|
||
die("Database error: " . $e->getMessage());
|
||
}
|
||
|
||
header("Location: " . $_SERVER['HTTP_REFERER'] ?? 'completed.php');
|
||
exit;
|
||
}
|
||
|
||
// Fetch completed todos
|
||
try {
|
||
$todos = $pdo->query("SELECT * FROM todos WHERE status = 'completed' ORDER BY created_at DESC")->fetchAll(PDO::FETCH_ASSOC);
|
||
} catch (PDOException $e) {
|
||
die("Не удалось загрузить задачи: " . $e->getMessage());
|
||
}
|
||
?>
|
||
<!DOCTYPE html>
|
||
<html lang="ru">
|
||
<head>
|
||
<meta charset="UTF-8">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||
<title>Выполненные задачи // Super Todo List 2056</title>
|
||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
|
||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||
<link href="https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700&display=swap" rel="stylesheet">
|
||
<style>
|
||
:root {
|
||
--primary-color: #00f6ff;
|
||
--secondary-color: #ff00ff;
|
||
--dark-bg: #0a0a1a;
|
||
--glass-bg: rgba(20, 20, 40, 0.6);
|
||
--border-color: rgba(0, 246, 255, 0.3);
|
||
--glow-shadow: 0 0 5px var(--primary-color), 0 0 10px var(--primary-color), 0 0 20px var(--primary-color);
|
||
--font-family: 'Orbitron', sans-serif;
|
||
}
|
||
body {
|
||
background-color: var(--dark-bg);
|
||
background-image: url('images/eva-background.jpeg');
|
||
background-size: 110% 110%;
|
||
background-position: center center;
|
||
background-attachment: fixed;
|
||
color: #fff;
|
||
font-family: var(--font-family);
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
min-height: 100vh;
|
||
padding: 2rem;
|
||
position: relative;
|
||
transition: background-position 0.6s ease-out;
|
||
}
|
||
body::before {
|
||
content: '';
|
||
position: fixed;
|
||
top: 0;
|
||
left: 0;
|
||
width: 100%;
|
||
height: 100%;
|
||
background-color: rgba(10, 10, 26, 0.8);
|
||
z-index: -1;
|
||
}
|
||
.container { max-width: 700px; width: 100%; }
|
||
h1 { font-weight: 700; text-transform: uppercase; color: var(--primary-color); text-shadow: var(--glow-shadow); letter-spacing: 0.1em; }
|
||
.glass-card { background: var(--glass-bg); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-radius: 15px; border: 1px solid var(--border-color); box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1); padding: 1.5rem; }
|
||
.list-group-item { background: transparent; border: none; border-bottom: 1px solid var(--border-color); display: flex; align-items: center; gap: 1rem; padding: 1rem 0; color: #fff; }
|
||
.list-group-item:last-child { border-bottom: none; }
|
||
.todo-item.completed label { text-decoration: line-through; color: rgba(255,255,255,0.4); font-style: italic; }
|
||
.todo-item label { flex-grow: 1; cursor: pointer; transition: color 0.3s ease; }
|
||
.form-check-input { background-color: transparent; border: 1px solid var(--border-color); cursor: pointer; }
|
||
.form-check-input:checked { background-color: var(--primary-color); border-color: var(--primary-color); box-shadow: var(--glow-shadow); }
|
||
.btn-danger-glow { color: var(--secondary-color); border-color: var(--secondary-color); }
|
||
.btn-danger-glow:hover, .btn-danger-glow:focus { background-color: var(--secondary-color); color: var(--dark-bg); box-shadow: 0 0 5px var(--secondary-color), 0 0 10px var(--secondary-color); }
|
||
footer { color: rgba(255,255,255,0.5); font-size: 0.8rem; letter-spacing: 0.05em; }
|
||
.nav-pills .nav-link { color: var(--primary-color); }
|
||
.nav-pills .nav-link.active { background-color: var(--primary-color); color: var(--dark-bg); box-shadow: var(--glow-shadow); }
|
||
.explosion { position: absolute; width: 100px; height: 100px; pointer-events: none; transform: translate(-50%, -50%); }
|
||
.explosion::before, .explosion::after { content: ''; position: absolute; width: 100%; height: 100%; background-image: radial-gradient(circle, var(--secondary-color) 0%, rgba(255,0,255,0) 60%); border-radius: 50%; animation: blast 0.8s ease-out forwards; }
|
||
.explosion::after { background-image: radial-gradient(circle, var(--primary-color) 0%, rgba(0,246,255,0) 60%); animation-delay: 0.1s; }
|
||
@keyframes blast { 0% { transform: scale(0); opacity: 1; } 100% { transform: scale(1.5); opacity: 0; } }
|
||
@keyframes glitch-anim-1 {
|
||
0% { clip-path: inset(30% 0 60% 0); } 20% { clip-path: inset(50% 0 20% 0); } 40% { clip-path: inset(10% 0 85% 0); } 60% { clip-path: inset(70% 0 10% 0); } 80% { clip-path: inset(40% 0 45% 0); } 100% { clip-path: inset(30% 0 60% 0); }
|
||
}
|
||
@keyframes glitch-anim-2 {
|
||
0% { clip-path: inset(80% 0 5% 0); } 20% { clip-path: inset(40% 0 55% 0); } 40% { clip-path: inset(90% 0 2% 0); } 60% { clip-path: inset(25% 0 70% 0); } 80% { clip-path: inset(60% 0 30% 0); } 100% { clip-path: inset(80% 0 5% 0); }
|
||
}
|
||
body.glitch { filter: grayscale(50%) brightness(0.9); }
|
||
body.glitch::before, body.glitch::after {
|
||
content: '';
|
||
position: fixed;
|
||
top: 0; left: 0; right: 0; bottom: 0;
|
||
background: inherit;
|
||
z-index: 999;
|
||
pointer-events: none;
|
||
}
|
||
body.glitch::before {
|
||
animation: glitch-anim-1 0.3s steps(1, end) infinite;
|
||
transform: translateX(-5px);
|
||
}
|
||
body.glitch::after {
|
||
animation: glitch-anim-2 0.2s steps(1, end) infinite reverse;
|
||
transform: translateX(5px);
|
||
}
|
||
</style>
|
||
</head>
|
||
<body>
|
||
<div class="container mt-5">
|
||
<h1 class="text-center mb-4">Super Todo List // 2056</h1>
|
||
|
||
<div class="glass-card mb-4">
|
||
<ul class="nav nav-pills nav-fill">
|
||
<li class="nav-item"><a href="index.php" class="nav-link">Активные</a></li>
|
||
<li class="nav-item"><a href="completed.php" class="nav-link active" aria-current="page">Выполненные</a></li>
|
||
</ul>
|
||
</div>
|
||
|
||
<div class="glass-card">
|
||
<ul class="list-group list-group-flush">
|
||
<?php if (empty($todos)): ?>
|
||
<li class="list-group-item text-center text-muted">Нет выполненных задач.</li>
|
||
<?php else: ?>
|
||
<?php foreach ($todos as $todo): ?>
|
||
<li class="list-group-item todo-item completed">
|
||
<form action="completed.php" method="POST" class="d-inline">
|
||
<input type="hidden" name="action" value="toggle">
|
||
<input type="hidden" name="id" value="<?php echo $todo['id']; ?>">
|
||
<input type="checkbox" class="form-check-input" id="todo-<?php echo $todo['id']; ?>" onchange="this.form.submit()" checked>
|
||
</form>
|
||
<label for="todo-<?php echo $todo['id']; ?>"><?php echo htmlspecialchars($todo['title']); ?></label>
|
||
<div class="todo-actions ms-auto">
|
||
<form action="completed.php" method="POST" class="d-inline">
|
||
<input type="hidden" name="action" value="delete">
|
||
<input type="hidden" name="id" value="<?php echo $todo['id']; ?>">
|
||
<button type="submit" class="btn btn-sm btn-danger-glow" onclick="return confirm('Дезинтегрировать задачу?');">Удалить</button>
|
||
</form>
|
||
</div>
|
||
</li>
|
||
<?php endforeach; ?>
|
||
<?php endif; ?>
|
||
</ul>
|
||
</div>
|
||
|
||
<footer class="text-center mt-4"><p>© <?php echo date('Y'); ?> Gemini Systems Corp.</p></footer>
|
||
</div>
|
||
|
||
<script>
|
||
// --- Background Effects ---
|
||
function triggerRandomEffect() {
|
||
// Decide if we glitch or explode
|
||
if (Math.random() < 0.25) { // 25% chance for a glitch
|
||
document.body.classList.add('glitch');
|
||
setTimeout(() => {
|
||
document.body.classList.remove('glitch');
|
||
}, Math.random() * 400 + 150); // Glitch for a random short duration
|
||
} else if (Math.random() < 0.1) { // 10% chance for an explosion
|
||
const explosion = document.createElement('div');
|
||
explosion.classList.add('explosion');
|
||
const x = Math.random() * window.innerWidth;
|
||
const y = Math.random() * window.innerHeight;
|
||
explosion.style.left = `${x}px`;
|
||
explosion.style.top = `${y}px`;
|
||
document.body.appendChild(explosion);
|
||
setTimeout(() => { explosion.remove(); }, 800);
|
||
}
|
||
|
||
// Set timeout for the next attempt
|
||
setTimeout(triggerRandomEffect, Math.random() * 5000 + 4000); // Next attempt in 4-9 seconds
|
||
}
|
||
triggerRandomEffect(); // Start the effect loop
|
||
|
||
// --- Parallax Background ---
|
||
const body = document.body;
|
||
window.addEventListener('mousemove', (e) => {
|
||
const x = (e.clientX / window.innerWidth - 0.5) * 2;
|
||
const y = (e.clientY / window.innerHeight - 0.5) * 2;
|
||
const moveX = x * -15; // Reduced multiplier
|
||
const moveY = y * -10; // Reduced multiplier
|
||
body.style.backgroundPosition = `calc(50% + ${moveX}px) calc(50% + ${moveY}px)`;
|
||
});
|
||
});
|
||
</script>
|
||
</body>
|
||
</html>
|