Results 1 to 16 of 16
  1. #1

    mandatory refresh

    I have a site that uses php and javascript that must be run every time, however if the user hits the back button, the php is not run, how can i make the page run the php even on the user hitting the back button?

    thanks
    workstations&servers @
    http://www.advancedproprietarysystems.com

  2. #2
    It's not possible to do that, but you could setup a crontab to run the script every minute or so

  3. #3
    hum..

    maybe if i explain more in depth, a different solution will become apparent, i need my page to refresh at a specified time, right now i am using php to run a javascript that is counting down, so that it refreshes at a certain time. is there a way to make it refresh at a certain time maybe?
    workstations&servers @
    http://www.advancedproprietarysystems.com

  4. #4
    Yes, by setting a crontab to run at a certain time. Do you have your own server? or does your host allow you to run cronjobs?

  5. #5
    Join Date
    Dec 2004
    Location
    Fort Lauderdale, Florida
    Posts
    481
    You can set the page to refresh every x amount of seconds. This is done by meta tags in the HTML, not the PHP. But, if you need the .php script to be run at a specified time (such as 9AM), Jason.NXH's suggestion of using cronjobs would work.

    Josh
    Voxxit - Accessible Web Design & Secure, Affordable Web Hosting
    Now offering 501(c)3 non-profit discounts!
    Ruby on Rails included with every hosting account! - Save up to 80% bandwidth on all plans with mod_deflate!
    Visit our services page to see how Voxxit can help you today!

  6. #6
    well what i needed was for a clients page to refresh at a certain time, and when you hit the back button, the php would not report a new time, it would report the old time, because the script of php was not rerun on hitting the back button. i somehow need to make it not possible to hit the back button. i dont want to do refresh every x seconds, becuase that will take too much bandwidth, and will cause me problems.

    maybe i could do something like send post data to each page, and if then the php checks to see if the post data is correct, or something?
    workstations&servers @
    http://www.advancedproprietarysystems.com

  7. #7
    Join Date
    Dec 2004
    Location
    Fort Lauderdale, Florida
    Posts
    481
    Maybe javascript is your answer? I don't really know because I don't exactly understand what you're trying to do.

    Josh
    Voxxit - Accessible Web Design & Secure, Affordable Web Hosting
    Now offering 501(c)3 non-profit discounts!
    Ruby on Rails included with every hosting account! - Save up to 80% bandwidth on all plans with mod_deflate!
    Visit our services page to see how Voxxit can help you today!

  8. #8
    well, it is kindof like a turn in a game, at exactly say 12:42:32 (h/m/s)
    all the clients need to be send to a certain page. however, if people hit the backspace button, (and sometimes even when they dont hit the backspace button) the browser will use the old js/html code that might make it off by quite a few seconds, thus destroying the synchronization.

    does that make any sense?

    is there possibly a way to make only the js part of the page refresh?
    workstations&servers @
    http://www.advancedproprietarysystems.com

  9. #9
    basically what i need is an iframe with the javascript counter that can refresh the main page that is displayed in, is this possible?
    workstations&servers @
    http://www.advancedproprietarysystems.com

  10. #10
    hi variable,

    u jst need to use one variable and pass the value to each query ..
    so u jst pass a hidden value which may be present in each page..
    When the user clicks the back button, it jst need to query to the same page..and the page must be displayed only when the value of the variable is same..

    And if ur issue is jst a back button press or to disable the back button.. u can jst use some javascript for that..

  11. #11
    what do you mean by pass a hidden value to each page?

    how could you disable tha back button?

    sometimes too the page, even when not hitting the back button, the browser(i guess) caches the page so that it doesnt run the php, thus making my timer useless. thats why i was wondering if there is a way for me to put the timer in an iframe that refreshes, say every 10 seconds, and once the timer hits 0, the entire main page get sent to a certain location. is there any way for me to do this? to make an iframe change the main page?

    thanks
    workstations&servers @
    http://www.advancedproprietarysystems.com

  12. #12
    to disable back button is browser dependent.. u can do that by writing some thing like this ..

    This code will work for IE ..
    "Page A calls Page B

    User should not be allowed to go to Page A from Page B.

    Put the code below in Page A.

    <Script>
    window.history.forward(1);
    </Script>
    "

    Then the users will get the page cached in their system. But still if they are clicking some button in the previous page, and if they are trying to connect to your server, u can check that by using php.

    For example , if a user is in page B , where pageA was his first page, and if he tried back button and entered some other values in that pageA ..and if hez trying to access pageB..
    It can be cross checked using php..
    i hope enabling sessionids will do for this

  13. #13
    move from page1 -> page2, and want to disable the browser back in page 2,then add the following at the top of page1.

    <script>
    if(window.history.forward(1) != null)
    window.history.forward(1);
    </script>
    This works for both IE and NS

    2.You may also replace the page in the history with the current page itself so that there is no page to go back.
    location.replace(this) would do this.

    3.If you are using JSP and not HTML, the best thing would be to prevent the JSP page from caching itself.
    ********
    An alternative is

    <script>
    history.forward();
    </script>

    Put this anywhere on the page you dont want to go back to.
    **********
    Theres another way you can do it.
    Simply hide the back button and use a javascript to cancel out the Backspace button on the keyboard.

    <script>
    function KeyCache() {
    if (window.event && window.event.keyCode == 8) {
    window.event.keyCode = 123; //Replaces with F12 button. (Does nothing in IE)
    }
    }
    document.onkeydown=KeyCache();
    </script>
    **********

  14. #14
    that is pretty nifty, is there any way to prevent html from cacheing?

    because i still have the occasional problem where the browser doesnt run the php, and just loads the cached html. that was why i was wondering if there was any way to do the frame system?

    thanks, that code is most usefull too!
    workstations&servers @
    http://www.advancedproprietarysystems.com

  15. #15
    i dont think preventing caching is possible ..coz itz browser dependent..like itz a setting in the browser..

  16. #16
    what about the timer in the iframe, any idea if thats possible?
    workstations&servers @
    http://www.advancedproprietarysystems.com

Posting Permissions

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