summaryrefslogtreecommitdiff
path: root/pages/api/data.php
blob: eb0782439fc82c192a1ba86e0918f2f80adae853 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
<?php

require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/session.inc"; global $isLoggedIn;
require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/bitset.inc";
if (!$isLoggedIn) header("Location: /-/login") and die();

if (!isset($_GET['f']) || !file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . $_GET['f'])) {
    die();
} else {
    header("Content-Type: " . mime_content_type($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . $_GET['f']));
    die(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . $_GET['f']));
}