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

require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.inc"; global $isLoggedIn;
require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/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']));
}