-
Notifications
You must be signed in to change notification settings - Fork 8
/
iteminfo.php
88 lines (87 loc) · 1.86 KB
/
iteminfo.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
<?php
declare(strict_types=1);
/**
* MCCodes v2 by Dabomstew & ColdBlooded
*
* Repository: https://github.com/davemacaulay/mccodesv2
* License: MIT License
*/
global $db, $h;
require_once('globals.php');
$_GET['ID'] =
(isset($_GET['ID']) && is_numeric($_GET['ID']))
? abs(intval($_GET['ID'])) : '';
$itmid = $_GET['ID'];
if (!$itmid)
{
echo 'Invalid item ID';
}
else
{
$q =
$db->query(
"SELECT `itmname`, `itmdesc`, `itmbuyprice`,
`itmsellprice`, `itmtypename`
FROM `items` AS `i`
INNER JOIN `itemtypes` AS `it`
ON `i`.`itmtype` = `it`.`itmtypeid`
WHERE `i`.`itmid` = {$itmid}
LIMIT 1");
if ($db->num_rows($q) == 0)
{
echo 'Invalid item ID';
}
else
{
$id = $db->fetch_row($q);
echo "
<table width=75% class='table' cellspacing='1'>
<tr style='background: gray;'>
<th colspan=2><b>Looking up info on {$id['itmname']}</b></th>
</tr>
<tr style='background: #dfdfdf;'>
<td colspan=2>The <b>{$id['itmname']}</b> is a/an {$id['itmtypename']} Item - <b>{$id['itmdesc']}</b></th>
</tr>
<tr style='background: gray;'>
<th colspan=2>Item Info</th>
</tr>
<tr style='background:gray'>
<th>Item Buy Price</th>
<th>Item Sell Price</th>
</tr>
<tr>
<td>
";
if ($id['itmbuyprice'])
{
echo money_formatter((int)$id['itmbuyprice']);
}
else
{
echo 'N/A';
}
echo '
</td>
<td>
';
if ($id['itmsellprice'])
{
echo money_formatter((int)$id['itmsellprice'])
. '
</td>
</tr>
</table>
';
}
else
{
echo '
N/A</td>
</tr>
</table>
';
}
}
$db->free_result($q);
}
$h->endpage();