summaryrefslogtreecommitdiff
path: root/pages/front.inc
blob: cd4f952939c4336e90288f5b2674420d65b69a14 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?php

$parts = explode("/", $_GET["_"]);

if (isset($parts[2])) {
    if ($parts[2] === "cloudburst") {
        $fronters = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc/fronters.json"), true);
    } elseif ($parts[2] === "raindrops") {
        $fronters = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd/fronters.json"), true);
    } else {
        header("Location: /?error=Invalid argument; got " . $parts[2]);
        die();
    }

    if (count($fronters["members"]) > 0) {
        header("Location: /" . $fronters["members"][0]["name"]);
        die();
    } else {
        if ($parts[2] === "cloudburst") {
            header("Location: /cloudburst");
        } else {
            header("Location: /raindrops");
        }
    }
} else {
    header("Location: /?error=Missing operand");
    die();
}