Guest User

Untitled

a guest
Feb 19th, 2018
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 50.40 KB | None | 0 0
  1. <?PHP
  2. // ALTER TABLE `z_shop_history_item` CHANGE `offer_id` `offer_id` VARCHAR( 255 ) NOT NULL;
  3. // UPDATE `z_shop_history_item`, `z_shop_offer` SET `z_shop_history_item`.`offer_id` = `z_shop_offer`.`offer_name` WHERE `z_shop_history_item`.`offer_id` = `z_shop_offer`.`id`;
  4. if($config['site']['shop_system'] == 1) {
  5. if($logged)
  6. $user_premium_points = $account_logged->getCustomField('premium_points');
  7. else
  8. $user_premium_points = 'Login first';
  9.  
  10. function getItemByID($id)
  11. {
  12. $id = (int) $id;
  13. $SQL = $GLOBALS['SQL'];
  14. $data = $SQL->query('SELECT * FROM '.$SQL->tableName('z_shop_offer').' WHERE '.$SQL->fieldName('id').' = '.$SQL->quote($id).';')->fetch();
  15. if ($data['offer_type'] == 'pacc')
  16. {
  17. $offer['id'] = $data['id'];
  18. $offer['type'] = $data['offer_type'];
  19. $offer['days'] = $data['count1'];
  20. $offer['points'] = $data['points'];
  21. $offer['description'] = $data['offer_description'];
  22. $offer['name'] = $data['offer_name'];
  23. }
  24. elseif ($data['offer_type'] == 'item')
  25. {
  26. $offer['id'] = $data['id'];
  27. $offer['type'] = $data['offer_type'];
  28. $offer['item_id'] = $data['itemid1'];
  29. $offer['item_count'] = $data['count1'];
  30. $offer['points'] = $data['points'];
  31. $offer['description'] = $data['offer_description'];
  32. $offer['name'] = $data['offer_name'];
  33. }
  34. elseif ($data['offer_type'] == 'addonitems')
  35. {
  36. $offer['id'] = $data['id'];
  37. $offer['type'] = $data['offer_type'];
  38. $offer['item_id'] = $data['itemid1'];
  39. $offer['item_count'] = $data['count1'];
  40. $offer['points'] = $data['points'];
  41. $offer['description'] = $data['offer_description'];
  42. $offer['name'] = $data['offer_name'];
  43. }
  44. elseif ($data['offer_type'] == 'vipdays')
  45. {
  46. $offer['id'] = $data['id'];
  47. $offer['type'] = $data['offer_type'];
  48. $offer['days'] = $data['count1'];
  49. $offer['points'] = $data['points'];
  50. $offer['description'] = $data['offer_description'];
  51. $offer['name'] = $data['offer_name'];
  52. }
  53. elseif ($data['offer_type'] == 'itemvip')
  54. {
  55. $offer['id'] = $data['id'];
  56. $offer['type'] = $data['offer_type'];
  57. $offer['item_id'] = $data['itemid1'];
  58. $offer['item_count'] = $data['count1'];
  59. $offer['points'] = $data['points'];
  60. $offer['description'] = $data['offer_description'];
  61. $offer['name'] = $data['offer_name'];
  62. }
  63. elseif ($data['offer_type'] == 'container')
  64. {
  65. $offer['id'] = $data['id'];
  66. $offer['type'] = $data['offer_type'];
  67. $offer['container_id'] = $data['itemid2'];
  68. $offer['container_count'] = $data['count2'];
  69. $offer['item_id'] = $data['itemid1'];
  70. $offer['item_count'] = $data['count1'];
  71. $offer['points'] = $data['points'];
  72. $offer['description'] = $data['offer_description'];
  73. $offer['name'] = $data['offer_name'];
  74. }
  75. elseif ($data['offer_type'] == 'unban')
  76. {
  77. $offer['id'] = $data['id'];
  78. $offer['type'] = $data['offer_type'];
  79. $offer['points'] = $data['points'];
  80. $offer['description'] = $data['offer_description'];
  81. $offer['name'] = $data['offer_name'];
  82. }
  83. elseif ($data['offer_type'] == 'redskull')
  84. {
  85. $offer['id'] = $data['id'];
  86. $offer['type'] = $data['offer_type'];
  87. $offer['points'] = $data['points'];
  88. $offer['description'] = $data['offer_description'];
  89. $offer['name'] = $data['offer_name'];
  90. }
  91. elseif ($data['offer_type'] == 'itemlogout')
  92. {
  93. $offer['id'] = $data['id'];
  94. $offer['type'] = $data['offer_type'];
  95. $offer['points'] = $data['points'];
  96. $offer['description'] = $data['offer_description'];
  97. $offer['pid'] = $data['pid'];
  98. $offer['count1'] = $data['count1'];
  99. $offer['item_id'] = $data['itemid1'];
  100. $offer['free_cap'] = $data['free_cap'];
  101. }
  102. elseif ($data['offer_type'] == 'changename')
  103. {
  104. $offer['id'] = $data['id'];
  105. $offer['type'] = $data['offer_type'];
  106. $offer['points'] = $data['points'];
  107. $offer['description'] = $data['offer_description'];
  108. $offer['name'] = $data['offer_name'];
  109. }
  110. return $offer;
  111. }
  112.  
  113. function getOfferArray()
  114. {
  115. $offer_list = $GLOBALS['SQL']->query('SELECT * FROM '.$GLOBALS['SQL']->tableName('z_shop_offer').';');
  116. $i_pacc = 0;
  117. $i_item = 0;
  118. $i_addonitems = 0;
  119. $i_vipdays = 0;
  120. $i_itemvip = 0;
  121. $i_container = 0;
  122. $i_unban = 0;
  123. $i_redskull = 0;
  124. $i_itemlogout = 0;
  125. $i_changename = 0;
  126. while($data = $offer_list->fetch()) {
  127. if ($data['offer_type'] == 'pacc')
  128. {
  129. $offer_array['pacc'][$i_pacc]['id'] = $data['id'];
  130. $offer_array['pacc'][$i_pacc]['days'] = $data['count1'];
  131. $offer_array['pacc'][$i_pacc]['points'] = $data['points'];
  132. $offer_array['pacc'][$i_pacc]['description'] = $data['offer_description'];
  133. $offer_array['pacc'][$i_pacc]['name'] = $data['offer_name'];
  134. $i_pacc++;
  135. }
  136. elseif ($data['offer_type'] == 'item')
  137. {
  138. $offer_array['item'][$i_item]['id'] = $data['id'];
  139. $offer_array['item'][$i_item]['item_id'] = $data['itemid1'];
  140. $offer_array['item'][$i_item]['item_count'] = $data['count1'];
  141. $offer_array['item'][$i_item]['points'] = $data['points'];
  142. $offer_array['item'][$i_item]['description'] = $data['offer_description'];
  143. $offer_array['item'][$i_item]['name'] = $data['offer_name'];
  144. $i_item++;
  145. }
  146. elseif ($data['offer_type'] == 'addonitems')
  147. {
  148. $offer_array['addonitems'][$i_itemvip]['id'] = $data['id'];
  149. $offer_array['addonitems'][$i_itemvip]['item_id'] = $data['itemid1'];
  150. $offer_array['addonitems'][$i_itemvip]['item_count'] = $data['count1'];
  151. $offer_array['addonitems'][$i_itemvip]['points'] = $data['points'];
  152. $offer_array['addonitems'][$i_itemvip]['description'] = $data['offer_description'];
  153. $offer_array['addonitems'][$i_itemvip]['name'] = $data['offer_name'];
  154. $i_addonitems++;
  155. }
  156. elseif ($data['offer_type'] == 'vipdays')
  157. {
  158. $offer_array['vipdays'][$i_vipdays]['id'] = $data['id'];
  159. $offer_array['vipdays'][$i_vipdays]['days'] = $data['count1'];
  160. $offer_array['vipdays'][$i_vipdays]['points'] = $data['points'];
  161. $offer_array['vipdays'][$i_vipdays]['description'] = $data['offer_description'];
  162. $offer_array['vipdays'][$i_vipdays]['name'] = $data['offer_name'];
  163. $i_vipdays++;
  164. }
  165. elseif ($data['offer_type'] == 'itemvip')
  166. {
  167. $offer_array['itemvip'][$i_itemvip]['id'] = $data['id'];
  168. $offer_array['itemvip'][$i_itemvip]['item_id'] = $data['itemid1'];
  169. $offer_array['itemvip'][$i_itemvip]['item_count'] = $data['count1'];
  170. $offer_array['itemvip'][$i_itemvip]['points'] = $data['points'];
  171. $offer_array['itemvip'][$i_itemvip]['description'] = $data['offer_description'];
  172. $offer_array['itemvip'][$i_itemvip]['name'] = $data['offer_name'];
  173. $i_itemvip++;
  174. }
  175. elseif ($data['offer_type'] == 'container')
  176. {
  177. $offer_array['container'][$i_container]['id'] = $data['id'];
  178. $offer_array['container'][$i_container]['container_id'] = $data['itemid2'];
  179. $offer_array['container'][$i_container]['container_count'] = $data['count2'];
  180. $offer_array['container'][$i_container]['item_id'] = $data['itemid1'];
  181. $offer_array['container'][$i_container]['item_count'] = $data['count1'];
  182. $offer_array['container'][$i_container]['points'] = $data['points'];
  183. $offer_array['container'][$i_container]['description'] = $data['offer_description'];
  184. $offer_array['container'][$i_container]['name'] = $data['offer_name'];
  185. $i_container++;
  186. }
  187. elseif ($data['offer_type'] == 'unban')
  188. {
  189. $offer_array['unban'][$i_unban]['id'] = $data['id'];
  190. $offer_array['unban'][$i_unban]['points'] = $data['points'];
  191. $offer_array['unban'][$i_unban]['description'] = $data['offer_description'];
  192. $offer_array['unban'][$i_unban]['name'] = $data['offer_name'];
  193. $i_unban++;
  194. }
  195. elseif ($data['offer_type'] == 'redskull')
  196. {
  197. $offer_array['redskull'][$i_redskull]['id'] = $data['id'];
  198. $offer_array['redskull'][$i_redskull]['points'] = $data['points'];
  199. $offer_array['redskull'][$i_redskull]['description'] = $data['offer_description'];
  200. $offer_array['redskull'][$i_redskull]['name'] = $data['offer_name'];
  201. $i_redskull++;
  202. }
  203. elseif ($data['offer_type'] == 'itemlogout')
  204. {
  205. $offer_array['itemlogout'][$i_itemlogout]['id'] = $data['id'];
  206. $offer_array['itemlogout'][$i_itemlogout]['points'] = $data['points'];
  207. $offer_array['itemlogout'][$i_itemlogout]['description'] = $data['offer_description'];
  208. $offer_array['itemlogout'][$i_itemlogout]['name'] = $data['offer_name'];
  209. $offer_array['itemlogout'][$i_itemlogout]['count1'] = $data['count1'];
  210. $offer_array['itemlogout'][$i_itemlogout]['pid'] = $data['pid'];
  211. $offer_array['itemlogout'][$i_itemlogout]['item_id'] = $data['itemid1'];
  212. $offer_array['itemlogout'][$i_itemlogout]['free_cap'] = $data['free_cap'];
  213. $i_itemlogout++;
  214. }
  215. elseif ($data['offer_type'] == 'changename')
  216. {
  217. $offer_array['changename'][$i_changename]['id'] = $data['id'];
  218. $offer_array['changename'][$i_changename]['points'] = $data['points'];
  219. $offer_array['changename'][$i_changename]['description'] = $data['offer_description'];
  220. $offer_array['changename'][$i_changename]['name'] = $data['offer_name'];
  221. $i_changename++;
  222. }
  223. }
  224. return $offer_array;
  225. }
  226.  
  227. if($action == '') {
  228. unset($_SESSION['viewed_confirmation_page']);
  229. $main_content .= '<h2><center>Welcome to '.$config['server']['serverName'].' Shop.</center></h2>';
  230. $offer_list = getOfferArray();
  231. //show list of vipdays offers
  232. if(count($offer_list['vipdays']) > 0) {
  233. $main_content .= '<center><table border="0" cellpadding="1" cellspacing="1" width="650"><tr width="650" bgcolor="#505050"><td colspan="3"><font color="white" size="4"><b>&nbsp;VIP Days</b></font></td></tr><tr bgcolor="#D4C0A1"><td width="50" align="center"><b>Picture</b></td><td width="350" align="left"><b>Description</b></td><td width="250" align="center"><b>Select product</b></td></tr>';
  234. foreach($offer_list['vipdays'] as $vipdays) {
  235. $main_content .= '<tr bgcolor="#F1E0C6"><td align="center">'.$vipdays['days'].'</td><td><b>'.$vipdays['name'].'</b> ('.$vipdays['points'].' points)<br />'.$vipdays['description'].'</td><td align="center">';
  236. if(!$logged) $main_content .= '<b>Login to buy</b>'; else
  237. $main_content .= '<form action="index.php?subtopic=shopsystem&action=select_player" method=POST><input type="hidden" name="buy_id" value="'.$vipdays['id'].'"><input type="submit" value="Buy '.$vipdays['name'].'"><br><b>for '.$vipdays['points'].' points</b></form>';
  238. $main_content .= '</td></tr>';
  239. }
  240. $main_content .= '</table><br />';
  241. }
  242. //show list of itemsvip offers
  243. if(count($offer_list['itemvip']) > 0) {
  244. $main_content .= '<center><table border="0" cellpadding="1" cellspacing="1" width="600"><tr width="600" bgcolor="#505050"><td colspan="3"><font color="white" size="4"><b>&nbsp;Special Items</b></font></td></tr><tr bgcolor="#D4C0A1"><td width="50" align="center"><b>Picture</b></td><td width="350" align="left"><b>Description</b></td><td width="250" align="center"><b>Select product</b></td></tr>';
  245. foreach($offer_list['itemvip'] as $itemvip) {
  246. $main_content .= '<tr bgcolor="#F1E0C6"><td align="center"><img src="item_images/'.$itemvip['id'].'.gif"></td><td><b>'.$itemvip['name'].'</b> ('.$itemvip['points'].' points)<br />'.$itemvip['description'].'</td><td align="center">';
  247. if(!$logged) $main_content .= '<b>Login to buy</b>'; else
  248. $main_content .= '<form action="index.php?subtopic=shopsystem&action=select_player" method=POST><input type="hidden" name="buy_id" value="'.$itemvip['id'].'"><input type="submit" value="Buy '.$itemvip['name'].'"><br><b>for '.$item['points'].' points</b></form>';
  249. $main_content .= '</td></tr>';
  250. }
  251. $main_content .= '</table><br />';
  252. }
  253. //show list of items offers
  254. if(count($offer_list['item']) > 0 or count($offer_list['container']) > 0 or count($offer_list['itemlogout']) > 0)
  255. $main_content .= '<center><table border="0" cellpadding="1" cellspacing="1" width="600"><tr width="600" bgcolor="#505050"><td colspan="3"><font color="white" size="4"><b>&nbsp;Items</b></font></td></tr><tr bgcolor="#D4C0A1"><td width="50" align="center"><b>Picture</b></td><td width="350" align="left"><b>Description</b></td><td width="250" align="center"><b>Select product</b></td></tr>';
  256. if(count($offer_list['item']) > 0) {
  257. foreach($offer_list['item'] as $item) {
  258. $main_content .= '<tr bgcolor="#F1E0C6"><td align="center"><img src="item_images/'.$item['id'].'.gif"></td><td><b>'.$item['name'].'</b> ('.$item['points'].' points)<br />'.$item['description'].'</td><td align="center">';
  259. if(!$logged) $main_content .= '<b>Login to buy</b>'; else
  260. $main_content .= '<form action="index.php?subtopic=shopsystem&action=select_player" method=POST><input type="hidden" name="buy_id" value="'.$item['id'].'"><input type="submit" value="Buy '.$item['name'].'"><br><b>for '.$item['points'].' points</b></form>';
  261. $main_content .= '</td></tr>';
  262. }
  263. $main_content .= '</table><br />';
  264. }
  265. //show list of addonitems offers
  266. if(count($offer_list['addonitems']) > 0) {
  267. $main_content .= '<center><table border="0" cellpadding="1" cellspacing="1" width="600"><tr width="600" bgcolor="#505050"><td colspan="3"><font color="white" size="4"><b>&nbsp;Addon Items</b></font></td></tr><tr bgcolor="#D4C0A1"><td width="50" align="center"><b>Picture</b></td><td width="350" align="left"><b>Description</b></td><td width="250" align="center"><b>Select product</b></td></tr>';
  268. foreach($offer_list['addonitems'] as $addonitems) {
  269. $main_content .= '<tr bgcolor="#F1E0C6"><td align="center"><img src="item_images/'.$addonitems['id'].'.gif"></td><td><b>'.$addonitems['name'].'</b> ('.$addonitems['points'].' points)<br />'.$addonitems['description'].'</td><td align="center">';
  270. if(!$logged) $main_content .= '<b>Login to buy</b>'; else
  271. $main_content .= '<form action="index.php?subtopic=shopsystem&action=select_player" method=POST><input type="hidden" name="buy_id" value="'.$addonitems['id'].'"><input type="submit" value="Buy '.$addonitems['name'].'"><br><b>for '.$item['points'].' points</b></form>';
  272. $main_content .= '</td></tr>';
  273. }
  274. $main_content .= '</table><br />';
  275. }
  276. //show list of containers offers
  277. if(count($offer_list['container']) > 0) {
  278. $main_content .= '<table border="0" cellpadding="1" cellspacing="1" width="600"><tr width="6000" bgcolor="#505050"><td colspan="3"><font color="white" size="4"><b>&nbsp;CONTAINERS WITH ITEMS</b></font></td></tr><tr bgcolor="#D4C0A1"><td width="50" align="center"><b>Picture</b></td><td width="350" align="left"><b>Description</b></td><td width="250" align="center"><b>Select product</b></td></tr>';
  279. foreach($offer_list['container'] as $container) {
  280. $main_content .= '<tr bgcolor="#F1E0C6"><td align="center"><img src="item_images/'.$container['id'].'.gif"></td><td><b>'.$container['name'].'</b> ('.$container['points'].' points)<br />'.$container['description'].'</td><td align="center">';
  281. if(!$logged) $main_content .= '<b>Login to buy</b>'; else
  282. $main_content .= '<form action="?subtopic=shopsystem&action=select_player" method=POST><input type="hidden" name="buy_id" value="'.$container['id'].'"><input type="submit" value="Buy '.$container['name'].'"><br><b>for '.$container['points'].' points</b></form>';
  283. $main_content .= '</td></tr>';
  284. }
  285. $main_content .= '</table><br />';
  286. }
  287. if(count($offer_list['itemlogout']) > 0) {
  288. $main_content .= '<table border="0" cellpadding="1" cellspacing="1" width="600"><tr width="600" bgcolor="#505050"><td colspan="3"><font color="white" size="4"><b>&nbsp;Receive Item on Logout</b></font></td></tr><tr bgcolor="#D4C0A1"><td width="50" align="center"><b>Picture</b></font></td><td width="350" align="left"><b>Description</b></font></td><td width="250" align="center"><b>Select product</b></font></td></tr>';
  289. foreach($offer_list['itemlogout'] as $itemlogout) {
  290. $main_content .= '<tr bgcolor="#F1E0C6"><td align="center"><img src="item_images/'.$itemlogout['id'].'.gif"></td><td><b>'.$itemlogout['name'].'</b> ('.$itemlogout['points'].' points)<br />'.$itemlogout['description'].'</td><td align="center">';
  291. if(!$logged) $main_content .= '<b>Login to buy</b>'; else
  292. $main_content .= '<form action="index.php?subtopic=shopsystem&action=select_player" method=POST><input type="hidden" name="buy_id" value="'.$itemlogout['id'].'"><input type="submit" value="Buy '.$itemlogout['name'].'"><br><b>for '.$itemlogout['points'].' points</b></form>';
  293. $main_content .= '</td></tr>';
  294. }
  295. $main_content .= '</table><br />';
  296. }
  297. if(count($offer_list['changename']) > 0 or count($offer_list['pacc']) > 0 or count($offer_list['redskull']) > 0 or count($offer_list['unban']) > 0 )
  298. $main_content .= '<center><table border="0" cellpadding="1" cellspacing="1" width="600"><tr width="600" bgcolor="#505050"><td colspan="3"><font color="white" size="4"><b>&nbsp;Others</b></font></td></tr><tr bgcolor="#D4C0A1"><td width="50" align="center"><b>#</b></td><td width="350" align="left"><b>Description</b></td><td width="250" align="center"><b>Select product</b></td></tr>';
  299. //Pacc
  300. if(count($offer_list['pacc']) > 0)
  301. foreach($offer_list['pacc'] as $pacc) {
  302. $main_content .= '<tr bgcolor="#F1E0C6"><td align="center">'.$pacc['days'].'</td><td><b>'.$pacc['name'].'</b> ('.$pacc['points'].' points)<br />'.$pacc['description'].'</td><td align="center">';
  303. if(!$logged) $main_content .= '<b>Login to buy</b>'; else
  304. $main_content .= '<form action="index.php?subtopic=shopsystem&action=select_player" method=POST><input type="hidden" name="buy_id" value="'.$pacc['id'].'"><input type="submit" value="Buy '.$pacc['name'].'"><br><b>for '.$pacc['points'].' points</b></form>';
  305. }
  306. //Change Name
  307. if(count($offer_list['changename']) > 0)
  308. foreach($offer_list['changename'] as $changename) {
  309. $main_content .= '<tr bgcolor="#F1E0C6"><td align="center">Change Name</td><td><b>'.$changename['name'].'</b> ('.$changename['points'].' points)<br />'.$changename['description'].'</td><td align="center">';
  310. if(!$logged) $main_content .= '<b>Login to buy</b>'; else
  311. $main_content .= '<form action="index.php?subtopic=shopsystem&action=select_player" method=POST><input type="hidden" name="buy_id" value="'.$changename['id'].'"><input type="submit" value="Buy '.$changename['name'].'"><br><b>for '.$changename['points'].' points</b></form>';
  312. }
  313. //Remove Red Skull
  314. if(count($offer_list['redskull']) > 0)
  315. foreach($offer_list['redskull'] as $redskull) {
  316. $main_content .= '<tr bgcolor="#F1E0C6"><td align="center"><img src="item_images/'.$redskull['id'].'.gif"></td><td><b>'.$redskull['name'].'</b> ('.$redskull['points'].' points)<br />'.$redskull['description'].'</td><td align="center">';
  317. if(!$logged) $main_content .= '<b>Login to buy</b>'; else
  318. $main_content .= '<form action="index.php?subtopic=shopsystem&action=select_player" method=POST><input type="hidden" name="buy_id" value="'.$redskull['id'].'"><input type="submit" value="Buy '.$redskull['name'].'"><br><b>for '.$redskull['points'].' points</b></form>';
  319. $main_content .= '</td></tr>';
  320. }
  321. //Unban
  322. if(count($offer_list['unban']) > 0)
  323. foreach($offer_list['unban'] as $unban){
  324. $main_content .= '<tr bgcolor="#F1E0C6"><td align="center">Unban</td><td><b>'.$unban['name'].'</b> ('.$unban['points'].' points)<br />'.$unban['description'].'</td><td align="center">';
  325. if(!$logged) $main_content .= '<b>Login to buy</b>'; else
  326. $main_content .= '<form action="index.php?subtopic=shopsystem&action=select_player" method=POST><input type="hidden" name="buy_id" value="'.$unban['id'].'"><input type="submit" value="Buy '.$unban['name'].'"><br><b>for '.$unban['points'].' points</b></form>';
  327. $main_content .= '</td></tr>';
  328. }
  329. $main_content .= '</table>';
  330. }
  331. elseif($action == 'select_player') {
  332. unset($_SESSION['viewed_confirmation_page']);
  333. if(!$logged) {
  334. $main_content .= 'Please login first.';
  335. } else {
  336. $buy_id = (int) $_REQUEST['buy_id'];
  337. if(empty($buy_id)) {
  338. $main_content .= 'Please <a href="index.php?subtopic=shopsystem">select item</a> first.';
  339. } else {
  340. $buy_offer = getItemByID($buy_id);
  341. if(isset($buy_offer['id'])) { //item exist in database
  342. if($buy_offer['type'] != 'changename') {
  343. if($user_premium_points >= $buy_offer['points']) {
  344. $main_content .= '<center><h2>Select player</h2><table border="0" cellpadding="1" cellspacing="1" width="650">
  345. <tr bgcolor="#505050"><td colspan="2"><font color="white" size="4"><b>Selected offer</b></font></td></tr>
  346. <tr bgcolor="#F1E0C6"><td width="100"><b>Name:</b></td><td width="550">'.$buy_offer['name'].'</td></tr>
  347. <tr bgcolor="#D4C0A1"><td width="100"><b>Description:</b></td><td width="550">'.$buy_offer['description'].'</td></tr>
  348. </table><br /><form action="index.php?subtopic=shopsystem&action=confirm_transaction" method=POST><input type="hidden" name="buy_id" value="'.$buy_id.'">
  349. <table border="0" cellpadding="1" cellspacing="1" width="650">
  350. <tr bgcolor="#505050"><td colspan="2"><font color="white" size="4"><b>Give item to a player from your account</b></font></td></tr>
  351. <tr bgcolor="#F1E0C6"><td width="110"><b>Name:</b></td><td width="550"><select name="buy_name">';
  352. $players_from_logged_acc = $account_logged->getPlayersList();
  353. if(count($players_from_logged_acc) > 0) {
  354. $players_from_logged_acc->orderBy('name');
  355. foreach($players_from_logged_acc as $player)
  356. $main_content .= '<option>'.$player->getName().'</option>';
  357. } else {
  358. $main_content .= 'You don\'t have any character on your account.';
  359. }
  360. $main_content .= '</select>&nbsp;<input type="submit" value="Give"></td></tr></table>
  361. </form><br /><form action="index.php?subtopic=shopsystem&action=confirm_transaction" method=POST><input type="hidden" name="buy_id" value="'.$buy_id.'">
  362. <table border="0" cellpadding="1" cellspacing="1" width="650">
  363. <tr bgcolor="#505050"><td colspan="2"><font color="white" size="4"><b>Give item to other player</b></font></td></tr>
  364. <tr bgcolor="#D4C0A1"><td width="110"><b>To player:</b></td><td width="550"><input type="text" name="buy_name"> - name of the player who should get item</td></tr>
  365. <tr bgcolor="#F1E0C6"><td width="110"><b>From:</b></td><td width="550"><input type="text" name="buy_from">&nbsp;<input type="submit" value="Give"> - your nick, \'empty\' = Anonymous</td></tr>
  366. </table><br /></form>';
  367. } else {
  368. $main_content .= 'For this item you need <b>'.$buy_offer['points'].'</b> points.<br>You have only <b>'.$user_premium_points.'</b> premium points. Please <a href="index.php?subtopic=shopsystem">select other item</a> or buy premium points.';
  369. }
  370. } else {
  371. $main_content .= '<center><h2>Change Name</h2><form action="index.php?subtopic=shopsystem&action=confirm_transaction" method=POST><input type="hidden" name="buy_id" value="'.$buy_id.'">
  372. <table border="0" cellpadding="1" cellspacing="1" width="650"><tr bgcolor="#505050"><td colspan="2"><font color="white" size="4"><b>Change Name:</b></font></td></tr>
  373. <tr bgcolor="#D4C0A1"><td width="110"><b>Name:</b></td><td width="550"><select name="buy_name">';
  374. $players_from_logged_acc = $account_logged->getPlayersList();
  375. if(count($players_from_logged_acc) > 0) {
  376. $players_from_logged_acc->orderBy('name');
  377. foreach($players_from_logged_acc as $player) {
  378. $main_content .= '<option>'.$player->getName().'</option>';
  379. }
  380. } else {
  381. $main_content .= 'You don\'t have any character on your account.';
  382. }
  383. $main_content .= '</select></td></tr><tr bgcolor="#F1E0C6"><td width="110"><b>New name:</b></td><td width="550"><input type="text" name="buy_from">&nbsp;<input type="submit" value="Change Name"></td></tr></table><br /></form>';
  384. }
  385. } else {
  386. $main_content .= 'Offer with ID <b>'.$buy_id.'</b> doesn\'t exist. Please <a href="index.php?subtopic=shopsystem">select item</a> again.';
  387. }
  388. }
  389. }
  390. }
  391. elseif($action == 'confirm_transaction') {
  392. if(!$logged) {
  393. $main_content .= 'Please login first.';
  394. } else {
  395. $buy_id = (int) $_POST['buy_id'];
  396. $buy_name = stripslashes(urldecode($_POST['buy_name']));
  397. $buy_from = stripslashes(urldecode($_POST['buy_from']));
  398. if(empty($buy_id)) {
  399. $main_content .= 'Please <a href="index.php?subtopic=shopsystem">select item</a> first.';
  400. } else {
  401. if($buy_offer['type'] == 'changename'){
  402. if(!check_name_new_char($buy_from)) {
  403. $main_content .= 'Invalid name format of new name.';
  404. }
  405. } else {
  406. $buy_offer = getItemByID($buy_id);
  407. $check_name_in_database = $ots->createObject('Player');
  408. $check_name_in_database->find($buy_from);
  409. if($buy_offer['type'] == 'changename'){
  410. if(!$check_name_in_database->isLoaded()) {
  411. }
  412. }
  413. if(isset($buy_offer['id'])) { //item exist in database
  414. if($user_premium_points >= $buy_offer['points']) {
  415. if(check_name($buy_name)) {
  416. $buy_player = new OTS_Player();
  417. $buy_player->find($buy_name);
  418. if($buy_player->isLoaded()) {
  419. $buy_player_account = $buy_player->getAccount();
  420. if($_SESSION['viewed_confirmation_page'] == 'yes' && $_POST['buy_confirmed'] == 'yes') {
  421. if($buy_offer['type'] == 'pacc') {
  422. $player_vip_time = $buy_player_account->getCustomField('vip_time');
  423. $player_lastlogin = $buy_player_account->getCustomField('lastday');
  424. $save_transaction = 'INSERT INTO '.$SQL->tableName('z_shop_history_pacc').' (id, to_name, to_account, from_nick, from_account, price, pacc_days, trans_state, trans_start, trans_real) VALUES (NULL, '.$SQL->quote($buy_player->getName()).', '.$SQL->quote($buy_player_account->getId()).', '.$SQL->quote($buy_from).', '.$SQL->quote($account_logged->getId()).', '.$SQL->quote($buy_offer['points']).', '.$SQL->quote($buy_offer['days']).', \'realized\', '.$SQL->quote(time()).', '.$SQL->quote(time()).');';
  425. $SQL->query($save_transaction);
  426. if($player_vip_time > 0)
  427. $buy_player_account->setCustomField('vip_time', $player_vip_time + $buy_offer['days'] * 86400);
  428. else
  429. $buy_player_account->setCustomField('vip_time', time() + $buy_offer['days'] * 86400);
  430. $buy_player_account->setCustomField('premium_points', $user_premium_points-$buy_offer['points']);
  431. $user_premium_points = $user_premium_points - $buy_offer['points'];
  432. if ($player_vip_days >= 1) {
  433. }
  434. $main_content .= '<center><h2>VIP Days added!</h2><b>'.$buy_offer['days'].' days</b> of VIP days added to the account of player <b>'.$buy_player->getName().'</b> for <b>'.$buy_offer['points'].' premium points</b> from your account.<br />Now you have <b>'.$user_premium_points.' premium points</b>.<br><br><a href="index.php?subtopic=shopsystem">Go to Shop Site</a><br>';
  435. }
  436. elseif($buy_offer['type'] == 'unban') {
  437. $my_acc_id = $account_logged->getCustomField('id');
  438. $datadata = $SQL->query('SELECT * FROM '.$SQL->tableName('bans').' WHERE value = '.$my_acc_id.';')->fetch();
  439. if($datadata['value'] == $my_acc_id) {
  440. if($SQL->query('DELETE FROM bans WHERE value= '.$my_acc_id.' LIMIT 1;')) {
  441. } else {
  442. $SQL->query('DELETE FROM bans WHERE account= '.$my_acc_id.' LIMIT 1;');
  443. }
  444. $account_logged->setCustomField('premium_points', $user_premium_points-$buy_offer['points']);
  445. $user_premium_points = $user_premium_points - $buy_offer['points'];
  446. $main_content .= '<center><h2>Ban Deleted!</h2><b>Your account has been unbanned for '.$buy_offer['points'].' premium points</b> from your account.
  447. <br>Now you have <b>'.$user_premium_points.' premium points</b>.<br><br><a href="index.php?subtopic=shopsystem">Go to Shop Site</a><br>';
  448. } else {
  449. $main_content .= '<center><b>You don\'t have any bans in your account!</b><br><br><a href="index.php?subtopic=shopsystem">Go back</a><br>';
  450. }
  451. }
  452. ////////////////////////////////
  453. elseif($buy_offer['type'] == 'itemlogout') {
  454. $my_acc_id = $buy_player->getCustomField('id');
  455. $playerinfo = $SQL->query('SELECT * FROM '.$SQL->tableName('players').' WHERE id = '.$my_acc_id.';')->fetch();
  456. $playerslot = $SQL->query('SELECT * FROM '.$SQL->tableName('player_items').' WHERE player_id = '.$my_acc_id.';')->fetch();
  457. if($playerinfo['online'] == '0') {
  458. if ($playerslot['pid'] != '10') {
  459. if ($datadata['cap'] >= $SQL->quote($buy_offer['free_cap'])) {
  460. $SQL->query('INSERT INTO player_items (player_id, pid, itemtype, count) VALUES ('.$my_acc_id.', '.$SQL->quote($buy_offer['pid']).', '.$SQL->quote($buy_offer['item_id']).', '.$SQL->quote($buy_offer['count1']).');');
  461. $account_logged->setCustomField('premium_points', $user_premium_points-$buy_offer['points']);
  462. $user_premium_points = $user_premium_points - $buy_offer['points'];
  463. $main_content .= '<h2>Item received to player: '.$buy_player->getName().'!</h2><br>Now you have <b>'.$user_premium_points.' premium points</b>.
  464. <br><a href="index.php?subtopic=shopsystem">Go to Shop Site</a>';
  465. } else {
  466. $main_content .= '<b>You need '.$SQL->quote($buy_offer['free_cap']).' or more of cap!</b><br><a href="index.php?subtopic=shopsystem">Go back</a>';
  467. }
  468. } else {
  469. $main_content .= '<b>Please leave the arrow slot in blank to receive item!</b><br><a href="index.php?subtopic=shopsystem">Go back</a>';
  470. }
  471. } else {
  472. $main_content .= '<b>You need to be offline!</b><br><a href="index.php?subtopic=shopsystem">Go back</a>';
  473. }
  474. }
  475. ////////////////////////////////
  476. elseif($buy_offer['type'] == 'changename') {
  477. $my_acc_id = $buy_player->getCustomField('id');
  478. $playerinfo = $SQL->query('SELECT * FROM '.$SQL->tableName('players').' WHERE '.$SQL->fieldName('id').' = '.$my_acc_id.';')->fetch();
  479. $checkname = $SQL->query('SELECT * FROM '.$SQL->tableName('players').' WHERE '.$SQL->fieldName('name').' = '. $SQL->quote($buy_from) .';')->fetch();
  480. if($playerinfo['online'] == '0') {
  481. if($checkname == false) {
  482. $SQL->query('UPDATE `players` SET `name` = '. $SQL->quote($buy_from) .' WHERE `id` = '. $my_acc_id.' ;');
  483. $account_logged->setCustomField('premium_points', $user_premium_points-$buy_offer['points']);
  484. $user_premium_points = $user_premium_points - $buy_offer['points'];
  485. $main_content .= '<center><h2>Your name has been changed to '.$buy_from.'.</h2><br><b>You have '.$user_premium_points.' premium points left</b>.
  486. <br><br><a href="index.php?subtopic=shopsystem">Go to Shop Site</a><br>';
  487. } else {
  488. $main_content .= '<center><h2>Sorry, the name "<i>'.$buy_from.'</i>" does already exist.<br>Please select another name.</h2><br>';
  489. }
  490. } else {
  491. $main_content .= '<center><h2>'.$buy_name.' has to be offline to complete transaction.</h2><br><br><a href="index.php?subtopic=shopsystem">Go back</a><br>';
  492. }
  493. }
  494. ////////////////////////////////
  495. elseif($buy_offer['type'] == 'redskull') {
  496. $my_acc_id = $buy_player->getCustomField('id');
  497. $playerinfo = $SQL->query('SELECT * FROM '.$SQL->tableName('players').' WHERE '.$SQL->fieldName('id').' = '.$my_acc_id.';')->fetch();
  498. if($playerinfo['skull'] == '4' AND $playerinfo['online'] >= '0' AND $playerinfo['skulltime'] > '0') {
  499. $SQL->query('UPDATE killers SET unjustified=0 WHERE id IN (SELECT kill_id FROM player_killers WHERE player_id='. $my_acc_id .');');
  500. $SQL->query('UPDATE players SET skulltime=0, skull=0 WHERE id='. $my_acc_id .';');
  501. $account_logged->setCustomField('premium_points', $user_premium_points-$buy_offer['points']);
  502. $user_premium_points = $user_premium_points - $buy_offer['points'];
  503. $main_content .= '<center><h2>RedSkull Removed!</h2><br><b>Your redskull has been removed from the player '.$buy_player->getName().'.</b>
  504. <br>Now you have<b> '.$user_premium_points.' premium points</b>.<br><br><a href="index.php?subtopic=shopsystem">Go to Shop Site</a><br>';
  505. } else {
  506. $main_content .= '<center><b>'.$buy_player->getName().' has to be offline or have redskull to complete transaction!.</b><br><br><a href="index.php?subtopic=shopsystem">Go back</a><br>';
  507. }
  508. }
  509. //////////////////////////
  510. elseif($buy_offer['type'] == 'item') {
  511. $sql = 'INSERT INTO '.$SQL->tableName('z_ots_comunication').' (id, name, type, action, param1, param2, param3, param4, param5, param6, param7, delete_it) VALUES (NULL, '.$SQL->quote($buy_player->getName()).', \'login\', \'give_item\', '.$SQL->quote($buy_offer['item_id']).', '.$SQL->quote($buy_offer['item_count']).', \'\', \'\', \'item\', '.$SQL->quote($buy_offer['name']).', \'\', \'1\');';
  512. $SQL->query($sql);
  513. $save_transaction = 'INSERT INTO '.$SQL->tableName('z_shop_history_item').' (id, to_name, to_account, from_nick, from_account, price, offer_id, trans_state, trans_start, trans_real) VALUES ('.$SQL->lastInsertId().', '.$SQL->quote($buy_player->getName()).', '.$SQL->quote($buy_player_account->getId()).', '.$SQL->quote($buy_from).', '.$SQL->quote($account_logged->getId()).', '.$SQL->quote($buy_offer['points']).', '.$SQL->quote($buy_offer['name']).', \'wait\', '.$SQL->quote(time()).', \'0\');';
  514. $SQL->query($save_transaction);
  515. $account_logged->setCustomField('premium_points', $user_premium_points-$buy_offer['points']);
  516. $user_premium_points = $user_premium_points - $buy_offer['points'];
  517. $main_content .= '<center><h2>Item added!</h2><b>'.$buy_offer['name'].'</b> added to player <b>'.$buy_player->getName().'</b> for <b>'.$buy_offer['points'].' premium points</b> from your account.<br>Now you have <b>'.$user_premium_points.' premium points</b>.<br><br><a href="index.php?subtopic=shopsystem">GO TO MAIN SHOP SITE</a><br>';
  518. }
  519. if($buy_offer['type'] == 'vipdays') {
  520. $player_vip_time = $buy_player_account->getCustomField('vip_time');
  521. $player_lastlogin = $buy_player_account->getCustomField('lastday');
  522. $save_transaction = 'INSERT INTO '.$SQL->tableName('z_shop_history_pacc').' (id, to_name, to_account, from_nick, from_account, price, pacc_days, trans_state, trans_start, trans_real) VALUES (NULL, '.$SQL->quote($buy_player->getName()).', '.$SQL->quote($buy_player_account->getId()).', '.$SQL->quote($buy_from).', '.$SQL->quote($account_logged->getId()).', '.$SQL->quote($buy_offer['points']).', '.$SQL->quote($buy_offer['days']).', \'realized\', '.$SQL->quote(time()).', '.$SQL->quote(time()).');';
  523. $SQL->query($save_transaction);
  524. if($player_vip_time > 0)
  525. $buy_player_account->setCustomField('vip_time', $player_vip_time + $buy_offer['days'] * 86400);
  526. else
  527. $buy_player_account->setCustomField('vip_time', time() + $buy_offer['days'] * 86400);
  528. $account_logged->setCustomField('premium_points', $user_premium_points-$buy_offer['points']);
  529. $user_premium_points = $user_premium_points - $buy_offer['points'];
  530. if ($player_vip_days >= 1) {
  531. }
  532. $main_content .= '<center><h2>VIP Days added!</h2><b>'.$buy_offer['days'].' days</b> of VIP days added to the account of player <b>'.$buy_player->getName().'</b> for <b>'.$buy_offer['points'].' premium points</b> from your account.<br />Now you have <b>'.$user_premium_points.' premium points</b>.<br><br><a href="index.php?subtopic=shopsystem">Go to Shop Site</a><br>';
  533. }
  534. elseif($buy_offer['type'] == 'itemvip') {
  535. $sql = 'INSERT INTO '.$SQL->tableName('z_ots_comunication').' (id, name, type, action, param1, param2, param3, param4, param5, param6, param7, delete_it) VALUES (NULL, '.$SQL->quote($buy_player->getName()).', \'login\', \'give_item\', '.$SQL->quote($buy_offer['item_id']).', '.$SQL->quote($buy_offer['megaitems_count']).', \'\', \'\', \'megaitems\', '.$SQL->quote($buy_offer['name']).', \'\', \'1\');';
  536. $SQL->query($sql);
  537. $save_transaction = 'INSERT INTO '.$SQL->tableName('z_shop_history_item').' (id, to_name, to_account, from_nick, from_account, price, offer_id, trans_state, trans_start, trans_real) VALUES ('.$SQL->lastInsertId().', '.$SQL->quote($buy_player->getName()).', '.$SQL->quote($buy_player_account->getId()).', '.$SQL->quote($buy_from).', '.$SQL->quote($account_logged->getId()).', '.$SQL->quote($buy_offer['points']).', '.$SQL->quote($buy_offer['name']).', \'wait\', '.$SQL->quote(time()).', \'0\');';
  538. $SQL->query($save_transaction);
  539. $account_logged->setCustomField('premium_points', $user_premium_points-$buy_offer['points']);
  540. $user_premium_points = $user_premium_points - $buy_offer['points'];
  541. $main_content .= '<center><h2>Mega Item added!</h2><b>'.$buy_offer['name'].'</b> added to player <b>'.$buy_player->getName().'</b> for <b>'.$buy_offer['points'].' premium points</b> from your account.<br>Now you have <b>'.$user_premium_points.' premium points</b>.<br><br><a href="index.php?subtopic=shopsystem">GO TO MAIN SHOP SITE</a><br>';
  542. }
  543. elseif($buy_offer['type'] == 'addonitems') {
  544. $sql = 'INSERT INTO '.$SQL->tableName('z_ots_comunication').' (id, name, type, action, param1, param2, param3, param4, param5, param6, param7, delete_it) VALUES (NULL, '.$SQL->quote($buy_player->getName()).', \'login\', \'give_item\', '.$SQL->quote($buy_offer['item_id']).', '.$SQL->quote($buy_offer['addonitems_count']).', \'\', \'\', \'addonitems\', '.$SQL->quote($buy_offer['name']).', \'\', \'1\');';
  545. $SQL->query($sql);
  546. $save_transaction = 'INSERT INTO '.$SQL->tableName('z_shop_history_item').' (id, to_name, to_account, from_nick, from_account, price, offer_id, trans_state, trans_start, trans_real) VALUES ('.$SQL->lastInsertId().', '.$SQL->quote($buy_player->getName()).', '.$SQL->quote($buy_player_account->getId()).', '.$SQL->quote($buy_from).', '.$SQL->quote($account_logged->getId()).', '.$SQL->quote($buy_offer['points']).', '.$SQL->quote($buy_offer['name']).', \'wait\', '.$SQL->quote(time()).', \'0\');';
  547. $SQL->query($save_transaction);
  548. $account_logged->setCustomField('premium_points', $user_premium_points-$buy_offer['points']);
  549. $user_premium_points = $user_premium_points - $buy_offer['points'];
  550. $main_content .= '<center><h2>Addon item added!</h2><b>'.$buy_offer['name'].'</b> added to player <b>'.$buy_player->getName().'</b> for <b>'.$buy_offer['points'].' premium points</b> from your account.<br>Now you have <b>'.$user_premium_points.' premium points</b>.<br><br><a href="index.php?subtopic=shopsystem">GO TO MAIN SHOP SITE</a><br>';
  551. }
  552. elseif($buy_offer['type'] == 'container') {
  553. $sql = 'INSERT INTO '.$SQL->tableName('z_ots_comunication').' (id, name, type, action, param1, param2, param3, param4, param5, param6, param7, delete_it) VALUES (NULL, '.$SQL->quote($buy_player->getName()).', \'login\', \'give_item\', '.$SQL->quote($buy_offer['item_id']).', '.$SQL->quote($buy_offer['item_count']).', '.$SQL->quote($buy_offer['container_id']).', '.$SQL->quote($buy_offer['container_count']).', \'container\', '.$SQL->quote($buy_offer['name']).', \'\', \'1\');';
  554. $SQL->query($sql);
  555. $save_transaction = 'INSERT INTO '.$SQL->tableName('z_shop_history_item').' (id, to_name, to_account, from_nick, from_account, price, offer_id, trans_state, trans_start, trans_real) VALUES ('.$SQL->lastInsertId().', '.$SQL->quote($buy_player->getName()).', '.$SQL->quote($buy_player_account->getId()).', '.$SQL->quote($buy_from).', '.$SQL->quote($account_logged->getId()).', '.$SQL->quote($buy_offer['points']).', '.$SQL->quote($buy_offer['name']).', \'wait\', '.$SQL->quote(time()).', \'0\');';
  556. $SQL->query($save_transaction);
  557. $account_logged->setCustomField('premium_points', $user_premium_points-$buy_offer['points']);
  558. $user_premium_points = $user_premium_points - $buy_offer['points'];
  559. $main_content .= '<center><h2>Container of items added!</h2><b>'.$buy_offer['name'].'</b> added to player <b>'.$buy_player->getName().'</b> for <b>'.$buy_offer['points'].' premium points</b> from your account.<br />Now you have <b>'.$user_premium_points.' premium points</b>.<br><br><a href="index.php?subtopic=shopsystem">GO TO MAIN SHOP SITE</a><br>';
  560. }
  561. } else {
  562. if($buy_offer['type'] != 'changename') {
  563. $set_session = TRUE;
  564. $_SESSION['viewed_confirmation_page'] = 'yes';
  565. $main_content .= '<center><h2>Confirm transaction</h2>
  566. <table border="0" cellpadding="1" cellspacing="1" width="700">
  567. <tr bgcolor="#505050"><td colspan="3"><font color="white" size="4"><b>Confirm transaction</b></font></td></tr>
  568. <tr bgcolor="#D4C0A1"><td width="100"><b>Name:</b></td><td width="550" colspan="2">'.$buy_offer['name'].'</td></tr>
  569. <tr bgcolor="#F1E0C6"><td width="100"><b>Description:</b></td><td width="550" colspan="2">'.$buy_offer['description'].'</td></tr>
  570. <tr bgcolor="#D4C0A1"><td width="100"><b>Cost:</b></td><td width="550" colspan="2"><b>'.$buy_offer['points'].' premium points</b> from your account</td></tr>
  571. <tr bgcolor="#F1E0C6"><td width="100"><b>For Player:</b></td><td width="550" colspan="2"><font color="red">'.$buy_player->getName().'</font></td></tr>
  572. <tr bgcolor="#D4C0A1"><td width="100"><b>From:</b></td><td width="550" colspan="2"><font color="red">'.$buy_from.'</font></td></tr>
  573. <tr bgcolor="#F1E0C6"><td width="100"><b>Transaction?</b></td><td width="275" align="left">
  574. <form action="index.php?subtopic=shopsystem&action=confirm_transaction" method="POST"><input type="hidden" name="buy_confirmed" value="yes"><input type="hidden" name="buy_id" value="'.$buy_id.'"><input type="hidden" name="buy_from" value="'.urlencode($new_name).'"><input type="hidden" name="buy_name" value="'.urlencode($buy_name).'"><input type="submit" value="Accept"></form></td>
  575. <td align="right"><form action="index.php?subtopic=shopsystem" method="POST"><input type="submit" value="Cancel"></form></td></tr>
  576. </table>';
  577. } else {
  578. $set_session = TRUE;
  579. $_SESSION['viewed_confirmation_page'] = 'yes';
  580. $main_content .= '<center><h2>Confirm Name Changing</h2>
  581. <table border="0" cellpadding="1" cellspacing="1" width="700">
  582. <tr bgcolor="#505050"><td colspan="3"><font color="white" size="4"><b>Confirm transaction</b></font></td></tr>
  583. <tr bgcolor="#D4C0A1"><td width="130"><b>Name:</b></td><td width="550" colspan="2">'.$buy_offer['name'].'</td></tr>
  584. <tr bgcolor="#F1E0C6"><td width="130"><b>Description:</b></td><td width="550" colspan="2">'.$buy_offer['description'].'</td></tr>
  585. <tr bgcolor="#D4C0A1"><td width="130"><b>Cost:</b></td><td width="550" colspan="2"><b>'.$buy_offer['points'].' premium points</b> from your account</td></tr>
  586. <tr bgcolor="#F1E0C6"><td width="130"><b>Current Name:</b></td><td width="550" colspan="2"><font color="red">'.$buy_player->getName().'</font></td></tr>
  587. <tr bgcolor="#D4C0A1"><td width="130"><b>New Name:</b></td><td width="550" colspan="2"><font color="red">'.$buy_from.'</font></td></tr>
  588. <tr bgcolor="#F1E0C6"><td width="130"><b>Change Name?</b></td><td width="275" align="left">
  589. <form action="index.php?subtopic=shopsystem&action=confirm_transaction" method="POST"><input type="hidden" name="buy_confirmed" value="yes"><input type="hidden" name="buy_id" value="'.$buy_id.'"><input type="hidden" name="buy_from" value="'.urlencode($buy_from).'"><input type="hidden" name="buy_name" value="'.urlencode($buy_name).'"><input type="submit" value="Accept"></form></td>
  590. <td align="right"><form action="index.php?subtopic=shopsystem" method="POST"><input type="submit" value="Cancel"></form></td></tr>
  591. </table>';
  592. }
  593. }
  594. } else {
  595. $main_content .= 'Player with name <b>'.$buy_name.'</b> doesn\'t exist. Please <a href="index.php?subtopic=shopsystem&action=select_player&buy_id='.$buy_id.'">select other name</a>.';
  596. }
  597. } else {
  598. $main_content .= 'Invalid name format. Please <a href="index.php?subtopic=shopsystem&action=select_player&buy_id='.$buy_id.'">select other name</a> or contact with administrator.';
  599. }
  600. } else {
  601. $main_content .= 'For this item you need <b>'.$buy_offer['points'].'</b> points. You have only <b>'.$user_premium_points.'</b> premium points. Please <a href="index.php?subtopic=shopsystem">select other item</a> or buy premium points.';
  602. }
  603. } else {
  604. $main_content .= 'Offer with ID <b>'.$buy_id.'</b> doesn\'t exist. Please <a href="index.php?subtopic=shopsystem">select item</a> again.';
  605. }
  606. }
  607. }
  608. }
  609. if(!$set_session) {
  610. unset($_SESSION['viewed_confirmation_page']);
  611. }
  612. }
  613.  
  614. elseif($action == 'show_history') {
  615. if(!$logged) {
  616. $main_content .= 'Please login first.';
  617. } else{
  618. $items_history_received = $SQL->query('SELECT * FROM '.$SQL->tableName('z_shop_history_item').' WHERE '.$SQL->fieldName('to_account').' = '.$SQL->quote($account_logged->getId()).' OR '.$SQL->fieldName('from_account').' = '.$SQL->quote($account_logged->getId()).';');
  619. if(is_object($items_history_received)) {
  620. foreach($items_history_received as $item_received) {
  621. if($account_logged->getId() == $item_received['to_account'])
  622. $char_color = 'green';
  623. else
  624. $char_color = 'red';
  625. $items_received_text .= '<tr bgcolor="#F1E0C6"><td><font color="'.$char_color.'">'.$item_received['to_name'].'</font></td><td>';
  626. if($account_logged->getId() == $item_received['from_account'])
  627. $items_received_text .= '<i>Your account</i>';
  628. else
  629. $items_received_text .= $item_received['from_nick'];
  630. $items_received_text .= '</td><td>'.$item_received['offer_id'].'</td><td>'.date("j F Y, H:i:s", $item_received['trans_start']).'</td>';
  631. if($item_received['trans_real'] > 0)
  632. $items_received_text .= '<td>'.date("j F Y, H:i:s", $item_received['trans_real']).'</td>';
  633. else
  634. $items_received_text .= '<td><b><font color="red">Not realized yet.</font></b></td>';
  635. $items_received_text .= '</tr>';
  636. }
  637. }
  638. $paccs_history_received = $SQL->query('SELECT * FROM '.$SQL->tableName('z_shop_history_pacc').' WHERE '.$SQL->fieldName('to_account').' = '.$SQL->quote($account_logged->getId()).' OR '.$SQL->fieldName('from_account').' = '.$SQL->quote($account_logged->getId()).';');
  639. if(is_object($paccs_history_received)) {
  640. foreach($paccs_history_received as $pacc_received) {
  641. if($account_logged->getId() == $pacc_received['to_account'])
  642. $char_color = 'green';
  643. else
  644. $char_color = 'red';
  645. $paccs_received_text .= '<tr bgcolor="#F1E0C6"><td><font color="'.$char_color.'">'.$pacc_received['to_name'].'</font></td><td>';
  646. if($account_logged->getId() == $pacc_received['from_account'])
  647. $paccs_received_text .= '<i>Your account</i>';
  648. else
  649. $paccs_received_text .= $pacc_received['from_nick'];
  650. $paccs_received_text .= '</td><td>'.$pacc_received['pacc_days'].' days</td><td>'.$pacc_received['price'].' Points</td><td>'.date("j F Y, H:i:s", $pacc_received['trans_real']).'</td></tr>';
  651. }
  652. }
  653. $main_content .= '<center><h1>Transactions History</h1></center>';
  654. if(!empty($items_received_text))
  655. $main_content .= '<center><table BORDER=0 CELLPADDING=1 CELLSPACING=1 WIDTH=95%><tr width="100%" bgcolor="#505050"><td colspan="5"><font color="white" size="4"><b>&nbsp;Item Transactions</b></font></td></tr><tr bgcolor="#D4C0A1"><td><b>To:</b></td><td><b>From:</b></td><td><b>Offer name</b></td><td><b>Bought on page</b></td><td><b>Received on '.$config['server']['serverName'].'</b></td></tr>'.$items_received_text.'</table><br />';
  656. if(!empty($paccs_received_text))
  657. $main_content .= '<center><table BORDER=0 CELLPADDING=1 CELLSPACING=1 WIDTH=95%><tr width="100%" bgcolor="#505050"><td colspan="5"><font color="white" size="4"><b>&nbsp;Pacc Transactions</b></font></td></tr><tr bgcolor="#D4C0A1"><td><b>To:</b></td><td><b>From:</b></td><td><b>Duration</b></td><td><b>Cost</b></td><td><b>Added:</b></td></tr>'.$paccs_received_text.'</table><br />';
  658. if(empty($paccs_received_text) && empty($items_received_text))
  659. $main_content .= 'You did not buy/receive any items or PACC.';
  660. }
  661. }
  662. if(!$logged)
  663. $main_content .= 'Please login to see how much points you have.';
  664. else
  665. $main_content .= '<br><b><font color="green">You have premium points: </font></b>'.$user_premium_points;
  666. }
  667. else
  668. $main_content .= '<br><center><b>Shop System is currently disabled for this server.Please ask the admin for more information.</b></center>';
  669. ?>
Add Comment
Please, Sign In to add comment