bug issue when u refresh

Discussion in 'General PHP' started by cyclops4real007, Mar 29, 2017.

  1. BabyDunk

    BabyDunk Active Member

    Joined:
    Feb 26, 2017
    Messages:
    279
    Likes Received:
    22
  2. cyclops4real007

    cyclops4real007 Member

    Joined:
    Jan 25, 2017
    Messages:
    147
    Likes Received:
    6
    so has the auction refresh beeb solved?
     
  3. BabyDunk

    BabyDunk Active Member

    Joined:
    Feb 26, 2017
    Messages:
    279
    Likes Received:
    22
    @cyclops4real007

    this is what has worked for me. i have done a slight revision on what i had originally posted in this thread.everything seems to work 100% from what i can see.. Give it a test and see if it works for you. i dont know if @david62311 had got round to trying it yet.

    here is it is......

    Created file /sellsuccess.php and placed this inside
    PHP:
    <?php
    include 'common.php';
    include 
    INCLUDE_PATH 'functions_sell.php';

    // Stop back button killing auction
    if (isset($_SESSION['previous'])) {
       if (
    basename($_SERVER['PHP_SELF']) != $_SESSION['previous']) {
            
    ### unset variable to stop back button
            
    unset($_SESSION['SELL_auction_id']);
           
    //header('location: user_menu.php');
       
    }
    }

    if(isset(
    $_GET['is'], $_GET['item'], $_GET['time'], $_GET['duration'])){
           
    $is $_GET['is'];
           
    $auction_id $_GET['item'];
           
    $a_ends $_GET['time'];
        

        
        switch(
    $is){
            case 
    'done':
        
            
    $template->assign_vars(array(
                        
    'AUCTION_ID' => $auction_id,
                        
    'MESSAGE' => sprintf($MSG['102'], $auction_id$dt->formatDate($a_ends'D j M \a\t g:ia'))
                        ));
            break;
            }
    }
    include 
    'header.php';
    $template->set_filenames(array(
            
    'body' => 'sellsuccess.tpl'
            
    ));
    $template->display('body');
    include 
    'footer.php';
       
    create sellsuccess.tpl in theme root and place this
    HTML:
    <div class="row">
        <div class="col-md-12">
            <div class="col-md-8 col-md-offset-2 well ">
                <legend>{L_028}</legend>
                <div class="table2 add_item">
                       <div class="padding">
                        {L_100}
                        <p>{MESSAGE}</p>
                        <ul>
                            <li><a href="{SITEURL}item.php?id={AUCTION_ID}&mode=1">{L_101}</a></li>
                            <li><a href="{SITEURL}edit_active_auction.php?id={AUCTION_ID}">{L_30_0069}</a></li>
                            <li><a href="{SITEURL}sellsimilar.php?id={AUCTION_ID}">{L_2__0050}</a></li>
                        </ul>
                    </div>
                </div>
            </div>
       </div>
    </div>
    Open sell.tpl in your theme and replace this
    HTML:
                       <div class="padding">
                        {L_100}
                        <p>{MESSAGE}</p>
                        <ul>
                            <li><a href="{SITEURL}item.php?id={AUCTION_ID}&mode=1">{L_101}</a></li>
                            <li><a href="{SITEURL}edit_active_auction.php?id={AUCTION_ID}">{L_30_0069}</a></li>
                            <li><a href="{SITEURL}sellsimilar.php?id={AUCTION_ID}">{L_2__0050}</a></li>
                        </ul>
                    </div>
    With this
    HTML:
    {REDIRECT}
    open sell.php and replace this
    PHP:
    PHP:
      
    $template->assign_vars(array(
      
    'ATYPE_PLAIN' => null,
      
    'ERROR' => null,
      
    'TITLE' => $MSG['028'],
      
    'PAGE' => 3,
      
    'AUCTION_ID' => $auction_id,
      
    'MESSAGE' => sprintf($MSG['102'], $auction_id$dt->formatDate($a_ends'D j M \a\t g:ia'))
      ));
    with this
    PHP:
                $template->assign_vars(array(
                        
    'ATYPE_PLAIN' => null,
                        
    'ERROR' => null,
                        
    'TITLE' => $MSG['028'],
                        
    'PAGE' => 3,
                        
    'AUCTION_ID' => $auction_id,
                        
    'REDIRECT' => header('location: sellsuccess.php?is=done&item='.$auction_id.'&time='.$a_ends.'&duration='.$duration.''),
                        ));
    on sell.php find this
    PHP:
      case 4// finalise auction (submit to db)
      // does the user need to login before they can submit the auction?
    replace with this
    PHP:
      case 4// finalise auction (submit to db)
      // does the user need to login before they can submit the auction?
      //Setting $_SESSION for No Back Button
      
    $_SESSION['previous'] = basename($_SERVER['PHP_SELF']);
     
    Last edited: Apr 16, 2017
  4. david62311

    david62311 Well-Known Member

    Joined:
    Aug 29, 2013
    Messages:
    2,133
    Likes Received:
    242
    That should work. No, I never got around to it. I am seeing suggestions online that are similar to what you did there to prevent form resubmission. I will give a try later when I get more time.
     
    BabyDunk likes this.
  5. BabyDunk

    BabyDunk Active Member

    Joined:
    Feb 26, 2017
    Messages:
    279
    Likes Received:
    22
    @cyclops4real007 with you being on version 1.2.1 you will need to stick something like these in your new created sellsuccess.php instead.

    i have no means on testing that so let me know who it goes :)

    PHP:
    <?php
    include 'common.php';
    include 
    INCLUDE_PATH 'functions_sell.php';

    // Stop back button killing auction
    if (isset($_SESSION['previous'])) {
       if (
    basename($_SERVER['PHP_SELF']) != $_SESSION['previous']) {
            
    ### unset variable to stop back button
            
    unset($_SESSION['SELL_auction_id']);
       }
    }

    if(isset(
    $_GET['is'], $_GET['item'], $_GET['time'])){
           
    $is $_GET['is'];
           
    $auction_id $_GET['item'];
           
    $a_ends $_GET['time'];
           

           
        switch(
    $is){
            case 
    'done':
           
            
    $template->assign_vars(array(
                        
    'AUCTION_ID' => $auction_id,
                        
    'MESSAGE' => sprintf($MSG['102'], $auction_iddate('D j M \a\t g:ia'$a_ends $system->tdiff))
                        ));
            break;
            }
    }
    include 
    'header.php';
    $template->set_filenames(array(
            
    'body' => 'sellsuccess.tpl'
            
    ));
    $template->display('body');
    include 
    'footer.php';
       
     
  6. cyclops4real007

    cyclops4real007 Member

    Joined:
    Jan 25, 2017
    Messages:
    147
    Likes Received:
    6
    ok will check em out thanks
     
  7. mirecart

    mirecart New Member

    Joined:
    Jul 20, 2017
    Messages:
    27
    Likes Received:
    6
    I've just made the alterations and included the new files as outlined and it worked a treat, thank you @BabyDunk
     
    BabyDunk likes this.

Share This Page