chavdave26

iteminfo.php

Oct 17th, 2012
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.67 KB | None | 0 0
  1. <?php
  2.  
  3.  
  4. include "globals.php";
  5. //look up item
  6. $_GET['ID'] = abs((int) $_GET['ID']);
  7. $itmid=$_GET['ID'];
  8.  
  9. if(!$itmid)
  10. {
  11. print "
  12.  
  13.  
  14. <div id='mainOutput' style='text-align: center; color: red; width: 600px; border: 1px solid #222222; height: 70px;
  15. margin: 0 auto 10px; clear: both; position: relative; left: -20px; padding: 8px'>
  16.  
  17. Invalid item ID
  18.  
  19. <br><br>
  20.  
  21. <a href='inventory.php'><font color='white'>Back To Inventory</font></a>";
  22.  
  23. exit;
  24. }
  25. else
  26. {
  27. $r = sprintf("SELECT
  28. i.`itmid`,`itmtype`,`itmname`,`itmdesc`,`itmbuyprice`,`itmsellprice`,`weapon`,`armor`,
  29. it.`itmtypeid`,`itmtypename` FROM `items` i
  30. LEFT JOIN `itemtypes` it
  31. ON i.itmtype = '%d'
  32. WHERE i.itmid = %d
  33. LIMIT 1",
  34. $itmtypeid,
  35. mysql_real_escape_string($itmid));
  36. $q = $db->query($r);
  37.  
  38.  
  39.  
  40. if (!$db->num_rows($q))
  41. {
  42. print "
  43.  
  44. <div id='mainOutput' style='text-align: center; color: red; width: 600px; border: 1px solid #222222; height: 70px;
  45. margin: 0 auto 10px; clear: both; position: relative; left: -20px; padding: 8px'>
  46.  
  47. Invalid item ID
  48.  
  49. <br><br>
  50.  
  51. <a href='inventory.php'><font color='white'>Back To Inventory</font></a>
  52.  
  53. ";
  54. $h->endpage();
  55. exit;
  56.  
  57.  
  58. }
  59. else
  60. {
  61. $id=$db->fetch_row($q);
  62.  
  63. $item= mysql_fetch_object($db->query("SELECT `itmtypename` FROM `itemtypes` WHERE itmtypeid= ".$id['itmtype']." "));
  64.  
  65.  
  66.  
  67. $main = '
  68.  
  69. <div class="generalinfo_txt">
  70. <div><img src="images/info_left.jpg" alt="" /></div>
  71. <div class="info_mid"><h2 style="padding-top:10px;"> '.$id['itmname'].' </h2></div>
  72. <div><img src="images/info_right.jpg" alt="" /></div> </div>
  73. <div class="generalinfo_simple"><br> <br><br>
  74.  
  75.  
  76. <table width="75%" class="table" cellspacing="1">
  77. <tr>
  78. <th colspan=2><b><strong> Item Info</strong></b></th>
  79.  
  80.  
  81.  
  82. <tr>
  83. <td width="50%" class="style8">
  84. <font color=green><b>Category</b></font> <br /></td>
  85. <td width="50%" class="style8">
  86. <font color=green><b>Description</b></font></td>
  87. </tr><table width="75%" class="table" cellspacing="1">
  88. <tr>
  89. <td width="50%" class="style8">
  90. '.$item->itmtypename.' </td>
  91. <td width="50%" class="style8">
  92. '.$id['itmdesc'].'</b></td>
  93. </tr>
  94. <tr>
  95. <th>Item Buy Price</th>
  96. <th>Item Sell Price</th></tr>
  97. <tr>
  98.  
  99.  
  100. <td width="50%" class="style8">';
  101. print($main);
  102.  
  103. }
  104. if($id['itmbuyprice'])
  105. {
  106. echo money_formatter($id['itmbuyprice']);
  107. }
  108. else
  109. {
  110. echo "N/A";
  111. }
  112. print "</td><td width='50%' class='style8'>";
  113.  
  114. if($id['itmsellprice'])
  115. {
  116. echo money_formatter($id['itmsellprice']);
  117. }
  118. else
  119. {
  120. echo "N/A";
  121. }
  122. echo " </td></tr></table><P> ";
  123.  
  124. $formula=(int) $id['weapon'] / 2500 * 100;
  125. $armgreen=(int) $id['armor'] / 2500 * 100;
  126. $enopp = 100 - $forumla;
  127. $armred= 100 - $armgreen;
  128.  
  129.  
  130. echo"
  131. <table width=75% class='table' cellspacing='1'>
  132. <tr>
  133. <th width='50%'>Power</th>
  134. <th width='50%'>Defense</th>
  135. </tr>
  136. <tr><td width='50%'>";
  137. if($id['weapon'] > 0)
  138. {
  139. echo "
  140. <style type='text/css'>
  141. .style9 {
  142. text-align: center;
  143. }
  144. </style>
  145. </head>
  146.  
  147. <div class='style9'>
  148.  
  149. <br />
  150. Power: [<font color=red>{$id['weapon']}</font>] <br />
  151. <img src='images/redbar.png' width='$formula' height='12'><img src='images/blackbar.png' width='$enopp' height='12'><br /><P></div> ";
  152. }
  153. else
  154. {
  155. echo " <style type='text/css'>
  156. .style1a {
  157. text-align: center;
  158. }
  159. </style>
  160.  
  161.  
  162. <div class='style1a'>
  163. <br /> N/A </div>
  164. <P>
  165. ";
  166. }
  167. echo "</td><td width='50%'>";
  168. if($id['armor'] > 0)
  169. {
  170. echo " <style type='text/css'>
  171. .style9 {
  172. text-align: center;
  173. }
  174. </style>
  175.  
  176. <div class='style9'>
  177. <br />
  178. Defense: [<font color=green>{$id['armor']}</font>] <br />
  179. <img src='images/greenbar.png' width='$armgreen' height='12'><img src='images/blackbar.png' width='$armred' height='12'><br /><P>
  180. </div>
  181. ";
  182. }
  183. else
  184. {
  185. echo "<style type='text/css'>
  186. .style1a {
  187. text-align: center;
  188. }
  189. </style>
  190.  
  191.  
  192. <div class='style1a'>
  193. <br /> N/A </div>
  194. <P>
  195. ";
  196.  
  197. }
  198. echo " </td></tr></table></div><div><img src='images/generalinfo_btm.jpg' alt='' /></div><br></div></div></div></div></div> ";
  199. }
  200. $h->endpage();
  201. ?>
Advertisement
Add Comment
Please, Sign In to add comment