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

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