summary refs log tree commit diff stats
path: root/comic.php
blob: e8333bb7fa1ba30f9494dff0a38e8b7618d8fb26 (plain) (blame)
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
29
30
31
32
33
34
<?php

include('includes/db.php');

if (!isset($_GET['id']))
{
	header('Location: /');
	exit;
}

$getcomic = $mysql_conn->prepare("SELECT * FROM comics WHERE filename = ?");
$real_filename = $_GET['id'] . ".png";
$getcomic->bind_param("s", $real_filename);
$getcomic->execute();
$getcomic2 = $getcomic->get_result();
$getcomic3 = $getcomic2->fetch_assoc();

if ($getcomic3['filename'] != $real_filename)
{
	header('Location: /');
	exit;
}

if ($getcomic3['status'] != 'publish')
{
	header('Location: /');
	exit;
}

header('Content-type: image/png');

readfile($_SERVER['DOCUMENT_ROOT'] . '/images/comics/' . $_GET['id'] . '.png');

?>