aboutsummaryrefslogtreecommitdiff
path: root/_site/random
diff options
context:
space:
mode:
authorMinteck <nekostarfan@gmail.com>2021-08-04 16:56:12 +0200
committerMinteck <nekostarfan@gmail.com>2021-08-04 16:56:12 +0200
commit896fa7c96856142f844d958b049d5432f511641c (patch)
treed8bbbe327939ade9bd13276c6b4c6105adf95323 /_site/random
parent7df2fb3f5ee0ac5bd89e127c86ad0c2d6de126d1 (diff)
downloadunchainedtech-896fa7c96856142f844d958b049d5432f511641c.tar.gz
unchainedtech-896fa7c96856142f844d958b049d5432f511641c.tar.bz2
unchainedtech-896fa7c96856142f844d958b049d5432f511641c.zip
v2.0
Diffstat (limited to '_site/random')
-rw-r--r--_site/random/index.php20
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