-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathimage.php
More file actions
executable file
·30 lines (24 loc) · 836 Bytes
/
Copy pathimage.php
File metadata and controls
executable file
·30 lines (24 loc) · 836 Bytes
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
<?php
/* include header */
include("header.php");
/* get image id */
$id = isset($_GET['id']) ? $_GET['id'] : 0;
/* check if image exists */
$q = "SELECT * FROM uploads WHERE file_id = '{$id}' LIMIT 1";
if(!sql_num_rows($q))
{
header('Content-Type: image/gif');
header('Content-Disposition: inline; filename=image_not_found.gif');
@readfile($config['base_path'] . "/assets/images/image_not_found.gif");
}else
/* display image */
if(sql_num_rows($q))
{
$image = sql_row($q);
header('Content-Type: '. $image['file_type']);
header('Content-Disposition: inline; filename='. $image['file_name']);
@readfile($config['upload_path'] . $image['file_name']);
/* update views and last access */
mysql_query("UPDATE uploads SET views = views+1, last_access = '".time()."' WHERE file_id = '{$id}'");
}
?>