2

I've searched but haven't been able to find any discussion on this topic:

I have a private webpage (implemented in php) that scrolls through a few different php pages displaying info then refreshing to the next one every minute for use in a fire station displaying latest jobs, weather etc. I currently use header( 'refresh: 60; url=screen2.php' ); in each php file simply pointing to the next file..

The problem is that every once in a while the page fails to load for one reason or another, at which point the "Server not found" page is displayed. When that happens of course the refresh instruction is lost and error page stays there until someone notices the problem and manually refreshes the page. Not ideal..

I should mention the page is displayed on multiple monitors around the fire station and the pc running it is locked away. Hence the hassle of manually refreshing it every so often!

It's important if possible to automatically recover from this situation without human intervention. Is there any way, using frames, php, javascript or otherwise, to refresh again if the error page is shown?

Any ideas would be greatly appreciated.

Thanks! Adam

4

3 に答える 3

1

You could just use javascript window.location inside a setTimeout function or a meta refresh tag.

There's no reason to need to do it on the PHP side unless you care whether the user can change the refresh information.

于 2012-07-07T15:59:19.100 に答える
0

You say it "fails to load for one reason or another" - do you know why this is? If the problem is at your server end, then you could set up your server so that its 404 response (or 500 internal server error response, or whatever error it is) contains the header to redirect to the start PHP page.

If the issue is DNS or connection related - ie. the server isn't even contacted and so the "not found" error page is being displayed by the browser, then what you could do is alter this page. This is not easy to do, but in Firefox you can e.g. follow the instructions on http://forums.mozillazine.org/viewtopic.php?f=7&t=492177&start=0 in order to customise the error page shown.

Other than that, it might be better to fix the problem with the page failing to load, that might be simpler :)

于 2012-07-07T16:04:07.137 に答える
0

You could also save the information in a session. http://php.net/manual/en/features.sessions.php

Another way that is server-independent is the Web Storage API of javascript. Most modern browsers already support it.

于 2012-07-07T16:04:25.857 に答える