aboutsummaryrefslogtreecommitdiff
path: root/_site/random/index.php
blob: a8d34ec655ffefd60c56be389e6106f64052de88 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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();