diff options
Diffstat (limited to '_site/random')
-rw-r--r-- | _site/random/index.php | 20 |
1 files changed, 20 insertions, 0 deletions
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 |