JW wrote:
I wanted have this as part of a flood control script:
<?
echo ("Flood control in place - please wait " . $floodinterval . " seconds
between postings.");
sleep(5);
// go back two pages
echo "<script>window.history.go(-2);</script>";
exit;
?>
Problem is that the first echo never shows up on the page; it displays a blank
page (well, the page constructed up to PHP section), then sleeps for the five
seconds and goes back two pages.
Why?
Could be caching is turned on with your web server. So you're spitting
out the notice, but the server is holding all your output until the
script is done. In which case the browser gets the <script> and
executes it right away, before you can see the notice posted on the page.
You could have the script execute with a
<script language="javascript">
window.setTimeout('window.history.go(-2);', 5000);
</script>
which will tell the browser to wait 5 seconds before going back. Even
if caching is turned on, this should work.
Jason