1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Force reload page when using back button?

Discussion in 'PHP' started by lateuk, Nov 16, 2007.

  1. #1
    Hello,
    I have reciently swapped web hosting companies and therefor i am now using PHP5. One of my pages needs to be reloaded if the back button is used to return to it, i used to use the code:

    header("Cache-Control: no-store, no-cache, must-revalidate");
    header("Cache-Control: post-check=0, pre-check=0", false);

    but this does not seem to work any more.

    Can anyone help?

    Late
     
    lateuk, Nov 16, 2007 IP
  2. calum

    calum Peon

    Messages:
    2,821
    Likes Received:
    141
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Could you please create a phpinfo file and then PM me the URL, you might have missing apache modules that are needed, you old host must have had them but your new host doesn't.
     
    calum, Nov 17, 2007 IP
  3. lateuk

    lateuk Active Member

    Messages:
    317
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    58
    #3
    Pm sent. Thanks
     
    lateuk, Nov 18, 2007 IP
  4. lateuk

    lateuk Active Member

    Messages:
    317
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    58
    #4
    Can anyone else help?
     
    lateuk, Nov 20, 2007 IP
  5. Noddegamra

    Noddegamra Peon

    Messages:
    1,013
    Likes Received:
    23
    Best Answers:
    0
    Trophy Points:
    0
    #5
    man i hate it when sites take away the functionality of the back button.

    It's awful design when you need to take away browser functions. Its also a sign that the site is awful, to have to implement code to try and keep a user on it.
     
    Noddegamra, Nov 20, 2007 IP
  6. lateuk

    lateuk Active Member

    Messages:
    317
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    58
    #6
    That's not what i'm asking i dont want a page to cache, i want the page to reload if a user returns to it.
     
    lateuk, Nov 20, 2007 IP
  7. Noddegamra

    Noddegamra Peon

    Messages:
    1,013
    Likes Received:
    23
    Best Answers:
    0
    Trophy Points:
    0
    #7
    oops, ok I'm sorry :)
     
    Noddegamra, Nov 20, 2007 IP
  8. lateuk

    lateuk Active Member

    Messages:
    317
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    58
    #8
    No problem, i completely agree with you, there is nothing worse than going to a page from google and then not being able to use the back button to get back to your Google results.

    Late
     
    lateuk, Nov 20, 2007 IP
  9. Noddegamra

    Noddegamra Peon

    Messages:
    1,013
    Likes Received:
    23
    Best Answers:
    0
    Trophy Points:
    0
    #9
    You could probs get around it using this cheeky code..?

    
    <?php
    
    session_start();
    if($_SESSION['views'] < 1)
    	{
    		$_SESSION['views'] = 1;
    		?><META HTTP-EQUIV=Refresh CONTENT="0"><?php
    	}
    
    session_destroy();
    
    ?>
    
    PHP:

    That way, each time the page is viewed, it is refreshed. A bit of a nasty work around.

    You could just put the session_destroy() in other pages.

    I dunno - i will try and look for something better.. lol
     
    Noddegamra, Nov 20, 2007 IP
  10. alcuadrado

    alcuadrado Peon

    Messages:
    6
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #10
    AS you always destroy the session, it's the same as writing in the HTML: <META HTTP-EQUIV=Refresh CONTENT="0">
     
    alcuadrado, Nov 20, 2007 IP
  11. Noddegamra

    Noddegamra Peon

    Messages:
    1,013
    Likes Received:
    23
    Best Answers:
    0
    Trophy Points:
    0
    #11
    what the?

    what... a... noob! I can't believe it. I've obviously been working too hard. lol

    alcuadrado is right, ignore my post.

    lol- im so embarassed. I was modifying a code for functionality similar, but got lost along the way. I apologise.
     
    Noddegamra, Nov 20, 2007 IP
  12. Noddegamra

    Noddegamra Peon

    Messages:
    1,013
    Likes Received:
    23
    Best Answers:
    0
    Trophy Points:
    0
    #12
    Noddegamra, Nov 21, 2007 IP
  13. maya75

    maya75 Peon

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #13
    Simply putting

    session_start();
    PHP:
    on top of my script does the trick for me (PHP Version 5.2.0).
     
    maya75, Apr 15, 2008 IP
  14. bartolay13

    bartolay13 Active Member

    Messages:
    735
    Likes Received:
    14
    Best Answers:
    1
    Trophy Points:
    98
    #14
    after back button try to press f5 or refresh, back button still executes
    sesion_start();
    ive tried history +1 on js, just a cheat, that forces the cookies to reload the recent page..
     
    bartolay13, Apr 15, 2008 IP