getCustomField('premium_points'); else $user_premium_points = 'Login first'; function getItemByID($id) { $id = (int) $id; $SQL = $GLOBALS['SQL']; $data = $SQL->query('SELECT * FROM '.$SQL->tableName('z_shop_offer').' WHERE '.$SQL->fieldName('id').' = '.$SQL->quote($id).';')->fetch(); if ($data['offer_type'] == 'pacc') { $offer['id'] = $data['id']; $offer['type'] = $data['offer_type']; $offer['days'] = $data['count1']; $offer['points'] = $data['points']; $offer['description'] = $data['offer_description']; $offer['name'] = $data['offer_name']; } elseif ($data['offer_type'] == 'item') { $offer['id'] = $data['id']; $offer['type'] = $data['offer_type']; $offer['item_id'] = $data['itemid1']; $offer['item_count'] = $data['count1']; $offer['points'] = $data['points']; $offer['description'] = $data['offer_description']; $offer['name'] = $data['offer_name']; } elseif ($data['offer_type'] == 'vipdays') { $offer['id'] = $data['id']; $offer['type'] = $data['offer_type']; $offer['days'] = $data['count1']; $offer['points'] = $data['points']; $offer['description'] = $data['offer_description']; $offer['name'] = $data['offer_name']; } elseif ($data['offer_type'] == 'megaitems') { $offer['id'] = $data['id']; $offer['type'] = $data['offer_type']; $offer['item_id'] = $data['itemid1']; $offer['item_count'] = $data['count1']; $offer['points'] = $data['points']; $offer['description'] = $data['offer_description']; $offer['name'] = $data['offer_name']; } elseif ($data['offer_type'] == 'container') { $offer['id'] = $data['id']; $offer['type'] = $data['offer_type']; $offer['container_id'] = $data['itemid2']; $offer['container_count'] = $data['count2']; $offer['item_id'] = $data['itemid1']; $offer['item_count'] = $data['count1']; $offer['points'] = $data['points']; $offer['description'] = $data['offer_description']; $offer['name'] = $data['offer_name']; } elseif ($data['offer_type'] == 'unban') { $offer['id'] = $data['id']; $offer['type'] = $data['offer_type']; $offer['points'] = $data['points']; $offer['description'] = $data['offer_description']; $offer['name'] = $data['offer_name']; } elseif ($data['offer_type'] == 'redskull') { $offer['id'] = $data['id']; $offer['type'] = $data['offer_type']; $offer['points'] = $data['points']; $offer['description'] = $data['offer_description']; $offer['name'] = $data['offer_name']; } elseif ($data['offer_type'] == 'itemlogout') { $offer['id'] = $data['id']; $offer['type'] = $data['offer_type']; $offer['points'] = $data['points']; $offer['description'] = $data['offer_description']; $offer['pid'] = $data['pid']; $offer['count1'] = $data['count1']; $offer['item_id'] = $data['itemid1']; $offer['free_cap'] = $data['free_cap']; } elseif ($data['offer_type'] == 'changename') { $offer['id'] = $data['id']; $offer['type'] = $data['offer_type']; $offer['points'] = $data['points']; $offer['description'] = $data['offer_description']; $offer['name'] = $data['offer_name']; } return $offer; } function getOfferArray() { $offer_list = $GLOBALS['SQL']->query('SELECT * FROM '.$GLOBALS['SQL']->tableName('z_shop_offer').';'); $i_pacc = 0; $i_item = 0; $i_vipdays = 0; $i_megaitems = 0; $i_container = 0; $i_unban = 0; $i_redskull = 0; $i_itemlogout = 0; $i_changename = 0; while($data = $offer_list->fetch()) { if ($data['offer_type'] == 'pacc') { $offer_array['pacc'][$i_pacc]['id'] = $data['id']; $offer_array['pacc'][$i_pacc]['days'] = $data['count1']; $offer_array['pacc'][$i_pacc]['points'] = $data['points']; $offer_array['pacc'][$i_pacc]['description'] = $data['offer_description']; $offer_array['pacc'][$i_pacc]['name'] = $data['offer_name']; $i_pacc++; } elseif ($data['offer_type'] == 'item') { $offer_array['item'][$i_item]['id'] = $data['id']; $offer_array['item'][$i_item]['item_id'] = $data['itemid1']; $offer_array['item'][$i_item]['item_count'] = $data['count1']; $offer_array['item'][$i_item]['points'] = $data['points']; $offer_array['item'][$i_item]['description'] = $data['offer_description']; $offer_array['item'][$i_item]['name'] = $data['offer_name']; $i_item++; } elseif ($data['offer_type'] == 'vipdays') { $offer_array['vipdays'][$i_vipdays]['id'] = $data['id']; $offer_array['vipdays'][$i_vipdays]['days'] = $data['count1']; $offer_array['vipdays'][$i_vipdays]['points'] = $data['points']; $offer_array['vipdays'][$i_vipdays]['description'] = $data['offer_description']; $offer_array['vipdays'][$i_vipdays]['name'] = $data['offer_name']; $i_vipdays++; } elseif ($data['offer_type'] == 'megaitems') { $offer_array['megaitems'][$i_megaitems]['id'] = $data['id']; $offer_array['megaitems'][$i_megaitems]['item_id'] = $data['itemid1']; $offer_array['megaitems'][$i_megaitems]['item_count'] = $data['count1']; $offer_array['megaitems'][$i_megaitems]['points'] = $data['points']; $offer_array['megaitems'][$i_megaitems]['description'] = $data['offer_description']; $offer_array['megaitems'][$i_megaitems]['name'] = $data['offer_name']; $i_megaitems++; } elseif ($data['offer_type'] == 'container') { $offer_array['container'][$i_container]['id'] = $data['id']; $offer_array['container'][$i_container]['container_id'] = $data['itemid2']; $offer_array['container'][$i_container]['container_count'] = $data['count2']; $offer_array['container'][$i_container]['item_id'] = $data['itemid1']; $offer_array['container'][$i_container]['item_count'] = $data['count1']; $offer_array['container'][$i_container]['points'] = $data['points']; $offer_array['container'][$i_container]['description'] = $data['offer_description']; $offer_array['container'][$i_container]['name'] = $data['offer_name']; $i_container++; } elseif ($data['offer_type'] == 'unban') { $offer_array['unban'][$i_unban]['id'] = $data['id']; $offer_array['unban'][$i_unban]['points'] = $data['points']; $offer_array['unban'][$i_unban]['description'] = $data['offer_description']; $offer_array['unban'][$i_unban]['name'] = $data['offer_name']; $i_unban++; } elseif ($data['offer_type'] == 'redskull') { $offer_array['redskull'][$i_redskull]['id'] = $data['id']; $offer_array['redskull'][$i_redskull]['points'] = $data['points']; $offer_array['redskull'][$i_redskull]['description'] = $data['offer_description']; $offer_array['redskull'][$i_redskull]['name'] = $data['offer_name']; $i_redskull++; } elseif ($data['offer_type'] == 'itemlogout') { $offer_array['itemlogout'][$i_itemlogout]['id'] = $data['id']; $offer_array['itemlogout'][$i_itemlogout]['points'] = $data['points']; $offer_array['itemlogout'][$i_itemlogout]['description'] = $data['offer_description']; $offer_array['itemlogout'][$i_itemlogout]['name'] = $data['offer_name']; $offer_array['itemlogout'][$i_itemlogout]['count1'] = $data['count1']; $offer_array['itemlogout'][$i_itemlogout]['pid'] = $data['pid']; $offer_array['itemlogout'][$i_itemlogout]['item_id'] = $data['itemid1']; $offer_array['itemlogout'][$i_itemlogout]['free_cap'] = $data['free_cap']; $i_itemlogout++; } elseif ($data['offer_type'] == 'changename') { $offer_array['changename'][$i_changename]['id'] = $data['id']; $offer_array['changename'][$i_changename]['points'] = $data['points']; $offer_array['changename'][$i_changename]['description'] = $data['offer_description']; $offer_array['changename'][$i_changename]['name'] = $data['offer_name']; $i_changename++; } } return $offer_array; } if($action == '') { unset($_SESSION['viewed_confirmation_page']); $main_content .= '

Welcome to '.$config['server']['serverName'].' Shop.

Items comprados e depois duplicados são automaticamente deletados por sistemas implementados dentro do servidor.
Que fique bem claro que nós da Equipe não temos a obrigação e não iremos devolver items perdidos ou roubados!

'; $offer_list = getOfferArray(); //show list of items offers if(count($offer_list['vipdays']) > 0 or count($offer_list['container']) > 0 or count($offer_list['itemlogout']) > 0) $main_content .= '
'; if(count($offer_list['vipdays']) > 0) { foreach($offer_list['vipdays'] as $item) { $main_content .= ''; } $main_content .= '
 VIP DAYS
PictureDescriptionSelect product
'.$item['name'].' ('.$item['points'].' points)
'.$item['description'].'
'; if(!$logged) $main_content .= 'Login to buy'; else $main_content .= '

for '.$item['points'].' points
'; $main_content .= '

'; } //show list of items offers if(count($offer_list['megaitems']) > 0 or count($offer_list['container']) > 0 or count($offer_list['itemlogout']) > 0) $main_content .= '
'; if(count($offer_list['megaitems']) > 0) { foreach($offer_list['megaitems'] as $item) { $main_content .= ''; } $main_content .= '
 VIP ITEMS
PictureDescriptionSelect product
'.$item['name'].' ('.$item['points'].' points)
'.$item['description'].'
'; if(!$logged) $main_content .= 'Login to buy'; else $main_content .= '

for '.$item['points'].' points
'; $main_content .= '

'; } //show list of items offers if(count($offer_list['item']) > 0 or count($offer_list['container']) > 0 or count($offer_list['itemlogout']) > 0) $main_content .= '
'; if(count($offer_list['item']) > 0) { foreach($offer_list['item'] as $item) { $main_content .= ''; } $main_content .= '
 ITEMS
PictureDescriptionSelect product
'.$item['name'].' ('.$item['points'].' points)
'.$item['description'].'
'; if(!$logged) $main_content .= 'Login to buy'; else $main_content .= '

for '.$item['points'].' points
'; $main_content .= '

'; } //show list of containers offers if(count($offer_list['container']) > 0) { $main_content .= ''; foreach($offer_list['container'] as $container) { $main_content .= ''; } $main_content .= '
 CONTAINERS WITH ITEMS
PictureDescriptionSelect product
'.$container['name'].' ('.$container['points'].' points)
'.$container['description'].'
'; if(!$logged) $main_content .= 'Login to buy'; else $main_content .= '

for '.$container['points'].' points
'; $main_content .= '

'; } if(count($offer_list['itemlogout']) > 0) { $main_content .= ''; foreach($offer_list['itemlogout'] as $itemlogout) { $main_content .= ''; } $main_content .= '
 Receive Item on Logout
PictureDescriptionSelect product
'.$itemlogout['name'].' ('.$itemlogout['points'].' points)
'.$itemlogout['description'].'
'; if(!$logged) $main_content .= 'Login to buy'; else $main_content .= '

for '.$itemlogout['points'].' points
'; $main_content .= '

'; } if(count($offer_list['changename']) > 0 or count($offer_list['pacc']) > 0 or count($offer_list['redskull']) > 0 or count($offer_list['unban']) > 0 ) $main_content .= '
'; //Pacc if(count($offer_list['pacc']) > 0) foreach($offer_list['pacc'] as $pacc) { $main_content .= ''; } //Unban if(count($offer_list['unban']) > 0) foreach($offer_list['unban'] as $unban){ $main_content .= ''; } $main_content .= '
 Others
#DescriptionSelect product
'.$pacc['days'].''.$pacc['name'].' ('.$pacc['points'].' points)
'.$pacc['description'].'
'; if(!$logged) $main_content .= 'Login to buy'; else $main_content .= '

for '.$pacc['points'].' points
'; } //Change Name if(count($offer_list['changename']) > 0) foreach($offer_list['changename'] as $changename) { $main_content .= '
Change Name'.$changename['name'].' ('.$changename['points'].' points)
'.$changename['description'].'
'; if(!$logged) $main_content .= 'Login to buy'; else $main_content .= '

for '.$changename['points'].' points
'; } //Remove Red Skull if(count($offer_list['redskull']) > 0) foreach($offer_list['redskull'] as $redskull) { $main_content .= '
'.$redskull['name'].' ('.$redskull['points'].' points)
'.$redskull['description'].'
'; if(!$logged) $main_content .= 'Login to buy'; else $main_content .= '

for '.$redskull['points'].' points
'; $main_content .= '
Unban'.$unban['name'].' ('.$unban['points'].' points)
'.$unban['description'].'
'; if(!$logged) $main_content .= 'Login to buy'; else $main_content .= '

for '.$unban['points'].' points
'; $main_content .= '
'; } elseif($action == 'select_player') { unset($_SESSION['viewed_confirmation_page']); if(!$logged) { $main_content .= 'Please login first.'; } else { $buy_id = (int) $_REQUEST['buy_id']; if(empty($buy_id)) { $main_content .= 'Please select item first.'; } else { $buy_offer = getItemByID($buy_id); if(isset($buy_offer['id'])) { //item exist in database if($buy_offer['type'] != 'changename') { if($user_premium_points >= $buy_offer['points']) { $main_content .= '

Select player

Selected offer
Name:'.$buy_offer['name'].'
Description:'.$buy_offer['description'].'

Give item to a player from your account
Name: 

Give item to other player
To player: - name of the player who should get item
From:  - your nick, \'empty\' = Anonymous

'; } else { $main_content .= 'For this item you need '.$buy_offer['points'].' points.
You have only '.$user_premium_points.' premium points. Please select other item or buy premium points.'; } } else { $main_content .= '

Change Name

Change Name:
Name:
New name: 

'; } } else { $main_content .= 'Offer with ID '.$buy_id.' doesn\'t exist. Please select item again.'; } } } } elseif($action == 'confirm_transaction') { if(!$logged) { $main_content .= 'Please login first.'; } else { $buy_id = (int) $_POST['buy_id']; $buy_name = stripslashes(urldecode($_POST['buy_name'])); $buy_from = stripslashes(urldecode($_POST['buy_from'])); if(empty($buy_id)) { $main_content .= 'Please select item first.'; } else { if($buy_offer['type'] == 'changename'){ if(!check_name_new_char($buy_from)) { $main_content .= 'Invalid name format of new name.'; } } else { $buy_offer = getItemByID($buy_id); $check_name_in_database = new Player(); $check_name_in_database->find($buy_from); if($buy_offer['type'] == 'changename'){ if(!$check_name_in_database->isLoaded()) { } } if(isset($buy_offer['id'])) { //item exist in database if($user_premium_points >= $buy_offer['points']) { if(check_name($buy_name)) { $buy_player = new Player(); $buy_player->find($buy_name); if($buy_player->isLoaded()) { $buy_player_account = $buy_player->getAccount(); if($_SESSION['viewed_confirmation_page'] == 'yes' && $_POST['buy_confirmed'] == 'yes') { if($buy_offer['type'] == 'pacc') { $player_vip_time = $buy_player_account->getCustomField('vip_time'); $player_lastlogin = $buy_player_account->getCustomField('lastday'); $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()).');'; $SQL->query($save_transaction); if($player_vip_time > 0) $buy_player_account->setCustomField('vip_time', $player_vip_time + $buy_offer['days'] * 86400); else $buy_player_account->setCustomField('vip_time', time() + $buy_offer['days'] * 86400); $buy_player_account->setCustomField('premium_points', $user_premium_points-$buy_offer['points']); $user_premium_points = $user_premium_points - $buy_offer['points']; if ($player_vip_days >= 1) { } $main_content .= '

VIP Days added!

'.$buy_offer['days'].' days of VIP days added to the account of player '.$buy_player->getName().' for '.$buy_offer['points'].' premium points from your account.
Now you have '.$user_premium_points.' premium points.

Go to Shop Site
'; } elseif($buy_offer['type'] == 'unban') { $my_acc_id = $account_logged->getCustomField('id'); $datadata = $SQL->query('SELECT * FROM '.$SQL->tableName('bans').' WHERE value = '.$my_acc_id.';')->fetch(); if($datadata['value'] == $my_acc_id) { if($SQL->query('DELETE FROM bans WHERE value= '.$my_acc_id.' LIMIT 1;')) { } else { $SQL->query('DELETE FROM bans WHERE account= '.$my_acc_id.' LIMIT 1;'); } $account_logged->setCustomField('premium_points', $user_premium_points-$buy_offer['points']); $user_premium_points = $user_premium_points - $buy_offer['points']; $main_content .= '

Ban Deleted!

Your account has been unbanned for '.$buy_offer['points'].' premium points from your account.
Now you have '.$user_premium_points.' premium points.

Go to Shop Site
'; } else { $main_content .= '
You don\'t have any bans in your account!

Go back
'; } } //////////////////////////////// elseif($buy_offer['type'] == 'itemlogout') { $my_acc_id = $buy_player->getCustomField('id'); $playerinfo = $SQL->query('SELECT * FROM '.$SQL->tableName('players').' WHERE id = '.$my_acc_id.';')->fetch(); $playerslot = $SQL->query('SELECT * FROM '.$SQL->tableName('player_items').' WHERE player_id = '.$my_acc_id.';')->fetch(); if($playerinfo['online'] == '0') { if ($playerslot['pid'] != '10') { if ($datadata['cap'] >= $SQL->quote($buy_offer['free_cap'])) { $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']).');'); $account_logged->setCustomField('premium_points', $user_premium_points-$buy_offer['points']); $user_premium_points = $user_premium_points - $buy_offer['points']; $main_content .= '

Item received to player: '.$buy_player->getName().'!


Now you have '.$user_premium_points.' premium points.
Go to Shop Site'; } else { $main_content .= 'You need '.$SQL->quote($buy_offer['free_cap']).' or more of cap!
Go back'; } } else { $main_content .= 'Please leave the arrow slot in blank to receive item!
Go back'; } } else { $main_content .= 'You need to be offline!
Go back'; } } //////////////////////////////// elseif($buy_offer['type'] == 'changename') { $erroName=0; if(!check_name_new_char($buy_from)) { $main_content .= 'Invalid name format of new name.'; $erroName++; } $my_acc_id = $buy_player->getCustomField('id'); $playerinfo = $SQL->query('SELECT * FROM '.$SQL->tableName('players').' WHERE '.$SQL->fieldName('id').' = '.$my_acc_id.';')->fetch(); $checkname = $SQL->query('SELECT * FROM '.$SQL->tableName('players').' WHERE '.$SQL->fieldName('name').' = '. $SQL->quote($buy_from) .';')->fetch(); if($playerinfo['online'] == '0') { if($checkname == false and $erroName == 0) { $SQL->query('UPDATE `players` SET `name` = '. $SQL->quote($buy_from) .' WHERE `id` = '. $my_acc_id.' ;'); $account_logged->setCustomField('premium_points', $user_premium_points-$buy_offer['points']); $user_premium_points = $user_premium_points - $buy_offer['points']; $main_content .= '

Your name has been changed to '.$buy_from.'.


You have '.$user_premium_points.' premium points left.

Go to Shop Site
'; } else { $main_content .= '

Sorry, the name "'.$buy_from.'" does already exist.
Please select another name.


'; } } else { $main_content .= '

'.$buy_name.' has to be offline to complete transaction.



Go back
'; } } //////////////////////////////// elseif($buy_offer['type'] == 'redskull') { $my_acc_id = $buy_player->getCustomField('id'); $playerinfo = $SQL->query('SELECT * FROM '.$SQL->tableName('players').' WHERE '.$SQL->fieldName('id').' = '.$my_acc_id.';')->fetch(); if($playerinfo['skull'] == '4' AND $playerinfo['online'] >= '0' AND $playerinfo['skulltime'] > '0') { $SQL->query('UPDATE killers SET unjustified=0 WHERE id IN (SELECT kill_id FROM player_killers WHERE player_id='. $my_acc_id .');'); $SQL->query('UPDATE players SET skulltime=0, skull=0 WHERE id='. $my_acc_id .';'); $account_logged->setCustomField('premium_points', $user_premium_points-$buy_offer['points']); $user_premium_points = $user_premium_points - $buy_offer['points']; $main_content .= '

RedSkull Removed!


Your redskull has been removed from the player '.$buy_player->getName().'.
Now you have '.$user_premium_points.' premium points.

Go to Shop Site
'; } else { $main_content .= '
'.$buy_player->getName().' has to be offline or have redskull to complete transaction!.

Go back
'; } } ////////////////////////// elseif($buy_offer['type'] == 'item') { $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\');'; $SQL->query($sql); $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['item_id']).', \'wait\', '.$SQL->quote(time()).', \'0\');'; $SQL->query($save_transaction); $account_logged->setCustomField('premium_points', $user_premium_points-$buy_offer['points']); $user_premium_points = $user_premium_points - $buy_offer['points']; $main_content .= '

Item added!

'.$buy_offer['name'].' added to player '.$buy_player->getName().' for '.$buy_offer['points'].' premium points from your account.
Now you have '.$user_premium_points.' premium points.

GO TO MAIN SHOP SITE
'; } if($buy_offer['type'] == 'vipdays') { $player_vip_time = $buy_player_account->getCustomField('vip_time'); $player_lastlogin = $buy_player_account->getCustomField('lastday'); $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()).');'; $SQL->query($save_transaction); if($player_vip_time >= 1){ $account_logged->setVipTime($player_vip_time + $buy_offer['days'] * 86400); }else{ $account_logged->setVipTime(time() + $buy_offer['days'] * 86400); } $account_logged->setCustomField('premium_points', $user_premium_points-$buy_offer['points']); $user_premium_points = $user_premium_points - $buy_offer['points']; if ($player_vip_days >= 1) { } $main_content .= '

VIP Days added!

'.$buy_offer['days'].' days of VIP days added to the account of player '.$buy_player->getName().' for '.$buy_offer['points'].' premium points from your account.
Now you have '.$user_premium_points.' premium points.

Go to Shop Site
'; } elseif($buy_offer['type'] == 'megaitems') { $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\');'; $SQL->query($sql); $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['item_id']).', \'wait\', '.$SQL->quote(time()).', \'0\');'; $SQL->query($save_transaction); $account_logged->setCustomField('premium_points', $user_premium_points-$buy_offer['points']); $user_premium_points = $user_premium_points - $buy_offer['points']; $main_content .= '

Mega Item added!

'.$buy_offer['name'].' added to player '.$buy_player->getName().' for '.$buy_offer['points'].' premium points from your account.
Now you have '.$user_premium_points.' premium points.

GO TO MAIN SHOP SITE
'; } elseif($buy_offer['type'] == 'container') { $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\');'; $SQL->query($sql); $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['item_id']).', \'wait\', '.$SQL->quote(time()).', \'0\');'; $SQL->query($save_transaction); $account_logged->setCustomField('premium_points', $user_premium_points-$buy_offer['points']); $user_premium_points = $user_premium_points - $buy_offer['points']; $main_content .= '

Container of items added!

'.$buy_offer['name'].' added to player '.$buy_player->getName().' for '.$buy_offer['points'].' premium points from your account.
Now you have '.$user_premium_points.' premium points.

GO TO MAIN SHOP SITE
'; } } else { if($buy_offer['type'] != 'changename') { $set_session = TRUE; $_SESSION['viewed_confirmation_page'] = 'yes'; $main_content .= '

Confirm transaction

Confirm transaction
Name:'.$buy_offer['name'].'
Description:'.$buy_offer['description'].'
Cost:'.$buy_offer['points'].' premium points from your account
For Player:'.$buy_player->getName().'
From:'.$buy_from.'
Transaction?
'; } else { $set_session = TRUE; $_SESSION['viewed_confirmation_page'] = 'yes'; $main_content .= '

Confirm Name Changing

Confirm transaction
Name:'.$buy_offer['name'].'
Description:'.$buy_offer['description'].'
Cost:'.$buy_offer['points'].' premium points from your account
Current Name:'.$buy_player->getName().'
New Name:'.$buy_from.'
Change Name?
'; } } } else { $main_content .= 'Player with name '.$buy_name.' doesn\'t exist. Please select other name.'; } } else { $main_content .= 'Invalid name format. Please select other name or contact with administrator.'; } } else { $main_content .= 'For this item you need '.$buy_offer['points'].' points. You have only '.$user_premium_points.' premium points. Please select other item or buy premium points.'; } } else { $main_content .= 'Offer with ID '.$buy_id.' doesn\'t exist. Please select item again.'; } } } } if(!$set_session) { unset($_SESSION['viewed_confirmation_page']); } } elseif($action == 'show_history') { if(!$logged) { $main_content .= 'Please login first.'; } else{ $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()).';'); if(is_object($items_history_received)) { foreach($items_history_received as $item_received) { if($account_logged->getId() == $item_received['to_account']) $char_color = 'green'; else $char_color = 'red'; $items_received_text .= ''.$item_received['to_name'].''; if($account_logged->getId() == $item_received['from_account']) $items_received_text .= 'Your account'; else $items_received_text .= $item_received['from_nick']; $items_received_text .= ''.$item_received['offer_id'].''.$item_received['price'].' Points'.date("j F Y, H:i:s", $item_received['trans_start']).''; if($item_received['trans_real'] > 0) $items_received_text .= ''.date("j F Y, H:i:s", $item_received['trans_real']).''; else $items_received_text .= 'Not realized yet.'; $items_received_text .= ''; } } $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()).';'); if(is_object($paccs_history_received)) { foreach($paccs_history_received as $pacc_received) { if($account_logged->getId() == $pacc_received['to_account']) $char_color = 'green'; else $char_color = 'red'; $paccs_received_text .= ''.$pacc_received['to_name'].''; if($account_logged->getId() == $pacc_received['from_account']) $paccs_received_text .= 'Your account'; else $paccs_received_text .= $pacc_received['from_nick']; $paccs_received_text .= ''.$pacc_received['pacc_days'].' days'.$pacc_received['price'].' Points'.date("j F Y, H:i:s", $pacc_received['trans_real']).''; } } $main_content .= '

Transactions History

'; if(!empty($items_received_text)) $main_content .= '
'.$items_received_text.'
 Item Transactions
To:From:Offer nameCostBought on pageReceived on '.$config['server']['serverName'].'

'; if(!empty($paccs_received_text)) $main_content .= '
'.$paccs_received_text.'
 Pacc Transactions
To:From:DurationCostAdded:

'; if(empty($paccs_received_text) && empty($items_received_text)) $main_content .= 'You did not buy/receive any items or PACC.'; } } if(!$logged) $main_content .= 'Please login to see how much points you have.'; else $main_content .= '
You have premium points: '.$user_premium_points; } else $main_content .= '
Shop System is currently disabled for this server.Please ask the admin for more information.
'; ?>