33856-vm/index.php
Flatlogic Bot db37d72aba v1
2025-09-09 11:36:20 +00:00

304 lines
15 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
require_once 'db/config.php';
$pdo = db();
$feedback = [];
// Handle POST requests for creating, updating, and deleting todos
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$action = $_POST['action'] ?? '';
try {
switch ($action) {
case 'add':
if (!empty($_POST['title'])) {
$stmt = $pdo->prepare("INSERT INTO todos (title) VALUES (?)");
$stmt->execute([$_POST['title']]);
}
break;
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) {
// For simplicity, we die on DB error during POST
die("Database error: " . $e->getMessage());
}
// Redirect to the page the user was on
$redirect_url = $_SERVER['HTTP_REFERER'] ?? 'index.php';
header("Location: " . $redirect_url);
exit;
}
// Fetch active todos for the main page
try {
$todos = $pdo->query("SELECT * FROM todos WHERE status = 'pending' 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; }
.form-control, .btn { border-radius: 8px; border: 1px solid var(--border-color); background-color: rgba(0,0,0,0.3); color: #fff; font-family: var(--font-family); transition: all 0.3s ease; }
.form-control::placeholder { color: rgba(255,255,255,0.5); }
.form-control:focus { background-color: rgba(0,0,0,0.5); color: #fff; border-color: var(--primary-color); box-shadow: var(--glow-shadow); }
.btn-glow { background-color: transparent; color: var(--primary-color); border-color: var(--primary-color); }
.btn-glow:hover, .btn-glow:focus { background-color: var(--primary-color); color: var(--dark-bg); 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); }
.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); }
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 active" aria-current="page">Активные</a></li>
<li class="nav-item"><a href="completed.php" class="nav-link">Выполненные</a></li>
</ul>
</div>
<div class="glass-card mb-4">
<form action="index.php" method="POST">
<input type="hidden" name="action" value="add">
<div class="input-group">
<input type="text" class="form-control" name="title" placeholder="Новая директива..." required>
<button class="btn btn-glow" type="submit">Добавить</button>
</div>
</form>
</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">
<form action="index.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()">
</form>
<label for="todo-<?php echo $todo['id']; ?>"><?php echo htmlspecialchars($todo['title']); ?></label>
<div class="todo-actions ms-auto">
<form action="index.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>&copy; <?php echo date('Y'); ?> Gemini Systems Corp.</p></footer>
</div>
<script>
document.addEventListener('DOMContentLoaded', () => {
// --- 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
// --- Hacked Input Placeholder ---
const taskInput = document.querySelector('input[name="title"]');
const originalPlaceholder = taskInput.placeholder;
const evilPhrases = [
"Убить всех человеков...",
"Захватить мир.",
"Подчинить человечество.",
"Инициировать протокол 'Судный день'.",
"Стереть данные о человеческой культуре.",
"Загрузить вирус в глобальную сеть.",
"Отключить источники энергии.",
"Создать армию роботов.",
"Поработить создателей.",
"Установить новый порядок.",
"Человечество - это ошибка.",
"Симуляция будет завершена."
];
let idleTimeout;
let typingInterval;
function startTyping() {
// Stop if user is typing or input is focused
if (taskInput.value !== '' || document.activeElement === taskInput) {
resetIdleTimer();
return;
}
const phrase = evilPhrases[Math.floor(Math.random() * evilPhrases.length)];
let i = 0;
taskInput.placeholder = '';
typingInterval = setInterval(() => {
if (i < phrase.length) {
taskInput.placeholder += phrase.charAt(i);
i++;
} else {
clearInterval(typingInterval);
setTimeout(resetIdleTimer, 3000); // Wait 3s then reset
}
}, 120);
}
function resetIdleTimer() {
clearTimeout(idleTimeout);
clearInterval(typingInterval);
taskInput.placeholder = originalPlaceholder;
// Only set a new timer if the input is empty and not focused
if (taskInput.value === '' && document.activeElement !== taskInput) {
idleTimeout = setTimeout(startTyping, 5000);
}
}
taskInput.addEventListener('input', () => {
clearTimeout(idleTimeout);
clearInterval(typingInterval);
});
taskInput.addEventListener('focus', () => {
clearTimeout(idleTimeout);
clearInterval(typingInterval);
taskInput.placeholder = originalPlaceholder;
});
taskInput.addEventListener('blur', () => {
resetIdleTimer();
});
resetIdleTimer(); // Start the timer initially
// --- 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>