diff options
| -rw-r--r-- | .htaccess | 2 | ||||
| -rw-r--r-- | comic.php | 31 | ||||
| -rw-r--r-- | includes/header.php | 4 |
3 files changed, 35 insertions, 2 deletions
| diff --git a/.htaccess b/.htaccess index b79eae1..84bfa5b 100644 --- a/.htaccess +++ b/.htaccess | |||
| @@ -7,5 +7,7 @@ RewriteRule header.php / [R] | |||
| 7 | RewriteRule footer.php / [R] | 7 | RewriteRule footer.php / [R] |
| 8 | RewriteCond %{REQUEST_FILENAME} !.png | 8 | RewriteCond %{REQUEST_FILENAME} !.png |
| 9 | RewriteRule images/ / [R] | 9 | RewriteRule images/ / [R] |
| 10 | RewriteCond %{REQUEST_FILENAME} .png | ||
| 11 | RewriteRule images/comics/(.+).png /comic.php?id=$1 [L] | ||
| 10 | RewriteCond %{REQUEST_FILENAME} .htm | 12 | RewriteCond %{REQUEST_FILENAME} .htm |
| 11 | RewriteRule (.+).htm /index.php?area=$1 [QSA,L] | 13 | RewriteRule (.+).htm /index.php?area=$1 [QSA,L] |
| diff --git a/comic.php b/comic.php new file mode 100644 index 0000000..352060b --- /dev/null +++ b/comic.php | |||
| @@ -0,0 +1,31 @@ | |||
| 1 | <?php | ||
| 2 | |||
| 3 | include('includes/db.php'); | ||
| 4 | |||
| 5 | if (!isset($_GET['id'])) | ||
| 6 | { | ||
| 7 | header('Location: /'); | ||
| 8 | exit; | ||
| 9 | } | ||
| 10 | |||
| 11 | $getcomic = "SELECT * FROM comics WHERE filename = \"" . $_GET['id'] . ".png\""; | ||
| 12 | $getcomic2 = mysql_query($getcomic); | ||
| 13 | $getcomic3 = mysql_fetch_array($getcomic2); | ||
| 14 | |||
| 15 | if ($getcomic3['filename'] != ($_GET['id'] . '.png')) | ||
| 16 | { | ||
| 17 | header('Location: /'); | ||
| 18 | exit; | ||
| 19 | } | ||
| 20 | |||
| 21 | if ($getcomic3['status'] != 'publish') | ||
| 22 | { | ||
| 23 | header('Location: /'); | ||
| 24 | exit; | ||
| 25 | } | ||
| 26 | |||
| 27 | header('Content-type: image/png'); | ||
| 28 | |||
| 29 | readfile($_SERVER['DOCUMENT_ROOT'] . '/images/comics/' . $_GET['id'] . '.png'); | ||
| 30 | |||
| 31 | ?> | ||
| diff --git a/includes/header.php b/includes/header.php index 0f5b075..a9b93cd 100644 --- a/includes/header.php +++ b/includes/header.php | |||
| @@ -21,8 +21,8 @@ if (isset($title)) | |||
| 21 | 21 | ||
| 22 | <?php | 22 | <?php |
| 23 | 23 | ||
| 24 | include_once($_SERVER['DOCUMENT_ROOT'] . '/db.php'); | 24 | include_once($_SERVER['DOCUMENT_ROOT'] . '/includes/db.php'); |
| 25 | include_once($_SERVER['DOCUMENT_ROOT'] . '/functions.php'); | 25 | include_once($_SERVER['DOCUMENT_ROOT'] . '/includes/functions.php'); |
| 26 | 26 | ||
| 27 | $getlast = "SELECT * FROM config WHERE name = \"lastUpdated\""; | 27 | $getlast = "SELECT * FROM config WHERE name = \"lastUpdated\""; |
| 28 | $getlast2 = mysql_query($getlast); | 28 | $getlast2 = mysql_query($getlast); |
