From 896fa7c96856142f844d958b049d5432f511641c Mon Sep 17 00:00:00 2001
From: Minteck <nekostarfan@gmail.com>
Date: Wed, 4 Aug 2021 16:56:12 +0200
Subject: v2.0

---
 _site/random/index.php | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
 create mode 100644 _site/random/index.php

(limited to '_site/random')

diff --git a/_site/random/index.php b/_site/random/index.php
new file mode 100644
index 0000000..a8d34ec
--- /dev/null
+++ b/_site/random/index.php
@@ -0,0 +1,20 @@
+<?php
+
+require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/markdown.php";
+$Parsedown = new Parsedown();
+
+require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/articles/getlist.php";
+
+$list = getArticlesList();
+$valid = [];
+
+foreach ($list as $article) {
+    if (!$article["admin"]) {
+        $valid[] = $article;
+    }
+}
+
+$random = $valid[array_rand($valid)];
+
+header("Location: /article/{$random["id"]}");
+die();
\ No newline at end of file
-- 
cgit