Rev | Line | |
---|
[3609] | 1 | <?php |
---|
| 2 | |
---|
| 3 | define('PHPWG_ROOT_PATH','../../'); |
---|
| 4 | include_once(PHPWG_ROOT_PATH.'include/common.inc.php'); |
---|
| 5 | include_once(PHPWG_ROOT_PATH.'include/functions_picture.inc.php'); |
---|
| 6 | |
---|
| 7 | check_status(ACCESS_GUEST); |
---|
| 8 | |
---|
| 9 | if (!isset($_POST['imgid']) |
---|
| 10 | or !($imgid = explode('img-', $_POST['imgid'])) |
---|
| 11 | or !is_numeric(@$imgid[1])) |
---|
| 12 | { |
---|
| 13 | die; |
---|
| 14 | } |
---|
| 15 | |
---|
[5734] | 16 | $image_id = mysql_real_escape_string($imgid[1]); |
---|
| 17 | |
---|
| 18 | $query = 'UPDATE '.IMAGES_TABLE.' SET hit=hit+1 WHERE id = '.$image_id.';'; |
---|
| 19 | pwg_query($query); |
---|
| 20 | |
---|
[3609] | 21 | $do_log = $conf['log']; |
---|
| 22 | if (is_admin()) |
---|
| 23 | { |
---|
| 24 | $do_log = $conf['history_admin']; |
---|
| 25 | } |
---|
| 26 | if (is_a_guest()) |
---|
| 27 | { |
---|
| 28 | $do_log = $conf['history_guest']; |
---|
| 29 | } |
---|
| 30 | |
---|
| 31 | if (!$do_log) |
---|
| 32 | { |
---|
| 33 | exit(); |
---|
| 34 | } |
---|
| 35 | |
---|
| 36 | if (!empty($_POST['section'])) |
---|
| 37 | { |
---|
[20207] | 38 | $page['section'] = pwg_db_real_escape_string($_POST['section']); |
---|
[3609] | 39 | } |
---|
| 40 | if (!empty($_POST['catid'])) |
---|
| 41 | { |
---|
[20207] | 42 | $page['category']['id'] = pwg_db_real_escape_string($_POST['catid']); |
---|
[3609] | 43 | } |
---|
| 44 | if ('tags'==@$page['section'] and !empty($_POST['tagids'])) |
---|
| 45 | { |
---|
[20207] | 46 | $tags_string = pwg_db_real_escape_string($_POST['tagids']); |
---|
[3609] | 47 | } |
---|
| 48 | |
---|
| 49 | $query = ' |
---|
| 50 | INSERT INTO '.HISTORY_TABLE.' |
---|
| 51 | ( |
---|
| 52 | date, |
---|
| 53 | time, |
---|
| 54 | user_id, |
---|
| 55 | IP, |
---|
| 56 | section, |
---|
| 57 | category_id, |
---|
| 58 | image_id, |
---|
| 59 | image_type, |
---|
| 60 | tag_ids, |
---|
| 61 | lightbox |
---|
| 62 | ) |
---|
| 63 | VALUES |
---|
| 64 | ( |
---|
| 65 | CURDATE(), |
---|
| 66 | CURTIME(), |
---|
| 67 | '.$user['id'].', |
---|
| 68 | \''.$_SERVER['REMOTE_ADDR'].'\', |
---|
| 69 | '.(isset($page['section']) ? "'".$page['section']."'" : 'NULL').', |
---|
| 70 | '.(isset($page['category']['id']) ? $page['category']['id'] : 'NULL').', |
---|
| 71 | '.$image_id.', |
---|
| 72 | "picture", |
---|
| 73 | '.(isset($tags_string) ? "'".$tags_string."'" : 'NULL').', |
---|
| 74 | "true" |
---|
| 75 | ) |
---|
| 76 | ;'; |
---|
| 77 | |
---|
| 78 | pwg_query($query); |
---|
| 79 | |
---|
[3298] | 80 | ?> |
---|
Note: See
TracBrowser
for help on using the repository browser.