Ir para conteúdo
  • Cadastre-se

(Resolvido)Erro com Shop System


Ir para solução Resolvido por Heenrique,

Posts Recomendados

Olá galera, eu estou com um problema no meu Shop System

Seguinte, eu baixei um Gesior aqui no forum e quando eu vou na aba do shop aparece a seguinte mensagem:

"Fatal error: Call to undefined function getOfferArray() in C:\xampp\htdocs\pages\shop.php on line 40"

o meu shop.php é esse:

<?PHP header("Content-Type: text/html; charset=ISO-8859-1",true); if(!defined('INITIALIZED')) exit;

###############  CONFIG  ################
$shop_link = 'shop';
$donate_link = 'donate';

#########################################

ECHO '<div class="well">';

# SHOP SYSTEM TRUE #
if($config['site']['shop_system'])
{
    if($logged)
    { 
        $user_premium_points = $account_logged->getCustomField('premium_points');
    } 
    else 
    {
        $user_premium_points = '<a href="'.$shop_link.'&action=login">Login First</a>';
    }

    
    #===================   CODE   ======================#
    include_once('./engine/load.functions.forum.php');
    #===================================================#
    
    ############################################################################################################################
    ##############################################         START        ########################################################
    ############################################################################################################################
    
    if($action == '') 
    {
        unset($_SESSION['viewed_confirmation_page']);
        
        ECHO '<h2> Donate Shopping </h2>
        <div style="float:right;"> Click here to <a href="'.$donate_link.'" > Donate </a> and click here to see 
        <a href="'.$shop_link.'&action=history" >Trans. History</a> </div> <br> <br>';    
        
        $offer_list = getOfferArray();
          
        ECHO' <div class="tabbable">  <ul class="nav nav-tabs" style="margin-bottom:0px">';
        
        if(count($offer_list['pacc']) > 0 or count($offer_list['vipdays']) > 0) { ECHO '<li class="active"><a href="#tab0" data-toggle="tab">Upgrade Account</a></li>'; }
        if(count($offer_list['itemvip']) > 0) { ECHO '<li><a href="#tab1" data-toggle="tab">Donates</a></li>'; }
        if(count($offer_list['item']) > 0) { ECHO '<li><a href="#tab2" data-toggle="tab">Equipments</a></li>'; }
        if(count($offer_list['container']) > 0) { ECHO '<li><a href="#tab3" data-toggle="tab">Containers</a></li>'; }
        if(count($offer_list['changename']) > 0 or count($offer_list['redskull']) > 0 or count($offer_list['unban']) > 0 or count($offer_list['mist']) > 0)
        { 
            ECHO '<li><a href="#tab4" data-toggle="tab">Additional</a></li>';
        }
        if(count($offer_list['decoration']) > 0) { ECHO '<li><a href="#tab5" data-toggle="tab">Decorations</a></li>'; }
        
        ECHO '</ul> </div>';
         
        ECHO '<div class="tab-content" style="background-color:white;border-left:1px solid #ddd;border-right:1px solid #ddd;border-bottom:1px solid #ddd;padding:10px 15px 10px 15px">'; 
        
        ########################################     TABLE 0 - PREMIUM DAYS E VIP DAYS      #########################################################        
        if(count($offer_list['pacc']) > 0 or count($offer_list['vipdays']) > 0) 
        { 
            ECHO '<div class="tab-pane active" id="tab0"> <br>'; 
            
            if(count($offer_list['pacc']) > 0) # SHOW LIST = PACC 
            {        
            
                foreach($offer_list['pacc'] as $pacc) 
                {            
                    ECHO '<div class="row-fluid"> <div class="span1"> <img style="height:32px;width:32px" class="thumbnail" src="'.$layout_name.'/img/shop/vip.gif" alt="Thumbnail"></div>';
                    ECHO '<div class="span7"> <strong> '.$pacc['name'].' </strong> &#160; <span class="label label-inverse"> '.$pacc['points'].' points</span>';
                    ECHO '<br> <small> '.$pacc['description'].' </small> </div>';
                       ECHO '<div class="span4">';            
                    if(!$logged) { ECHO '<span class="btn disabled btn-danger" > <b> <a href="'.$shop_link.'&action=login"> <font color="white" > Login First </font> </a> </span> </b>';} 
                    else { ECHO '<form action="'.$shop_link.'&action=select_player" method=POST> <input type="hidden" name="buy_id" value="'.$pacc['id'].'" /> 
                    <input type="submit" class="btn disabled btn-danger" value="Buy '.$pacc['name'].'" /> </form>';}                
                    ECHO '</div> </div> <hr>';            
                }
            
            }
        
            if(count($offer_list['vipdays']) > 0) # SHOW LIST = VIPDAYS #
            {          
                foreach($offer_list['vipdays'] as $vipdays) 
                {
                    ECHO '<div class="row-fluid"> <div class="span1"> <img style="height:32px;width:32px" class="thumbnail" src="'.$layout_name.'/img/shop/vip.gif" alt="Thumbnail"></div>';
                    ECHO '<div class="span7"> <strong> '.$vipdays['name'].' </strong> &#160; <span class="label label-inverse"> '.$vipdays['points'].' points</span>';
                    ECHO '<br> <small> '.$vipdays['description'].' </small> </div>';
                    ECHO '<div class="span4">';            
                    if(!$logged) { ECHO '<span class="btn disabled btn-danger" > <b> <a href="'.$shop_link.'&action=login"> <font color="white" > Login First </font> </a> </span> </b>';} 
                    else { ECHO '<form action="'.$shop_link.'&action=select_player" method=POST> <input type="hidden" name="buy_id" value="'.$vipdays['id'].'" /> 
                    <input type="submit" class="btn disabled btn-danger" value="Buy Now" /> </form>';}                
                    ECHO '</div> </div> <hr>';
                   }        
               }       
            ECHO '</div>'; 
        }    
        
        ########################################     TABLE 1 - ITEMS VIPS      #########################################################
        
        if(count($offer_list['itemvip']) > 0) # SHOW LIST = ITEMS 
        {     
            ECHO '<div class="tab-pane" id="tab1"> <br>';        
            
            foreach($offer_list['itemvip'] as $itemvip)
            {            
                ECHO '<div class="row-fluid">  <div class="span1"> <img style="height:32px;width:32px" class="thumbnail" src="'.$layout_name.'/img/shop/'.$itemvip['item_id'].'.gif" alt="Thumbnail"></div>';
                ECHO '<div class="span7"> <strong> '.$itemvip['name'].' </strong> &#160; <span class="label label-inverse"> '.$itemvip['points'].' points</span>';
                ECHO '<br> <small> '.$itemvip['description'].' </small> </div>';
                ECHO '<div class="span4">';            
                if(!$logged) { ECHO '<span class="btn disabled btn-danger" > <b> <a href="'.$shop_link.'&action=login"> <font color="white" > Login First </font> </a> </span> </b>';} 
                else { ECHO '<form action="'.$shop_link.'&action=select_player" method=POST> <input type="hidden" name="buy_id" value="'.$itemvip['id'].'" /> 
                <input type="submit" class="btn disabled btn-danger" value="Buy Now" /> </form>';}                
                ECHO '</div> </div> <hr>';
            }            
            ECHO '</div>';
        }
        
        ########################################     TABLE 2 - ITEMS      #########################################################
        
        if(count($offer_list['item']) > 0) # SHOW LIST = ITEMS 
        {     
            ECHO '<div class="tab-pane" id="tab2"> <br>';        
            
            foreach($offer_list['item'] as $item)
            {            
                ECHO '<div class="row-fluid">  <div class="span1"> <img style="height:32px;width:32px" class="thumbnail" src="'.$layout_name.'/img/shop/'.$item['item_id'].'.gif" alt="Thumbnail"></div>';
                ECHO '<div class="span7"> <strong> '.$item['name'].' </strong> &#160; <span class="label label-inverse"> '.$item['points'].' points</span>';
                ECHO '<br> <small> '.$item['description'].' </small> </div>';
                ECHO '<div class="span4">';            
                if(!$logged) { ECHO '<span class="btn disabled btn-danger" > <b> <a href="'.$shop_link.'&action=login"> <font color="white" > Login First </font> </a> </span> </b>';} 
                else { ECHO '<form action="'.$shop_link.'&action=select_player" method=POST> <input type="hidden" name="buy_id" value="'.$item['id'].'" /> 
                <input type="submit" class="btn disabled btn-danger" value="Buy Now" /> </form>';}                
                ECHO '</div> </div> <hr>';
            }            
            ECHO '</div>';
        }
        
        ########################################     TABLE 3 - CONTAIRNER      #########################################################

        if(count($offer_list['container']) > 0) # SHOW LIST = CONTAINER
        {
            ECHO '<div class="tab-pane" id="tab3"> <br>';
            
            foreach($offer_list['container'] as $container)  
            {                     
                ECHO '<div class="row-fluid">  <div class="span1"> <img style="height:32px;width:32px" class="thumbnail" src="'.$layout_name.'/img/shop/'.$container['item_id'].'.gif" alt="Thumbnail"></div>';
                ECHO '<div class="span7"> <strong> '.$container['name'].' </strong> &#160; <span class="label label-inverse"> '.$container['points'].' points</span>';
                ECHO '<br> <small> '.$container['description'].' </small> </div>';
                ECHO '<div class="span4">';            
                if(!$logged) { ECHO '<span class="btn disabled btn-danger" > <b> <a href="'.$shop_link.'&action=login"> <font color="white" > Login First </font> </a> </span> </b>';} 
                else { ECHO '<form action="'.$shop_link.'&action=select_player" method=POST> <input type="hidden" name="buy_id" value="'.$container['id'].'" /> 
                <input type="submit" class="btn disabled btn-danger" value="Buy Now" /> </form>';}                
                ECHO '</div> </div> <hr>';       
            }    
            ECHO '</div>';
        }        
        ########################################     TABLE 4 - ADDICIONAL      #########################################################
        
        if(count($offer_list['changename']) > 0 or count($offer_list['redskull']) > 0 or count($offer_list['unban']) > 0 or count($offer_list['mist']) > 0)
        {
            ECHO '<div class="tab-pane" id="tab4"> <br> ';
            
            # ---------- Change Name --------------#
            if(count($offer_list['changename']) > 0)
            {
                foreach($offer_list['changename'] as $changename) 
                {                 
                    ECHO '<div class="row-fluid">  <div class="span1"> <img style="height:32px;width:32px" class="thumbnail" src="'.$layout_name.'/img/shop/changename.gif" alt="Thumbnail"></div>';
                    ECHO '<div class="span7"> <strong> '.$changename['name'].' </strong> &#160; <span class="label label-inverse"> '.$changename['points'].' points</span>';
                    ECHO '<br> <small> '.$changename['description'].' </small> </div>';
                    ECHO '<div class="span4">';            
                    if(!$logged) { ECHO '<span class="btn disabled btn-danger" > <b> <a href="'.$shop_link.'&action=login"> <font color="white" > Login First </font> </a> </span> </b>';} 
                    else { ECHO '<form action="'.$shop_link.'&action=select_player" method=POST> <input type="hidden" name="buy_id" value="'.$changename['id'].'" /> 
                    <input type="submit" class="btn disabled btn-danger" value="Buy '.$changename['name'].'" /> </form>';}                
                    ECHO '</div> </div> <hr>';
                }
            }

            # ----------- Remove Red Skull -----------#
            if(count($offer_list['redskull']) > 0)
            {
                foreach($offer_list['redskull'] as $redskull) 
                {                                    
                    ECHO '<div class="row-fluid">  <div class="span1"> <img style="height:32px;width:32px" class="thumbnail" src="'.$layout_name.'/img/shop/redskull.gif" alt="Thumbnail"></div>';
                    ECHO '<div class="span7"> <strong> '.$redskull['name'].' </strong> &#160; <span class="label label-inverse"> '.$redskull['points'].' points</span>';
                    ECHO '<br> <small> '.$redskull['description'].' </small> </div>';
                    ECHO '<div class="span4">';            
                    if(!$logged) { ECHO '<span class="btn disabled btn-danger" > <b> <a href="'.$shop_link.'&action=login"> <font color="white" > Login First </font> </a> </span> </b>';} 
                    else { ECHO '<form action="'.$shop_link.'&action=select_player" method=POST> <input type="hidden" name="buy_id" value="'.$redskull['id'].'" /> 
                    <input type="submit" class="btn disabled btn-danger" value="Buy '.$redskull['name'].'" /> </form>';}                
                    ECHO '</div> </div> <hr>';
                }
            }

            # -------------- UNBAN ----------------#
            if(count($offer_list['unban']) > 0)
            {
                foreach($offer_list['unban'] as $unban)
                {
                    ECHO '<div class="row-fluid">  <div class="span1"> <img style="height:32px;width:32px" class="thumbnail" src="'.$layout_name.'/img/shop/unban.gif"></div>';
                    ECHO '<div class="span7"> <strong> '.$unban['name'].' </strong> &#160; <span class="label label-inverse"> '.$unban['points'].' points</span>';
                    ECHO '<br> <small> '.$unban['description'].' </small> </div>';
                    ECHO '<div class="span4">';            
                    if(!$logged) { ECHO '<span class="btn disabled btn-danger" > <b> <a href="'.$shop_link.'&action=login"> <font color="white" > Login First </font> </a> </span> </b>';} 
                    else { ECHO '<form action="'.$shop_link.'&action=select_player" method=POST> <input type="hidden" name="buy_id" value="'.$unban['id'].'" /> 
                    <input type="submit" class="btn disabled btn-danger" value="Buy '.$unban['name'].'" /> </form>';}                
                    ECHO '</div> </div> <hr>';                
                }
            }

            # -------------- ITEM MIST ----------------#
            if(count($offer_list['mist']) > 0)
            {
                foreach($offer_list['mist'] as $mist)
                {
                    ECHO '<div class="row-fluid">  <div class="span1"> <img style="height:32px;width:32px" class="thumbnail" src="'.$layout_name.'/img/shop/'.$mist['item_id'].'.gif"></div>';
                    ECHO '<div class="span7"> <strong> '.$mist['name'].' </strong> &#160; <span class="label label-inverse"> '.$mist['points'].' points</span>';
                    ECHO '<br> <small> '.$mist['description'].' </small> </div>';
                    ECHO '<div class="span4">';            
                    if(!$logged) { ECHO '<span class="btn disabled btn-danger" > <b> <a href="'.$shop_link.'&action=login"> <font color="white" > Login First </font> </a> </span> </b>';} 
                    else { ECHO '<form action="'.$shop_link.'&action=select_player" method=POST> <input type="hidden" name="buy_id" value="'.$mist['id'].'" /> 
                    <input type="submit" class="btn disabled btn-danger" value="Buy Now" /> </form>';}                
                    ECHO '</div> </div> <hr>';                
                }
            }                            
            ECHO '</div>';            
        }
        
        ########################################     TABLE 5 - DECORATION      #########################################################
        
        if(count($offer_list['decoration']) > 0) # SHOW LIST = DECORATION
        {     
            ECHO '<div class="tab-pane" id="tab5"> <br>';        
            
            foreach($offer_list['decoration'] as $decoration)
            {            
                ECHO '<div class="row-fluid">  <div class="span1"> <img style="height:32px;width:32px" class="thumbnail" src="'.$layout_name.'/img/shop/'.$decoration['item_id'].'.gif" alt="Thumbnail"></div>';
                ECHO '<div class="span7"> <strong> '.$decoration['name'].' </strong> &#160; <span class="label label-inverse"> '.$decoration['points'].' points</span>';
                ECHO '<br> <small> '.$decoration['description'].' </small> </div>';
                ECHO '<div class="span4">';            
                if(!$logged) { ECHO '<span class="btn disabled btn-danger" > <b> <a href="'.$shop_link.'&action=login"> <font color="white" > Login First </font> </a> </span> </b>';} 
                else { ECHO '<form action="'.$shop_link.'&action=select_player" method=POST> <input type="hidden" name="buy_id" value="'.$decoration['id'].'" /> 
                <input type="submit" class="btn disabled btn-danger" value="Buy Now" /> </form>';}                
                ECHO '</div> </div> <hr>';
            }            
            ECHO '</div>';
        }
                
        ECHO '</div>';
    }

    ############################################################################################################################
    ##############################################      SELECT PLAYER         ##################################################
    ############################################################################################################################
    
    elseif($action == 'select_player') 
    {
        unset($_SESSION['viewed_confirmation_page']);
        
        if(!$logged){ header('Location: '.$shop_link.'&action=login'); } 
        else 
        {
            $buy_id = (int) $_REQUEST['buy_id'];
            
            if(empty($buy_id)){$errormessage .= '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']) 
                        {
                            # TABLE - ITEM INFO #
                            ECHO '<h2> Delivery Informations </h2>';
                            ECHO '<table border="0" cellpadding="4" width="70%">
                            <tr> <td width="20%"> <b> Name: </b> </td> <td width="80%"> '.htmlspecialchars($buy_offer['name']).' </td> </tr>
                            <tr> <td width="20"> <b> Description:</b> </td> <td width="80%"> '.htmlspecialchars($buy_offer['description']).' </td> </tr> 
                            <tr> <td width="20"> <b> Cost :</b> </td> <td width="100%"> <small> <b> '.$buy_offer['points'].'</b> points </small> </td> </tr> </table>
                            
                            <form action="'.$shop_link.'&action=confirm_transaction" method=POST> <input type="hidden" name="buy_id" value="'.$buy_id.'" />';
                            
                            # TABLE - SELECT PLAYER GO SEND
                            ECHO '<hr> <table border="0" cellpadding="4" width="80%">
                            <tr> <td width="20%"> <b> Select Player: </b> </td> <td width="80%"> <select name="buy_name">';
                            $players_from_logged_acc = $account_logged->getPlayersList();
                    
                            if(count($players_from_logged_acc) > 0) 
                            {
                                #$players_from_logged_acc->addOrder(new SQL_Order('name', SQL_Order::ASC));  
                                foreach($players_from_logged_acc as $player)
                                {
                                    ECHO '<option>'.$player->getName().'</option>';
                                }
                            } 
                            else { ECHO '<center> You don\'t have any character on your account. </center>'; }
                            
                            ECHO '</select> &nbsp; <input type="submit" value="Give" class="btn btn-success" style="margin-top: -9px;" /> </td> </tr> </table> </form> 
                            <form action="'.$shop_link.'&action=confirm_transaction" method=POST> <input type="hidden" name="buy_id" value="'.$buy_id.'" /></form> <hr>';
                            
                            # TABLE - SEND OTHER PLAYER
                            ECHO '<table border="0" cellpadding="4" width="80%">
                            <form action="'.$shop_link.'&action=confirm_transaction" method="POST">
                            <input type="hidden" name="buy_id" value="'.$buy_id.'" />
                            <tr> <td width="20%"> <b> To player:</b> </td> <td width="80%"> 
                            <input type="text" name="buy_name" autocomplete="off" placeholder="Character&nbsp;to&nbsp;recive&nbsp;'.$buy_offer['name'].'" size="25" /> &nbsp;
                            <input type="submit" value="Send to friend" class="btn btn-success" style="margin-top: -9px;" /> </td></tr> <tr> <td> </td> 
                            <td> <small>Put in the field above the name of the character that will receive the item.</small> </td> </tr> </form></table> <hr>';
                        } 
                        else 
                        {  
                            $errormessage .= 'For this item you need <b>'.$buy_offer['points'].'</b> points. 
                            You have only <b>'.$user_premium_points.'</b> premium points. <br> 
                            Please select other item or go donate.';
                        }
                    } 
                    else // CHANGENAME
                    {
                        ECHO '<h2> Change Character Name ('.$buy_offer['points'].' points) </h2> ';
                        
                        ECHO '<form action="'.$shop_link.'&action=change" method=POST>
                        <input type="hidden" name="buy_id" value="'.$buy_id.'">
                        <table border="0" cellpadding="4" width="60%">
                        <tr><td width="20%"><b>Name:</b></td><td width="80%">
                        <select name="player_id">';
                        
                        $players_from_logged_acc = $account_logged->getPlayersList();
                        if(count($players_from_logged_acc) > 0) 
                        {
                            #$players_from_logged_acc->addOrder(new SQL_Order('name', SQL_Order::ASC)); 
                            foreach($players_from_logged_acc as $player) 
                            {
                                ECHO '<option value="'.$player->getID().'">'.htmlspecialchars($player->getName()).'</option>'; 
                            }
                        } 
                        else { ECHO 'You don\'t have any character on your account.'; }
                        
                        ECHO '</select> </td> </tr> <tr> <td width="20%">
                        <b>New name:</b></td><td width="80%"> <input type="text" name="new_name" value="" autocomplete="off" size="26" maxlength="25" /> </td> </tr>                    
                        </table> <br> <center> <input type="submit" value="Change name" class="btn btn-success" style="margin-top: -9px;" /> </center> </form>';
                    }
                } 
                else { $errormessage .= 'Offer with ID <b>'.$buy_id.'</b> doesn\'t exist. Please select item again.'; }
            }
            # MSG ERROR -
            if(!empty($errormessage))
            {
               ECHO '<center>'.$errormessage.'</center>';
               ECHO '<meta http-equiv="refresh" content="2;URL='.$shop_link.'"/>'; # REDIRECT
            }
        }
    }

    ############################################################################################################################
    ##############################################       CONFIRM TRANSACTION         ###########################################
    ############################################################################################################################
    
    elseif($action == 'confirm_transaction') 
    {
        if(!$logged){ header('Location: '.$shop_link.'&action=login'); }
        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)){$errormessage .= 'Please <a href="'.$shop_link.'" >select item</a> first.';} 
            else 
            {    
                    $buy_offer = getItemByID($buy_id);
                    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(); //GET ACCOUNT
                                    if($_SESSION['viewed_confirmation_page'] == 'yes' && $_POST['buy_confirmed'] == 'yes') 
                                    {    
                                        # PREMIUM DAYS
                                        if($buy_offer['type'] == 'pacc') 
                                        {
                                            $player_premdays = $account_logged->getCustomField('premdays');
                                            $player_lastlogin = $account_logged->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);
                                            #---------------------------------------------------------------------------------#
                                            
                                            $account_logged->setCustomField('premdays', $player_premdays+$buy_offer['days']);
                                            
                                            #---------------------------------------------------------------------------------#
                                            $account_logged->setCustomField('premium_points', $user_premium_points-$buy_offer['points']);
                                            $user_premium_points = $user_premium_points - $buy_offer['points'];
                                            
                                            ECHO '<center> '.$buy_offer['days'].' premium days added to account of player <b> '.$buy_player->getName().' </b> 
                                            for <b>'.$buy_offer['points'].' points. </b> <br> Now you have <b>'.$user_premium_points.' points </b>. </center>';
                                            ECHO '<meta http-equiv="refresh" content="4;URL='.$shop_link.'"/>'; # REDIRECT
                                        }                                        
                                        
                                        # VIPDAYS #                                                                                                               
                                        elseif($buy_offer['type'] == 'vipdays')
                                        {
                                            $player_viptime = $account_logged->getCustomField('vip_time');
                                            #$player_buy_viptime = $player_viptime + ($buy_offer['days'] * 86400);
                                            
                                            $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_viptime > 0)
                                            {      
                                                $account_logged->setCustomField('vip_time', $player_viptime + $buy_offer['days'] * 86400);
                                            }
                                            else
                                            {
                                                $account_logged->setCustomField('vip_time', 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'];
                                           
                                            ECHO '<center> '.$buy_offer['days'].' Vip days Added to the account of player <b>'.$buy_player->getName().'</b> 
                                            for <b>'.$buy_offer['points'].' points. </b> <br> Now you have <b>'.$user_premium_points.' points</b>. </center>';
                                            ECHO '<meta http-equiv="refresh" content="4;URL='.$shop_link.'"/>'; # REDIRECT
                                        }
                                        
                                        # ITEM VIP #
                                        elseif($buy_offer['type'] == 'itemvip') 
                                        {
                                            $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['name']).', \'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'];
                                            
                                            ECHO '<center> Donate Item <b>'.$buy_offer['name'].'</b> added to player <b>'.$buy_player->getName().'</b> for <b>'.$buy_offer['points'].' points </b>.
                                            <br> Now you have <b>'.$user_premium_points.' points. </b> </center>';
                                            ECHO '<meta http-equiv="refresh" content="4;URL='.$shop_link.'"/>'; # REDIRECT
                                        } 

                                        
                                        # ITEM #
                                        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['name']).', \'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'];
                                            
                                            ECHO '<center> Item <b>'.$buy_offer['name'].'</b> added to player <b>'.$buy_player->getName().'</b> for <b>'.$buy_offer['points'].' points </b>.
                                            <br> Now you have <b>'.$user_premium_points.' points. </b> </center>';
                                            ECHO '<meta http-equiv="refresh" content="4;URL='.$shop_link.'"/>'; # REDIRECT
                                        }    
                                        
                                        # CONTAINER #
                                        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['name']).', \'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'];
                                           
                                            ECHO '<center> Container <b>'.$buy_offer['name'].'</b> added to player <b>'.$buy_player->getName().'</b> for <b>'.$buy_offer['points'].' points </b> <br> 
                                            Now you have <b>'.$user_premium_points.' points. </b> </center>';
                                            ECHO '<meta http-equiv="refresh" content="4;URL='.$shop_link.'"/>'; # REDIRECT
                                        }                                        
                                        
                                        # UNBAN #    
                                        elseif($buy_offer['type'] == 'unban')
                                        {
                                            $my_acc_id = $account_logged->getCustomField('id');
                                            $datadata = $SQL->query('SELECT * FROM '.$SQL->tableName('bans').' WHERE '.$SQL->tableName('value').' = '.$my_acc_id.';')->fetch();
                                            
                                            if($datadata['value'] == $my_acc_id) 
                                            {
                                                if($SQL->query('DELETE FROM '.$SQL->tableName('bans').' WHERE '.$SQL->tableName('value').' = '.$my_acc_id.' LIMIT 1;')){} 
                                                else {$SQL->query('DELETE FROM '.$SQL->tableName('bans').' WHERE '.$SQL->tableName('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'];
                                                
                                                ECHO '<center> Ban Deleted! <b>Your account has been unbanned for '.$buy_offer['points'].' points</b>.<br> 
                                                Now you have <b>'.$user_premium_points.' points. </b> </center>';
                                                ECHO '<meta http-equiv="refresh" content="4;URL='.$shop_link.'"/>'; # REDIRECT
                                            } 
                                            else 
                                            {
                                                ECHO '<center> <b> You don\'t have any bans in your account!</b>'; 
                                                ECHO '<meta http-equiv="refresh" content="2;URL='.$shop_link.'"/>'; # REDIRECT
                                            }
                                        }

                                        # REDSKULL #
                                        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 '.$SQL->tableName('killers').' SET '.$SQL->fieldName('unjustified').' = 0 
                                                WHERE '.$SQL->fieldName('id').' IN (SELECT '.$SQL->fieldName('kill_id').' FROM '.$SQL->fieldName('player_killers').' 
                                                WHERE '.$SQL->fieldName('player_id').' = '. $my_acc_id .');');
                                                
                                                $SQL->query('UPDATE '.$SQL->tableName('players').' SET '.$SQL->fieldName('skulltime').' = 0, '.$SQL->fieldName('skull').' = 0 
                                                WHERE '.$SQL->fieldName('id').' = '. $my_acc_id .';');
                                                
                                                $account_logged->setCustomField('premium_points', $user_premium_points-$buy_offer['points']);
                                                $user_premium_points = $user_premium_points - $buy_offer['points'];
                                                ECHO '<center> RedSkull Removed! <b>Your redskull has been removed from the player '.$buy_player->getName().'.</b> <br> 
                                                Now you have<b> '.$user_premium_points.' points</b>.';
                                                ECHO '<meta http-equiv="refresh" content="4;URL='.$shop_link.'"/>'; # REDIRECT
                                            } 
                                            else 
                                            {
                                                ECHO '<center> <b>'.$buy_player->getName().' has to be offline or have redskull to complete transaction! </b>';
                                                ECHO '<meta http-equiv="refresh" content="4;URL='.$shop_link.'"/>'; # REDIRECT
                                            }
                                        }
                                        
                                        # MIST #
                                        elseif($buy_offer['type'] == 'mist') 
                                        {
                                            $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['name']).', \'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'];
                                            
                                            ECHO '<center> Item <b>'.$buy_offer['name'].'</b> added to player <b>'.$buy_player->getName().'</b> for <b>'.$buy_offer['points'].' points </b>.
                                            <br> Now you have <b>'.$user_premium_points.' points. </b> </center>';
                                            ECHO '<meta http-equiv="refresh" content="4;URL='.$shop_link.'"/>'; # REDIRECT
                                        }

                                        # DECORATION #
                                        elseif($buy_offer['type'] == 'decoration') 
                                        {
                                            $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['name']).', \'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'];
                                            
                                            ECHO '<center> Item Decoration<b>'.$buy_offer['name'].'</b> added to player <b>'.$buy_player->getName().'</b> for <b>'.$buy_offer['points'].' points </b>.
                                            <br> Now you have <b>'.$user_premium_points.' points. </b> </center>';
                                            ECHO '<meta http-equiv="refresh" content="4;URL='.$shop_link.'"/>'; # REDIRECT
                                        }                                          
                                    } 
                                    else 
                                    {
                                        $set_session = TRUE;
                                        $_SESSION['viewed_confirmation_page'] = 'yes';
                                        # TABLE - CONFIRM TRANS. # Confirm transaction
                                        ECHO '<h2> Confirm Transaction </h2>';
                                        ECHO '<table border="0" cellpadding="4" width="80%">
                                        <tr> <td> <b> Name: </b> </td> <td width="80%" colspan="2">'.$buy_offer['name'].'</td> </tr>
                                        <tr> <td width="20%"><b>Description:</b></td><td width="80%" colspan="2">'.$buy_offer['description'].'</td></tr>
                                        <tr> <td width="20%"><b>Cost:</b></td><td width="80%" colspan="2"><b>'.$buy_offer['points'].' premium points</b> from your account</td></tr>
                                        <tr> <td width="20%"><b>For Player:</b></td><td width="80%" colspan="2">
                                        <a href="characters&name='.$buy_player->getName().'" target="_new"> <b> '.$buy_player->getName().' </b> </a> </td> </tr>
                                        <tr> <td width="20%"><b> Transaction? </b> </td>
                                        <td> <form action="'.$shop_link.'&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).'" />
                                        
                                        <br> <table> <tr>
                                        <td> <input type="submit" value="Accept" class="btn btn-success"/> </form> </td>
                                        
                                        <td> <form action="'.$shop_link.'" method="POST"> <td>
                                        <td> <input type="submit" value="Cancel" class="btn btn-success"/> </td> </tr> </table> 
                                        </form> </td> </tr> </table> <br>';
                                    }
                                } 
                                else { $errormessage .= 'Player with name <b>'.$buy_name.'</b> doesn\'t exist. Please select other name.'; }
                            } 
                            else  { $errormessage .= 'Invalid name format. Please select other name.'; }
                        } 
                        else { $errormessage .= 'For this item you need <b>'.$buy_offer['points'].'</b> points. You have only <b>'.$user_premium_points.'</b> points. Please select other item or buy with your points.'; }
                    }
                    else { $errormessage .= 'Offer with ID <b>'.$buy_id.'</b> doesn\'t exist. Please select item again.'; }
                
            }
        }
       
        # MSG ERROR -
        if(!empty($errormessage))
        {
            ECHO ' <center> '.$errormessage.' </center>';
            ECHO '<meta http-equiv="refresh" content="2; URL='.$shop_link.'"/>'; # REDIRECT
        }
        
        if(!$set_session){unset($_SESSION['viewed_confirmation_page']);}
    }

    ############################################################################################################################
    ##############################################               CHANGE - NAME                ##################################
    ############################################################################################################################
    
    elseif($action == "change") 
    {
        $changeNameCost = 5;        
        $newchar_errors = array(); 
        if($user_premium_points < $changeNameCost){ $newchar_errors[] = 'You need <b>'.$changeNameCost.'</b> points to change name.'; }
        $newchar_name = ucwords(strtolower(trim($_REQUEST['new_name']))); 
        if(empty($newchar_name)) { $newchar_errors[] = 'Please enter a new name for your character!'; }
        if(!check_name_new_char($newchar_name)) { $newchar_errors[] = 'This name contains invalid letters, words or format. Please use only a-Z, - , \' and space.'; }
        $check_name_in_database = new Player(); 
        $check_name_in_database->find($newchar_name); 
        if($check_name_in_database->isLoaded()) { $newchar_errors[] = 'This name is already used. Please choose another name!'; }
        $charToEdit = new Player($_REQUEST['player_id']); 
        if(!$charToEdit->isLoaded()) { $newchar_errors[] = 'That player does not exist.'; }
        elseif($account_logged->getID() != $charToEdit->getAccountID()) { $newchar_errors[] = 'That player is not on your account.'; }
        
        if(empty($newchar_errors)) 
        { 
            ECHO '<center> Name Changed Name of character <b> '.htmlspecialchars($charToEdit->getName()).' </b> changed to <b>'.htmlspecialchars($newchar_name).' </b> </center>'; 
            $charToEdit->setName($newchar_name); 
            $charToEdit->save(); 
            $account_logged->setCustomField('premium_points', $user_premium_points - $changeNameCost); 
            $user_premium_points = $user_premium_points - $changeNameCost;        
        }        
        else 
        { 
            ECHO 'Some errors occured: <br />'; 
            foreach($newchar_errors as $error) { ECHO '<li>'.$error.'</li>'; }            
            ECHO '<meta http-equiv="refresh" content="2;URL='.$shop_link.'"/>'; # REDIRECT 
        } 
    }
    
    ############################################################################################################################
    ##############################################              TRANS. HISTORY               ###################################
    ############################################################################################################################
    
    elseif($action == 'history') 
    {
        if(!$logged){ header('Location: '.$shop_link.'&action=login'); }        
        else 
        {
            # HISTORY ITEMS RECEIVED #
            
            $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) 
                {                
                    $items_received_text .= '<tr>
                    <td>'.$item_received['to_name'].'</td>
                    <td>'.$item_received['price'].' Points</td>
                    <td>'.date("j F Y, H:i:s", $item_received['trans_start']).'</td>';    
                
                    if($item_received['trans_real'] > 0) 
                    {
                        $items_received_text .= '<td>'.date("j F Y, H:i:s", $item_received['trans_real']).'</td>';
                    } 
                    else
                    {
                        $items_received_text .= '<td><b><font color="red">Undelivered</font></b></td>';
                    }
                    $items_received_text .= '</tr>';
                }
            }
                     
            # PACC HISTORY RECEIVED
            $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) 
                {
                    $paccs_received_text .= '<tr>
                    <td style="padding: 5px;">'.$pacc_received['to_name'].'</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>';
                }
            }
    
            # PAGSEGURO HISTORY RECEIVED #
            $pagseguro_history_received = $SQL->query('
            SELECT * FROM '.$SQL->tableName('pagseguro').' 
            WHERE '.$SQL->fieldName('referencia').' = '.$SQL->quote($account_logged->getCustomField("name")).';');
        
            if(is_object($pagseguro_history_received)) 
            {
                foreach($pagseguro_history_received as $pagseguro_received) 
                {                            
                    $pagseguro_received_text .= '<tr> <td>'.$pagseguro_received['TransacaoID'].'</td><td>';
                    $pagseguro_received_text .= $pagseguro_received['TipoPagamento'];
                    $pagseguro_received_text .= '</td> <td>R$'.$pagseguro_received['NumItens'].',00</td><td>
                    <b style="color:red;">'.$pagseguro_received['StatusTransacao'].'</b></td></tr>';
                }
            }
    
            ECHO '<h2> Transactions History </h2> <br>';
        
            # TABLE ITEM RECEIVED #
            if(!empty($items_received_text))                         
            ECHO ' <h4> Items Transactions </h4> <br>
            <table class="table table-striped table-condensed table-content">
            <tr> <td width="30%"><b>Player:</b></td>
            <td><b>Cost:</b></td>
            <td><b>Bought on page:</b></td>
            <td> <b>  Received on OTS </b> </td> </tr>
            '.$items_received_text.' </table> <hr>';
            
            # TABLE PACC RECEIVED #
            if(!empty($paccs_received_text))
            ECHO '<h4> Upgrade Account Transactions </h4> <br>
            <table class="table table-striped table-condensed table-content">
            <tr> <td width="30%"><b>To:</b></td>
            <td><b>Duration:</b></td>
            <td><b>Cost:</b></td><td>
            <b>Added:</b></td></tr>
            '.$paccs_received_text.' </table> <hr>';
                
            # PAGSEGURO RECEIVED #
            if(!empty($pagseguro_received_text))
            ECHO '<h4> PagSeguro Transactions </h4> <br>
            <table class="table table-striped table-condensed table-content">
            <tr> <td><b>ID:</b></td>
            <td> <b>Tipo</b></td>
            <td> <b>Custo</b></td>
            <td> <b>Status</b></td> </tr> 
            '.$pagseguro_received_text.' </table> <hr>';

            if(empty($paccs_received_text) && empty($items_received_text) && empty($pagseguro_received_text))
            {
                ECHO '<BR> You do not have historic purchase, go to <a href="'.$shop_link.'"> shop </a>.  <BR>  <BR>';
            }
        }
    }
        
    #############################################################################################################################################################
    elseif(!$action == 'login' && $logged) 
    { 
        ECHO '<br> <center> <span class="label label-success"> 
        You have '.$user_premium_points.' points </span> </center> <br>';
    }
    if(!$action == 'login' && !$logged) { ECHO '<br> <br>'; }
    
    #############################################################################################################################################################
    
    ###########################################################################################################################################################################################
    #######################################################################              LOGIN             ####################################################################################
    ###########################################################################################################################################################################################

    elseif($action == 'login')
    {
        if(!$logged)
        {    
            ECHO ' <h2> Please login to see Donate Shopping. </h2> ';            
            
            if(isset($isTryingToLogin))
            {
                switch(Visitor::getLoginState())
                {
                    case Visitor::LOGINSTATE_NO_ACCOUNT:
                    ECHO '<h4> <font color="red"> Account with that name doesn\'t exist.<br></font> </h4>'; break;
                    case Visitor::LOGINSTATE_WRONG_PASSWORD:
                    ECHO '<h4> <font color="red"> Wrong password to account. <br></font> </h4>'; break;
                }
            }
            
            // TABLE - ACCOUNT LOGIN
            ECHO ' <form action="'.$shop_link.'&action=login" method="post" > <table width="30%" > <tr> 
            <td> Account Name: <input type="password" name="account_login"  autocomplete="off" size="20" maxlength="15" ></td>
            </tr> <tr>        
            <td> Password: <input type="password" name="password_login"  autocomplete="off" size="20" maxlength="19" ></td> </tr>
            <br/><TR> <td> <div class="row-fluid"> 
            <div class="span5"><button type="submit" class="btn btn-block btn-primary">Login</button></div> </form>
            <div class="span7"><a class="btn btn-block" href="lostaccount">Forgot password?</a></div>
            </div> </td> </tr> </table> <br>';
        } 
        else { header('Location: '.$shop_link.''); }
    }
    
    ###########################################################################################################################################################################################
}
else # SHOP = FALSE
{
    ECHO 'Shop for disabled the maintenance, back in a moment with our standard systems. <b> <small> Att. Staff </small> </b>';
}

ECHO '</div>';
?>

Link para o post
Compartilhar em outros sites

Poste o SHOP.php

YDmXTU2.png

 

Entenda tudo sobre VPS, DEDICADOS & HOSPEDAGENS. => Clique aqui

Global Full Download 10.9x - TFS 1.2/FERUMBRAS/KRAILOS. => Clique aqui

 

Muitos querem aquilo que você tem, 
mas vão desistir quando souberem o preço que você pagou.

 

skype-favicon.png lu.lukinha

message-16.png [email protected]

Link para o post
Compartilhar em outros sites

Já está postado, mas postarei novamente. rs

<?PHP header("Content-Type: text/html; charset=ISO-8859-1",true); if(!defined('INITIALIZED')) exit;

###############  CONFIG  ################
$shop_link = 'shop';
$donate_link = 'donate';

#########################################

ECHO '<div class="well">';

# SHOP SYSTEM TRUE #
if($config['site']['shop_system'])
{
    if($logged)
    { 
        $user_premium_points = $account_logged->getCustomField('premium_points');
    } 
    else 
    {
        $user_premium_points = '<a href="'.$shop_link.'&action=login">Login First</a>';
    }

    
    #===================   CODE   ======================#
    include_once('./engine/load.functions.forum.php');
    #===================================================#
    
    ############################################################################################################################
    ##############################################         START        ########################################################
    ############################################################################################################################
    
    if($action == '') 
    {
        unset($_SESSION['viewed_confirmation_page']);
        
        ECHO '<h2> Donate Shopping </h2>
        <div style="float:right;"> Click here to <a href="'.$donate_link.'" > Donate </a> and click here to see 
        <a href="'.$shop_link.'&action=history" >Trans. History</a> </div> <br> <br>';    
        
        $offer_list = getOfferArray();
          
        ECHO' <div class="tabbable">  <ul class="nav nav-tabs" style="margin-bottom:0px">';
        
        if(count($offer_list['pacc']) > 0 or count($offer_list['vipdays']) > 0) { ECHO '<li class="active"><a href="#tab0" data-toggle="tab">Upgrade Account</a></li>'; }
        if(count($offer_list['itemvip']) > 0) { ECHO '<li><a href="#tab1" data-toggle="tab">Donates</a></li>'; }
        if(count($offer_list['item']) > 0) { ECHO '<li><a href="#tab2" data-toggle="tab">Equipments</a></li>'; }
        if(count($offer_list['container']) > 0) { ECHO '<li><a href="#tab3" data-toggle="tab">Containers</a></li>'; }
        if(count($offer_list['changename']) > 0 or count($offer_list['redskull']) > 0 or count($offer_list['unban']) > 0 or count($offer_list['mist']) > 0)
        { 
            ECHO '<li><a href="#tab4" data-toggle="tab">Additional</a></li>';
        }
        if(count($offer_list['decoration']) > 0) { ECHO '<li><a href="#tab5" data-toggle="tab">Decorations</a></li>'; }
        
        ECHO '</ul> </div>';
         
        ECHO '<div class="tab-content" style="background-color:white;border-left:1px solid #ddd;border-right:1px solid #ddd;border-bottom:1px solid #ddd;padding:10px 15px 10px 15px">'; 
        
        ########################################     TABLE 0 - PREMIUM DAYS E VIP DAYS      #########################################################        
        if(count($offer_list['pacc']) > 0 or count($offer_list['vipdays']) > 0) 
        { 
            ECHO '<div class="tab-pane active" id="tab0"> <br>'; 
            
            if(count($offer_list['pacc']) > 0) # SHOW LIST = PACC 
            {        
            
                foreach($offer_list['pacc'] as $pacc) 
                {            
                    ECHO '<div class="row-fluid"> <div class="span1"> <img style="height:32px;width:32px" class="thumbnail" src="'.$layout_name.'/img/shop/vip.gif" alt="Thumbnail"></div>';
                    ECHO '<div class="span7"> <strong> '.$pacc['name'].' </strong> &#160; <span class="label label-inverse"> '.$pacc['points'].' points</span>';
                    ECHO '<br> <small> '.$pacc['description'].' </small> </div>';
                       ECHO '<div class="span4">';            
                    if(!$logged) { ECHO '<span class="btn disabled btn-danger" > <b> <a href="'.$shop_link.'&action=login"> <font color="white" > Login First </font> </a> </span> </b>';} 
                    else { ECHO '<form action="'.$shop_link.'&action=select_player" method=POST> <input type="hidden" name="buy_id" value="'.$pacc['id'].'" /> 
                    <input type="submit" class="btn disabled btn-danger" value="Buy '.$pacc['name'].'" /> </form>';}                
                    ECHO '</div> </div> <hr>';            
                }
            
            }
        
            if(count($offer_list['vipdays']) > 0) # SHOW LIST = VIPDAYS #
            {          
                foreach($offer_list['vipdays'] as $vipdays) 
                {
                    ECHO '<div class="row-fluid"> <div class="span1"> <img style="height:32px;width:32px" class="thumbnail" src="'.$layout_name.'/img/shop/vip.gif" alt="Thumbnail"></div>';
                    ECHO '<div class="span7"> <strong> '.$vipdays['name'].' </strong> &#160; <span class="label label-inverse"> '.$vipdays['points'].' points</span>';
                    ECHO '<br> <small> '.$vipdays['description'].' </small> </div>';
                    ECHO '<div class="span4">';            
                    if(!$logged) { ECHO '<span class="btn disabled btn-danger" > <b> <a href="'.$shop_link.'&action=login"> <font color="white" > Login First </font> </a> </span> </b>';} 
                    else { ECHO '<form action="'.$shop_link.'&action=select_player" method=POST> <input type="hidden" name="buy_id" value="'.$vipdays['id'].'" /> 
                    <input type="submit" class="btn disabled btn-danger" value="Buy Now" /> </form>';}                
                    ECHO '</div> </div> <hr>';
                   }        
               }       
            ECHO '</div>'; 
        }    
        
        ########################################     TABLE 1 - ITEMS VIPS      #########################################################
        
        if(count($offer_list['itemvip']) > 0) # SHOW LIST = ITEMS 
        {     
            ECHO '<div class="tab-pane" id="tab1"> <br>';        
            
            foreach($offer_list['itemvip'] as $itemvip)
            {            
                ECHO '<div class="row-fluid">  <div class="span1"> <img style="height:32px;width:32px" class="thumbnail" src="'.$layout_name.'/img/shop/'.$itemvip['item_id'].'.gif" alt="Thumbnail"></div>';
                ECHO '<div class="span7"> <strong> '.$itemvip['name'].' </strong> &#160; <span class="label label-inverse"> '.$itemvip['points'].' points</span>';
                ECHO '<br> <small> '.$itemvip['description'].' </small> </div>';
                ECHO '<div class="span4">';            
                if(!$logged) { ECHO '<span class="btn disabled btn-danger" > <b> <a href="'.$shop_link.'&action=login"> <font color="white" > Login First </font> </a> </span> </b>';} 
                else { ECHO '<form action="'.$shop_link.'&action=select_player" method=POST> <input type="hidden" name="buy_id" value="'.$itemvip['id'].'" /> 
                <input type="submit" class="btn disabled btn-danger" value="Buy Now" /> </form>';}                
                ECHO '</div> </div> <hr>';
            }            
            ECHO '</div>';
        }
        
        ########################################     TABLE 2 - ITEMS      #########################################################
        
        if(count($offer_list['item']) > 0) # SHOW LIST = ITEMS 
        {     
            ECHO '<div class="tab-pane" id="tab2"> <br>';        
            
            foreach($offer_list['item'] as $item)
            {            
                ECHO '<div class="row-fluid">  <div class="span1"> <img style="height:32px;width:32px" class="thumbnail" src="'.$layout_name.'/img/shop/'.$item['item_id'].'.gif" alt="Thumbnail"></div>';
                ECHO '<div class="span7"> <strong> '.$item['name'].' </strong> &#160; <span class="label label-inverse"> '.$item['points'].' points</span>';
                ECHO '<br> <small> '.$item['description'].' </small> </div>';
                ECHO '<div class="span4">';            
                if(!$logged) { ECHO '<span class="btn disabled btn-danger" > <b> <a href="'.$shop_link.'&action=login"> <font color="white" > Login First </font> </a> </span> </b>';} 
                else { ECHO '<form action="'.$shop_link.'&action=select_player" method=POST> <input type="hidden" name="buy_id" value="'.$item['id'].'" /> 
                <input type="submit" class="btn disabled btn-danger" value="Buy Now" /> </form>';}                
                ECHO '</div> </div> <hr>';
            }            
            ECHO '</div>';
        }
        
        ########################################     TABLE 3 - CONTAIRNER      #########################################################

        if(count($offer_list['container']) > 0) # SHOW LIST = CONTAINER
        {
            ECHO '<div class="tab-pane" id="tab3"> <br>';
            
            foreach($offer_list['container'] as $container)  
            {                     
                ECHO '<div class="row-fluid">  <div class="span1"> <img style="height:32px;width:32px" class="thumbnail" src="'.$layout_name.'/img/shop/'.$container['item_id'].'.gif" alt="Thumbnail"></div>';
                ECHO '<div class="span7"> <strong> '.$container['name'].' </strong> &#160; <span class="label label-inverse"> '.$container['points'].' points</span>';
                ECHO '<br> <small> '.$container['description'].' </small> </div>';
                ECHO '<div class="span4">';            
                if(!$logged) { ECHO '<span class="btn disabled btn-danger" > <b> <a href="'.$shop_link.'&action=login"> <font color="white" > Login First </font> </a> </span> </b>';} 
                else { ECHO '<form action="'.$shop_link.'&action=select_player" method=POST> <input type="hidden" name="buy_id" value="'.$container['id'].'" /> 
                <input type="submit" class="btn disabled btn-danger" value="Buy Now" /> </form>';}                
                ECHO '</div> </div> <hr>';       
            }    
            ECHO '</div>';
        }        
        ########################################     TABLE 4 - ADDICIONAL      #########################################################
        
        if(count($offer_list['changename']) > 0 or count($offer_list['redskull']) > 0 or count($offer_list['unban']) > 0 or count($offer_list['mist']) > 0)
        {
            ECHO '<div class="tab-pane" id="tab4"> <br> ';
            
            # ---------- Change Name --------------#
            if(count($offer_list['changename']) > 0)
            {
                foreach($offer_list['changename'] as $changename) 
                {                 
                    ECHO '<div class="row-fluid">  <div class="span1"> <img style="height:32px;width:32px" class="thumbnail" src="'.$layout_name.'/img/shop/changename.gif" alt="Thumbnail"></div>';
                    ECHO '<div class="span7"> <strong> '.$changename['name'].' </strong> &#160; <span class="label label-inverse"> '.$changename['points'].' points</span>';
                    ECHO '<br> <small> '.$changename['description'].' </small> </div>';
                    ECHO '<div class="span4">';            
                    if(!$logged) { ECHO '<span class="btn disabled btn-danger" > <b> <a href="'.$shop_link.'&action=login"> <font color="white" > Login First </font> </a> </span> </b>';} 
                    else { ECHO '<form action="'.$shop_link.'&action=select_player" method=POST> <input type="hidden" name="buy_id" value="'.$changename['id'].'" /> 
                    <input type="submit" class="btn disabled btn-danger" value="Buy '.$changename['name'].'" /> </form>';}                
                    ECHO '</div> </div> <hr>';
                }
            }

            # ----------- Remove Red Skull -----------#
            if(count($offer_list['redskull']) > 0)
            {
                foreach($offer_list['redskull'] as $redskull) 
                {                                    
                    ECHO '<div class="row-fluid">  <div class="span1"> <img style="height:32px;width:32px" class="thumbnail" src="'.$layout_name.'/img/shop/redskull.gif" alt="Thumbnail"></div>';
                    ECHO '<div class="span7"> <strong> '.$redskull['name'].' </strong> &#160; <span class="label label-inverse"> '.$redskull['points'].' points</span>';
                    ECHO '<br> <small> '.$redskull['description'].' </small> </div>';
                    ECHO '<div class="span4">';            
                    if(!$logged) { ECHO '<span class="btn disabled btn-danger" > <b> <a href="'.$shop_link.'&action=login"> <font color="white" > Login First </font> </a> </span> </b>';} 
                    else { ECHO '<form action="'.$shop_link.'&action=select_player" method=POST> <input type="hidden" name="buy_id" value="'.$redskull['id'].'" /> 
                    <input type="submit" class="btn disabled btn-danger" value="Buy '.$redskull['name'].'" /> </form>';}                
                    ECHO '</div> </div> <hr>';
                }
            }

            # -------------- UNBAN ----------------#
            if(count($offer_list['unban']) > 0)
            {
                foreach($offer_list['unban'] as $unban)
                {
                    ECHO '<div class="row-fluid">  <div class="span1"> <img style="height:32px;width:32px" class="thumbnail" src="'.$layout_name.'/img/shop/unban.gif"></div>';
                    ECHO '<div class="span7"> <strong> '.$unban['name'].' </strong> &#160; <span class="label label-inverse"> '.$unban['points'].' points</span>';
                    ECHO '<br> <small> '.$unban['description'].' </small> </div>';
                    ECHO '<div class="span4">';            
                    if(!$logged) { ECHO '<span class="btn disabled btn-danger" > <b> <a href="'.$shop_link.'&action=login"> <font color="white" > Login First </font> </a> </span> </b>';} 
                    else { ECHO '<form action="'.$shop_link.'&action=select_player" method=POST> <input type="hidden" name="buy_id" value="'.$unban['id'].'" /> 
                    <input type="submit" class="btn disabled btn-danger" value="Buy '.$unban['name'].'" /> </form>';}                
                    ECHO '</div> </div> <hr>';                
                }
            }

            # -------------- ITEM MIST ----------------#
            if(count($offer_list['mist']) > 0)
            {
                foreach($offer_list['mist'] as $mist)
                {
                    ECHO '<div class="row-fluid">  <div class="span1"> <img style="height:32px;width:32px" class="thumbnail" src="'.$layout_name.'/img/shop/'.$mist['item_id'].'.gif"></div>';
                    ECHO '<div class="span7"> <strong> '.$mist['name'].' </strong> &#160; <span class="label label-inverse"> '.$mist['points'].' points</span>';
                    ECHO '<br> <small> '.$mist['description'].' </small> </div>';
                    ECHO '<div class="span4">';            
                    if(!$logged) { ECHO '<span class="btn disabled btn-danger" > <b> <a href="'.$shop_link.'&action=login"> <font color="white" > Login First </font> </a> </span> </b>';} 
                    else { ECHO '<form action="'.$shop_link.'&action=select_player" method=POST> <input type="hidden" name="buy_id" value="'.$mist['id'].'" /> 
                    <input type="submit" class="btn disabled btn-danger" value="Buy Now" /> </form>';}                
                    ECHO '</div> </div> <hr>';                
                }
            }                            
            ECHO '</div>';            
        }
        
        ########################################     TABLE 5 - DECORATION      #########################################################
        
        if(count($offer_list['decoration']) > 0) # SHOW LIST = DECORATION
        {     
            ECHO '<div class="tab-pane" id="tab5"> <br>';        
            
            foreach($offer_list['decoration'] as $decoration)
            {            
                ECHO '<div class="row-fluid">  <div class="span1"> <img style="height:32px;width:32px" class="thumbnail" src="'.$layout_name.'/img/shop/'.$decoration['item_id'].'.gif" alt="Thumbnail"></div>';
                ECHO '<div class="span7"> <strong> '.$decoration['name'].' </strong> &#160; <span class="label label-inverse"> '.$decoration['points'].' points</span>';
                ECHO '<br> <small> '.$decoration['description'].' </small> </div>';
                ECHO '<div class="span4">';            
                if(!$logged) { ECHO '<span class="btn disabled btn-danger" > <b> <a href="'.$shop_link.'&action=login"> <font color="white" > Login First </font> </a> </span> </b>';} 
                else { ECHO '<form action="'.$shop_link.'&action=select_player" method=POST> <input type="hidden" name="buy_id" value="'.$decoration['id'].'" /> 
                <input type="submit" class="btn disabled btn-danger" value="Buy Now" /> </form>';}                
                ECHO '</div> </div> <hr>';
            }            
            ECHO '</div>';
        }
                
        ECHO '</div>';
    }

    ############################################################################################################################
    ##############################################      SELECT PLAYER         ##################################################
    ############################################################################################################################
    
    elseif($action == 'select_player') 
    {
        unset($_SESSION['viewed_confirmation_page']);
        
        if(!$logged){ header('Location: '.$shop_link.'&action=login'); } 
        else 
        {
            $buy_id = (int) $_REQUEST['buy_id'];
            
            if(empty($buy_id)){$errormessage .= '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']) 
                        {
                            # TABLE - ITEM INFO #
                            ECHO '<h2> Delivery Informations </h2>';
                            ECHO '<table border="0" cellpadding="4" width="70%">
                            <tr> <td width="20%"> <b> Name: </b> </td> <td width="80%"> '.htmlspecialchars($buy_offer['name']).' </td> </tr>
                            <tr> <td width="20"> <b> Description:</b> </td> <td width="80%"> '.htmlspecialchars($buy_offer['description']).' </td> </tr> 
                            <tr> <td width="20"> <b> Cost :</b> </td> <td width="100%"> <small> <b> '.$buy_offer['points'].'</b> points </small> </td> </tr> </table>
                            
                            <form action="'.$shop_link.'&action=confirm_transaction" method=POST> <input type="hidden" name="buy_id" value="'.$buy_id.'" />';
                            
                            # TABLE - SELECT PLAYER GO SEND
                            ECHO '<hr> <table border="0" cellpadding="4" width="80%">
                            <tr> <td width="20%"> <b> Select Player: </b> </td> <td width="80%"> <select name="buy_name">';
                            $players_from_logged_acc = $account_logged->getPlayersList();
                    
                            if(count($players_from_logged_acc) > 0) 
                            {
                                #$players_from_logged_acc->addOrder(new SQL_Order('name', SQL_Order::ASC));  
                                foreach($players_from_logged_acc as $player)
                                {
                                    ECHO '<option>'.$player->getName().'</option>';
                                }
                            } 
                            else { ECHO '<center> You don\'t have any character on your account. </center>'; }
                            
                            ECHO '</select> &nbsp; <input type="submit" value="Give" class="btn btn-success" style="margin-top: -9px;" /> </td> </tr> </table> </form> 
                            <form action="'.$shop_link.'&action=confirm_transaction" method=POST> <input type="hidden" name="buy_id" value="'.$buy_id.'" /></form> <hr>';
                            
                            # TABLE - SEND OTHER PLAYER
                            ECHO '<table border="0" cellpadding="4" width="80%">
                            <form action="'.$shop_link.'&action=confirm_transaction" method="POST">
                            <input type="hidden" name="buy_id" value="'.$buy_id.'" />
                            <tr> <td width="20%"> <b> To player:</b> </td> <td width="80%"> 
                            <input type="text" name="buy_name" autocomplete="off" placeholder="Character&nbsp;to&nbsp;recive&nbsp;'.$buy_offer['name'].'" size="25" /> &nbsp;
                            <input type="submit" value="Send to friend" class="btn btn-success" style="margin-top: -9px;" /> </td></tr> <tr> <td> </td> 
                            <td> <small>Put in the field above the name of the character that will receive the item.</small> </td> </tr> </form></table> <hr>';
                        } 
                        else 
                        {  
                            $errormessage .= 'For this item you need <b>'.$buy_offer['points'].'</b> points. 
                            You have only <b>'.$user_premium_points.'</b> premium points. <br> 
                            Please select other item or go donate.';
                        }
                    } 
                    else // CHANGENAME
                    {
                        ECHO '<h2> Change Character Name ('.$buy_offer['points'].' points) </h2> ';
                        
                        ECHO '<form action="'.$shop_link.'&action=change" method=POST>
                        <input type="hidden" name="buy_id" value="'.$buy_id.'">
                        <table border="0" cellpadding="4" width="60%">
                        <tr><td width="20%"><b>Name:</b></td><td width="80%">
                        <select name="player_id">';
                        
                        $players_from_logged_acc = $account_logged->getPlayersList();
                        if(count($players_from_logged_acc) > 0) 
                        {
                            #$players_from_logged_acc->addOrder(new SQL_Order('name', SQL_Order::ASC)); 
                            foreach($players_from_logged_acc as $player) 
                            {
                                ECHO '<option value="'.$player->getID().'">'.htmlspecialchars($player->getName()).'</option>'; 
                            }
                        } 
                        else { ECHO 'You don\'t have any character on your account.'; }
                        
                        ECHO '</select> </td> </tr> <tr> <td width="20%">
                        <b>New name:</b></td><td width="80%"> <input type="text" name="new_name" value="" autocomplete="off" size="26" maxlength="25" /> </td> </tr>                    
                        </table> <br> <center> <input type="submit" value="Change name" class="btn btn-success" style="margin-top: -9px;" /> </center> </form>';
                    }
                } 
                else { $errormessage .= 'Offer with ID <b>'.$buy_id.'</b> doesn\'t exist. Please select item again.'; }
            }
            # MSG ERROR -
            if(!empty($errormessage))
            {
               ECHO '<center>'.$errormessage.'</center>';
               ECHO '<meta http-equiv="refresh" content="2;URL='.$shop_link.'"/>'; # REDIRECT
            }
        }
    }

    ############################################################################################################################
    ##############################################       CONFIRM TRANSACTION         ###########################################
    ############################################################################################################################
    
    elseif($action == 'confirm_transaction') 
    {
        if(!$logged){ header('Location: '.$shop_link.'&action=login'); }
        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)){$errormessage .= 'Please <a href="'.$shop_link.'" >select item</a> first.';} 
            else 
            {    
                    $buy_offer = getItemByID($buy_id);
                    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(); //GET ACCOUNT
                                    if($_SESSION['viewed_confirmation_page'] == 'yes' && $_POST['buy_confirmed'] == 'yes') 
                                    {    
                                        # PREMIUM DAYS
                                        if($buy_offer['type'] == 'pacc') 
                                        {
                                            $player_premdays = $account_logged->getCustomField('premdays');
                                            $player_lastlogin = $account_logged->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);
                                            #---------------------------------------------------------------------------------#
                                            
                                            $account_logged->setCustomField('premdays', $player_premdays+$buy_offer['days']);
                                            
                                            #---------------------------------------------------------------------------------#
                                            $account_logged->setCustomField('premium_points', $user_premium_points-$buy_offer['points']);
                                            $user_premium_points = $user_premium_points - $buy_offer['points'];
                                            
                                            ECHO '<center> '.$buy_offer['days'].' premium days added to account of player <b> '.$buy_player->getName().' </b> 
                                            for <b>'.$buy_offer['points'].' points. </b> <br> Now you have <b>'.$user_premium_points.' points </b>. </center>';
                                            ECHO '<meta http-equiv="refresh" content="4;URL='.$shop_link.'"/>'; # REDIRECT
                                        }                                        
                                        
                                        # VIPDAYS #                                                                                                               
                                        elseif($buy_offer['type'] == 'vipdays')
                                        {
                                            $player_viptime = $account_logged->getCustomField('vip_time');
                                            #$player_buy_viptime = $player_viptime + ($buy_offer['days'] * 86400);
                                            
                                            $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_viptime > 0)
                                            {      
                                                $account_logged->setCustomField('vip_time', $player_viptime + $buy_offer['days'] * 86400);
                                            }
                                            else
                                            {
                                                $account_logged->setCustomField('vip_time', 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'];
                                           
                                            ECHO '<center> '.$buy_offer['days'].' Vip days Added to the account of player <b>'.$buy_player->getName().'</b> 
                                            for <b>'.$buy_offer['points'].' points. </b> <br> Now you have <b>'.$user_premium_points.' points</b>. </center>';
                                            ECHO '<meta http-equiv="refresh" content="4;URL='.$shop_link.'"/>'; # REDIRECT
                                        }
                                        
                                        # ITEM VIP #
                                        elseif($buy_offer['type'] == 'itemvip') 
                                        {
                                            $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['name']).', \'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'];
                                            
                                            ECHO '<center> Donate Item <b>'.$buy_offer['name'].'</b> added to player <b>'.$buy_player->getName().'</b> for <b>'.$buy_offer['points'].' points </b>.
                                            <br> Now you have <b>'.$user_premium_points.' points. </b> </center>';
                                            ECHO '<meta http-equiv="refresh" content="4;URL='.$shop_link.'"/>'; # REDIRECT
                                        } 

                                        
                                        # ITEM #
                                        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['name']).', \'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'];
                                            
                                            ECHO '<center> Item <b>'.$buy_offer['name'].'</b> added to player <b>'.$buy_player->getName().'</b> for <b>'.$buy_offer['points'].' points </b>.
                                            <br> Now you have <b>'.$user_premium_points.' points. </b> </center>';
                                            ECHO '<meta http-equiv="refresh" content="4;URL='.$shop_link.'"/>'; # REDIRECT
                                        }    
                                        
                                        # CONTAINER #
                                        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['name']).', \'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'];
                                           
                                            ECHO '<center> Container <b>'.$buy_offer['name'].'</b> added to player <b>'.$buy_player->getName().'</b> for <b>'.$buy_offer['points'].' points </b> <br> 
                                            Now you have <b>'.$user_premium_points.' points. </b> </center>';
                                            ECHO '<meta http-equiv="refresh" content="4;URL='.$shop_link.'"/>'; # REDIRECT
                                        }                                        
                                        
                                        # UNBAN #    
                                        elseif($buy_offer['type'] == 'unban')
                                        {
                                            $my_acc_id = $account_logged->getCustomField('id');
                                            $datadata = $SQL->query('SELECT * FROM '.$SQL->tableName('bans').' WHERE '.$SQL->tableName('value').' = '.$my_acc_id.';')->fetch();
                                            
                                            if($datadata['value'] == $my_acc_id) 
                                            {
                                                if($SQL->query('DELETE FROM '.$SQL->tableName('bans').' WHERE '.$SQL->tableName('value').' = '.$my_acc_id.' LIMIT 1;')){} 
                                                else {$SQL->query('DELETE FROM '.$SQL->tableName('bans').' WHERE '.$SQL->tableName('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'];
                                                
                                                ECHO '<center> Ban Deleted! <b>Your account has been unbanned for '.$buy_offer['points'].' points</b>.<br> 
                                                Now you have <b>'.$user_premium_points.' points. </b> </center>';
                                                ECHO '<meta http-equiv="refresh" content="4;URL='.$shop_link.'"/>'; # REDIRECT
                                            } 
                                            else 
                                            {
                                                ECHO '<center> <b> You don\'t have any bans in your account!</b>'; 
                                                ECHO '<meta http-equiv="refresh" content="2;URL='.$shop_link.'"/>'; # REDIRECT
                                            }
                                        }

                                        # REDSKULL #
                                        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 '.$SQL->tableName('killers').' SET '.$SQL->fieldName('unjustified').' = 0 
                                                WHERE '.$SQL->fieldName('id').' IN (SELECT '.$SQL->fieldName('kill_id').' FROM '.$SQL->fieldName('player_killers').' 
                                                WHERE '.$SQL->fieldName('player_id').' = '. $my_acc_id .');');
                                                
                                                $SQL->query('UPDATE '.$SQL->tableName('players').' SET '.$SQL->fieldName('skulltime').' = 0, '.$SQL->fieldName('skull').' = 0 
                                                WHERE '.$SQL->fieldName('id').' = '. $my_acc_id .';');
                                                
                                                $account_logged->setCustomField('premium_points', $user_premium_points-$buy_offer['points']);
                                                $user_premium_points = $user_premium_points - $buy_offer['points'];
                                                ECHO '<center> RedSkull Removed! <b>Your redskull has been removed from the player '.$buy_player->getName().'.</b> <br> 
                                                Now you have<b> '.$user_premium_points.' points</b>.';
                                                ECHO '<meta http-equiv="refresh" content="4;URL='.$shop_link.'"/>'; # REDIRECT
                                            } 
                                            else 
                                            {
                                                ECHO '<center> <b>'.$buy_player->getName().' has to be offline or have redskull to complete transaction! </b>';
                                                ECHO '<meta http-equiv="refresh" content="4;URL='.$shop_link.'"/>'; # REDIRECT
                                            }
                                        }
                                        
                                        # MIST #
                                        elseif($buy_offer['type'] == 'mist') 
                                        {
                                            $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['name']).', \'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'];
                                            
                                            ECHO '<center> Item <b>'.$buy_offer['name'].'</b> added to player <b>'.$buy_player->getName().'</b> for <b>'.$buy_offer['points'].' points </b>.
                                            <br> Now you have <b>'.$user_premium_points.' points. </b> </center>';
                                            ECHO '<meta http-equiv="refresh" content="4;URL='.$shop_link.'"/>'; # REDIRECT
                                        }

                                        # DECORATION #
                                        elseif($buy_offer['type'] == 'decoration') 
                                        {
                                            $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['name']).', \'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'];
                                            
                                            ECHO '<center> Item Decoration<b>'.$buy_offer['name'].'</b> added to player <b>'.$buy_player->getName().'</b> for <b>'.$buy_offer['points'].' points </b>.
                                            <br> Now you have <b>'.$user_premium_points.' points. </b> </center>';
                                            ECHO '<meta http-equiv="refresh" content="4;URL='.$shop_link.'"/>'; # REDIRECT
                                        }                                          
                                    } 
                                    else 
                                    {
                                        $set_session = TRUE;
                                        $_SESSION['viewed_confirmation_page'] = 'yes';
                                        # TABLE - CONFIRM TRANS. # Confirm transaction
                                        ECHO '<h2> Confirm Transaction </h2>';
                                        ECHO '<table border="0" cellpadding="4" width="80%">
                                        <tr> <td> <b> Name: </b> </td> <td width="80%" colspan="2">'.$buy_offer['name'].'</td> </tr>
                                        <tr> <td width="20%"><b>Description:</b></td><td width="80%" colspan="2">'.$buy_offer['description'].'</td></tr>
                                        <tr> <td width="20%"><b>Cost:</b></td><td width="80%" colspan="2"><b>'.$buy_offer['points'].' premium points</b> from your account</td></tr>
                                        <tr> <td width="20%"><b>For Player:</b></td><td width="80%" colspan="2">
                                        <a href="characters&name='.$buy_player->getName().'" target="_new"> <b> '.$buy_player->getName().' </b> </a> </td> </tr>
                                        <tr> <td width="20%"><b> Transaction? </b> </td>
                                        <td> <form action="'.$shop_link.'&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).'" />
                                        
                                        <br> <table> <tr>
                                        <td> <input type="submit" value="Accept" class="btn btn-success"/> </form> </td>
                                        
                                        <td> <form action="'.$shop_link.'" method="POST"> <td>
                                        <td> <input type="submit" value="Cancel" class="btn btn-success"/> </td> </tr> </table> 
                                        </form> </td> </tr> </table> <br>';
                                    }
                                } 
                                else { $errormessage .= 'Player with name <b>'.$buy_name.'</b> doesn\'t exist. Please select other name.'; }
                            } 
                            else  { $errormessage .= 'Invalid name format. Please select other name.'; }
                        } 
                        else { $errormessage .= 'For this item you need <b>'.$buy_offer['points'].'</b> points. You have only <b>'.$user_premium_points.'</b> points. Please select other item or buy with your points.'; }
                    }
                    else { $errormessage .= 'Offer with ID <b>'.$buy_id.'</b> doesn\'t exist. Please select item again.'; }
                
            }
        }
       
        # MSG ERROR -
        if(!empty($errormessage))
        {
            ECHO ' <center> '.$errormessage.' </center>';
            ECHO '<meta http-equiv="refresh" content="2; URL='.$shop_link.'"/>'; # REDIRECT
        }
        
        if(!$set_session){unset($_SESSION['viewed_confirmation_page']);}
    }

    ############################################################################################################################
    ##############################################               CHANGE - NAME                ##################################
    ############################################################################################################################
    
    elseif($action == "change") 
    {
        $changeNameCost = 5;        
        $newchar_errors = array(); 
        if($user_premium_points < $changeNameCost){ $newchar_errors[] = 'You need <b>'.$changeNameCost.'</b> points to change name.'; }
        $newchar_name = ucwords(strtolower(trim($_REQUEST['new_name']))); 
        if(empty($newchar_name)) { $newchar_errors[] = 'Please enter a new name for your character!'; }
        if(!check_name_new_char($newchar_name)) { $newchar_errors[] = 'This name contains invalid letters, words or format. Please use only a-Z, - , \' and space.'; }
        $check_name_in_database = new Player(); 
        $check_name_in_database->find($newchar_name); 
        if($check_name_in_database->isLoaded()) { $newchar_errors[] = 'This name is already used. Please choose another name!'; }
        $charToEdit = new Player($_REQUEST['player_id']); 
        if(!$charToEdit->isLoaded()) { $newchar_errors[] = 'That player does not exist.'; }
        elseif($account_logged->getID() != $charToEdit->getAccountID()) { $newchar_errors[] = 'That player is not on your account.'; }
        
        if(empty($newchar_errors)) 
        { 
            ECHO '<center> Name Changed Name of character <b> '.htmlspecialchars($charToEdit->getName()).' </b> changed to <b>'.htmlspecialchars($newchar_name).' </b> </center>'; 
            $charToEdit->setName($newchar_name); 
            $charToEdit->save(); 
            $account_logged->setCustomField('premium_points', $user_premium_points - $changeNameCost); 
            $user_premium_points = $user_premium_points - $changeNameCost;        
        }        
        else 
        { 
            ECHO 'Some errors occured: <br />'; 
            foreach($newchar_errors as $error) { ECHO '<li>'.$error.'</li>'; }            
            ECHO '<meta http-equiv="refresh" content="2;URL='.$shop_link.'"/>'; # REDIRECT 
        } 
    }
    
    ############################################################################################################################
    ##############################################              TRANS. HISTORY               ###################################
    ############################################################################################################################
    
    elseif($action == 'history') 
    {
        if(!$logged){ header('Location: '.$shop_link.'&action=login'); }        
        else 
        {
            # HISTORY ITEMS RECEIVED #
            
            $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) 
                {                
                    $items_received_text .= '<tr>
                    <td>'.$item_received['to_name'].'</td>
                    <td>'.$item_received['price'].' Points</td>
                    <td>'.date("j F Y, H:i:s", $item_received['trans_start']).'</td>';    
                
                    if($item_received['trans_real'] > 0) 
                    {
                        $items_received_text .= '<td>'.date("j F Y, H:i:s", $item_received['trans_real']).'</td>';
                    } 
                    else
                    {
                        $items_received_text .= '<td><b><font color="red">Undelivered</font></b></td>';
                    }
                    $items_received_text .= '</tr>';
                }
            }
                     
            # PACC HISTORY RECEIVED
            $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) 
                {
                    $paccs_received_text .= '<tr>
                    <td style="padding: 5px;">'.$pacc_received['to_name'].'</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>';
                }
            }
    
            # PAGSEGURO HISTORY RECEIVED #
            $pagseguro_history_received = $SQL->query('
            SELECT * FROM '.$SQL->tableName('pagseguro').' 
            WHERE '.$SQL->fieldName('referencia').' = '.$SQL->quote($account_logged->getCustomField("name")).';');
        
            if(is_object($pagseguro_history_received)) 
            {
                foreach($pagseguro_history_received as $pagseguro_received) 
                {                            
                    $pagseguro_received_text .= '<tr> <td>'.$pagseguro_received['TransacaoID'].'</td><td>';
                    $pagseguro_received_text .= $pagseguro_received['TipoPagamento'];
                    $pagseguro_received_text .= '</td> <td>R$'.$pagseguro_received['NumItens'].',00</td><td>
                    <b style="color:red;">'.$pagseguro_received['StatusTransacao'].'</b></td></tr>';
                }
            }
    
            ECHO '<h2> Transactions History </h2> <br>';
        
            # TABLE ITEM RECEIVED #
            if(!empty($items_received_text))                         
            ECHO ' <h4> Items Transactions </h4> <br>
            <table class="table table-striped table-condensed table-content">
            <tr> <td width="30%"><b>Player:</b></td>
            <td><b>Cost:</b></td>
            <td><b>Bought on page:</b></td>
            <td> <b>  Received on OTS </b> </td> </tr>
            '.$items_received_text.' </table> <hr>';
            
            # TABLE PACC RECEIVED #
            if(!empty($paccs_received_text))
            ECHO '<h4> Upgrade Account Transactions </h4> <br>
            <table class="table table-striped table-condensed table-content">
            <tr> <td width="30%"><b>To:</b></td>
            <td><b>Duration:</b></td>
            <td><b>Cost:</b></td><td>
            <b>Added:</b></td></tr>
            '.$paccs_received_text.' </table> <hr>';
                
            # PAGSEGURO RECEIVED #
            if(!empty($pagseguro_received_text))
            ECHO '<h4> PagSeguro Transactions </h4> <br>
            <table class="table table-striped table-condensed table-content">
            <tr> <td><b>ID:</b></td>
            <td> <b>Tipo</b></td>
            <td> <b>Custo</b></td>
            <td> <b>Status</b></td> </tr> 
            '.$pagseguro_received_text.' </table> <hr>';

            if(empty($paccs_received_text) && empty($items_received_text) && empty($pagseguro_received_text))
            {
                ECHO '<BR> You do not have historic purchase, go to <a href="'.$shop_link.'"> shop </a>.  <BR>  <BR>';
            }
        }
    }
        
    #############################################################################################################################################################
    elseif(!$action == 'login' && $logged) 
    { 
        ECHO '<br> <center> <span class="label label-success"> 
        You have '.$user_premium_points.' points </span> </center> <br>';
    }
    if(!$action == 'login' && !$logged) { ECHO '<br> <br>'; }
    
    #############################################################################################################################################################
    
    ###########################################################################################################################################################################################
    #######################################################################              LOGIN             ####################################################################################
    ###########################################################################################################################################################################################

    elseif($action == 'login')
    {
        if(!$logged)
        {    
            ECHO ' <h2> Please login to see Donate Shopping. </h2> ';            
            
            if(isset($isTryingToLogin))
            {
                switch(Visitor::getLoginState())
                {
                    case Visitor::LOGINSTATE_NO_ACCOUNT:
                    ECHO '<h4> <font color="red"> Account with that name doesn\'t exist.<br></font> </h4>'; break;
                    case Visitor::LOGINSTATE_WRONG_PASSWORD:
                    ECHO '<h4> <font color="red"> Wrong password to account. <br></font> </h4>'; break;
                }
            }
            
            // TABLE - ACCOUNT LOGIN
            ECHO ' <form action="'.$shop_link.'&action=login" method="post" > <table width="30%" > <tr> 
            <td> Account Name: <input type="password" name="account_login"  autocomplete="off" size="20" maxlength="15" ></td>
            </tr> <tr>        
            <td> Password: <input type="password" name="password_login"  autocomplete="off" size="20" maxlength="19" ></td> </tr>
            <br/><TR> <td> <div class="row-fluid"> 
            <div class="span5"><button type="submit" class="btn btn-block btn-primary">Login</button></div> </form>
            <div class="span7"><a class="btn btn-block" href="lostaccount">Forgot password?</a></div>
            </div> </td> </tr> </table> <br>';
        } 
        else { header('Location: '.$shop_link.''); }
    }
    
    ###########################################################################################################################################################################################
}
else # SHOP = FALSE
{
    ECHO 'Shop for disabled the maintenance, back in a moment with our standard systems. <b> <small> Att. Staff </small> </b>';
}

ECHO '</div>';
?>

Link para o post
Compartilhar em outros sites

Está sem a função: function getOfferArray()
Adicione a função e tente.
 

YDmXTU2.png

 

Entenda tudo sobre VPS, DEDICADOS & HOSPEDAGENS. => Clique aqui

Global Full Download 10.9x - TFS 1.2/FERUMBRAS/KRAILOS. => Clique aqui

 

Muitos querem aquilo que você tem, 
mas vão desistir quando souberem o preço que você pagou.

 

skype-favicon.png lu.lukinha

message-16.png [email protected]

Link para o post
Compartilhar em outros sites
  • Solução

Resolvido.

Apenas troquei:
    #===================   CODE   ======================#
    include_once('./engine/load.functions.forum.php');
    #===================================================#
por:
    #===================   CODE   ======================#
    include_once('./engine/load.functions.shop.php');
    #===================================================#

e deu certo, mas muito obrigado pela ajuda Absolute!

Editado por Heenrique (veja o histórico de edições)
Link para o post
Compartilhar em outros sites

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo