Hello; My question is not as simple as the title suggests. I am sure you all know what the following code does: <meta http-equiv="refresh" content="800;url=http://www.paniad.org/index.php" /> HTML: Is it possible to do it using php? In other words, it it possible with php to force the visitor out of the page after a certain period, 800 seconds, for example?
PHP is server script, server cannot wait 800s to redirect You can use this script: echo '<meta http-equiv="refresh" content="800;url=http://www.paniad.org/index.php" />'; PHP:
I think this is what you want: <?php sleep(800); header("Location: http://www.example.com/"); ?> PHP:
Browser will definitely give a Network Timeout error if you sleep for 800s. So, langtusitinh225 is correct that server cannot wait for 800s to redirect. As of your problem, it seems, the user sees the page, now if forgets to close the page, then after 800sec he is redirected to a new page. This can be solved with meta tag or JS only. Best is combination of both
You can also use Javascript for this purpose: <script type="text/javascript"> window.setTimeout('window.location = "http://www.paniad.org/index.php"',800*1000); </script> HTML: