SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Zealot
    Join Date
    May 2004
    Location
    London
    Posts
    123
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Quicky - Going back does not unset variables?

    If a user uses the back browser button and goes back to a page that is unsetting the variables that come from that page, why doesn't it unset them?

    PHP Code:
    <?php 
    session_start
    (); 
    header("Cache-control: private"); // IE 6 Fix. 
     
    // Products function list file

    include("scripts/produtos-inc.php");

     
    // Redirect user to an error page if no product was chosen
     
    if (empty($cart_produto)) { 
        
    header("location:erro-passos-jump.php");  


    unset(
    $_SESSION['sub_total']); 
    unset(
    $_SESSION['custo_total']); 
    unset(
    $_SESSION['presente_preco1']); 
    unset(
    $_SESSION['presente_preco2']); 
    unset(
    $_SESSION['presente_preco3']); 
    unset(
    $_SESSION['presente_preco4']); 
    unset(
    $_SESSION['presente_preco5']); 
    unset(
    $_SESSION['presente_preco6']); 
    ?>

  2. #2
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,190
    Mentioned
    191 Post(s)
    Tagged
    2 Thread(s)

    back - sessions

    Is the user reloading the page so the server will parse the script, or, is the user simply seeing a cached page that the server parsed previously?

  3. #3
    SitePoint Zealot
    Join Date
    May 2004
    Location
    London
    Posts
    123
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Mittineague
    Is the user reloading the page so the server will parse the script, or, is the user simply seeing a cached page that the server parsed previously?

    I guess he is using the cached page because it is ignoring the unset on top of that very page and it isn't really reloading the page at all.

  4. #4
    SitePoint Evangelist
    Join Date
    Feb 2000
    Location
    England
    Posts
    568
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Add no cache headers to the top of the script.

  5. #5
    SitePoint Zealot
    Join Date
    May 2004
    Location
    London
    Posts
    123
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    padders, that did it!

  6. #6
    SitePoint Zealot
    Join Date
    May 2004
    Location
    London
    Posts
    123
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Oh, and thanks by the way!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •