Guest User

Untitled

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