From 49fc935d07dddfda1784295882a742ae412fb7b8 Mon Sep 17 00:00:00 2001 From: Atlaskor Date: Tue, 25 Nov 2025 23:01:46 +0000 Subject: [PATCH] Update index.php --- index.php | 189 +++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 144 insertions(+), 45 deletions(-) diff --git a/index.php b/index.php index 6760090..41917ed 100644 --- a/index.php +++ b/index.php @@ -1,22 +1,67 @@ 'Welcome to Mediakor', - 'meta' => 'System Log • Today', - 'body' => 'Mediakor is your central hub for projects, servers, and experiments. Use the nav on the left to explore each sector of the network.' - ], - [ - 'title' => 'Status: Core Services Online', - 'meta' => 'Monitoring • Uptime', - 'body' => 'Web stack, game servers, and media nodes are all reporting nominal. Check the “Status Panel” section for real-time dashboards.' - ], - [ - 'title' => 'Latest Deployment', - 'meta' => 'Deploy • v1.0', - 'body' => 'A new build has been pushed to the cluster. Patch notes, changelogs, and rollback instructions are available in the Documentation dock.' - ], -]; +/* + Minimal DB schema for Mediakor posts: + + CREATE TABLE posts ( + id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY, + title VARCHAR(255) NOT NULL, + meta VARCHAR(255) DEFAULT NULL, + body TEXT NOT NULL, + is_published TINYINT(1) NOT NULL DEFAULT 1, + created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; + + Insert example: + + INSERT INTO posts (title, meta, body) VALUES + ('Welcome to Mediakor', 'System Log • Today', + 'Mediakor is your central hub for projects, servers, and experiments. Use the nav on the left to explore each sector of the network.'); +*/ + +// --- DB CONFIG --- +// You can also set these as environment variables in your Docker stack +$dbHost = $_ENV['DB_HOST'] ?? 'localhost'; +$dbName = $_ENV['DB_NAME'] ?? 'mediakor'; +$dbUser = $_ENV['DB_USER'] ?? 'mediakor'; +$dbPass = $_ENV['DB_PASS'] ?? 'mediakor_password'; + +$posts = []; +$dbError = null; + +try { + $dsn = "mysql:host={$dbHost};dbname={$dbName};charset=utf8mb4"; + $pdo = new PDO($dsn, $dbUser, $dbPass, [ + PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, + PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC, + ]); + + $stmt = $pdo->query(" + SELECT id, title, meta, body, created_at + FROM posts + WHERE is_published = 1 + ORDER BY created_at DESC, id DESC + "); + $posts = $stmt->fetchAll(); +} catch (PDOException $e) { + // Fallback: static posts if DB connection fails + $dbError = 'DB_connect_failed'; + $posts = [ + [ + 'id' => 0, + 'title' => 'Welcome to Mediakor', + 'meta' => 'System Log • Fallback', + 'body' => 'Database connection failed, so this is the static fallback feed. Once your DB is configured, posts will be served from the posts table.', + 'created_at' => null, + ], + [ + 'id' => 0, + 'title' => 'Configure Database', + 'meta' => 'Setup • Guide', + 'body' => 'Edit the DB settings at the top of index.php and create the posts table using the SQL snippet in the comment.', + 'created_at' => null, + ], + ]; +} ?> @@ -53,20 +98,49 @@ $posts = [ display:flex; flex-direction:column; overflow-x:hidden; + position:relative; } - /* subtle stars */ - body::before{ + /* Twinkling starfields (two layers, desynced animation) */ + body::before, + body::after{ content:""; position:fixed; inset:-200px; - background-image: - radial-gradient(1px 1px at 10% 20%,rgba(255,255,255,.25) 0,transparent 60%), - radial-gradient(1px 1px at 40% 80%,rgba(255,255,255,.2) 0,transparent 60%), - radial-gradient(1px 1px at 80% 30%,rgba(255,255,255,.2) 0,transparent 60%), - radial-gradient(1px 1px at 20% 60%,rgba(255,255,255,.18) 0,transparent 60%); - opacity:0.35; + pointer-events:none; z-index:-1; + background-repeat:no-repeat; + } + + body::before{ + background-image: + radial-gradient(1px 1px at 10% 20%,rgba(255,255,255,.40) 0,transparent 60%), + radial-gradient(1px 1px at 40% 80%,rgba(255,255,255,.25) 0,transparent 60%), + radial-gradient(1px 1px at 80% 30%,rgba(255,255,255,.30) 0,transparent 60%), + radial-gradient(1px 1px at 20% 60%,rgba(255,255,255,.22) 0,transparent 60%), + radial-gradient(1px 1px at 65% 50%,rgba(255,255,255,.20) 0,transparent 60%); + animation:twinkleLayer1 14s linear infinite alternate; + } + + body::after{ + background-image: + radial-gradient(1px 1px at 15% 75%,rgba(255,255,255,.25) 0,transparent 60%), + radial-gradient(1px 1px at 70% 15%,rgba(255,255,255,.30) 0,transparent 60%), + radial-gradient(1px 1px at 90% 60%,rgba(255,255,255,.22) 0,transparent 60%), + radial-gradient(1px 1px at 35% 35%,rgba(255,255,255,.27) 0,transparent 60%); + animation:twinkleLayer2 18s linear infinite alternate; + } + + @keyframes twinkleLayer1{ + 0% {opacity:0.25; transform:translate3d(0,0,0);} + 50% {opacity:0.55; transform:translate3d(10px,-8px,0);} + 100%{opacity:0.20; transform:translate3d(-8px,6px,0);} + } + + @keyframes twinkleLayer2{ + 0% {opacity:0.18; transform:translate3d(0,0,0);} + 50% {opacity:0.50; transform:translate3d(-12px,10px,0);} + 100%{opacity:0.22; transform:translate3d(8px,-6px,0);} } /* Header */ @@ -507,6 +581,9 @@ $posts = [ Sector: Outer Net All traffic through Mediakor is monitored for anomalies and uptime. + + DB status: offline (showing fallback posts) + @@ -523,26 +600,48 @@ $posts = [
- -
-
-
-

- -
-
- -
-
- Log Entry -
- - + +
+
+
+

No Posts Yet

+ +
+
+ Use phpMyAdmin or your SQL client to insert rows into the posts table and they will appear here automatically.
-
-
-
- +
+ System +
+
+ + + +
+
+
+

+ +

+ +
+
+ +
+
+ Log Entry +
+ + + +
+
+
+
+ +