prepare($sql); $stmt->execute([ "hash" => $_GET["hash"], ]); $doc = $stmt->fetch(PDO::FETCH_OBJ); $sql = "SELECT member_id FROM assignments WHERE submission_id = :submission_id "; $stmt = $db["data"]->prepare($sql); $stmt->execute([ "submission_id" => $doc->id, ]); $doc->readers = $stmt->fetchAll(PDO::FETCH_COLUMN); $IS_OWNER = LOGGED_IN ? $_SESSION["account"]->id === $doc->owner : false; $IS_READER = LOGGED_IN ? in_array($_SESSION["account"]->id, $doc->readers, true) : false; if ($IS_OWNER || $IS_READER || IS_ADMIN || $doc->is_public) : header('Content-Type: application/pdf'); header('Content-Disposition: inline; filename="' . slugify($doc->title) . '.pdf"'); echo file_get_contents(sprintf('%s/assets/docs/%s/%s', ABS_PATH, $doc->game_id, $doc->basename)); die; endif; else: include "partials/head.php"; ?>

is_public): ?>

You must log in to access this page.

Read a random document