forked from RolePlayGateway/roleplaygateway
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcharacter_portrait.php
44 lines (34 loc) · 981 Bytes
/
character_portrait.php
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
35
36
37
38
39
40
41
42
43
44
<?php
define('IN_PHPBB', true);
$phpbb_root_path = './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
$user->session_begin();
$auth->acl($user->data); // moar setup...
$user->setup();
// just so we know it is broken
error_reporting(E_ALL);
$character_id = request_var('character_id', 0);
// some basic sanity checks
if(isset($character_id) && is_numeric($character_id)) {
// get the image from the db
$sql = "SELECT image,image_type FROM rpg_characters WHERE id = ".$db->sql_escape($character_id);
// the result of the query
if (!$result = $db->sql_query($sql)) {
trigger_error("query failed");
} else {
if (!$image = $db->sql_fetchrow($result)) {
trigger_error("no image");
} else {
if (strlen($image['image']) <= 0) {
trigger_error("image empty");
} else {
header("Content-type: ".$image['image_type']);
echo $image['image'];
}
}
}
} else {
echo 'Please use a real id number';
}
?>