You are here: Re: howto: please wait, this may take a few seconds... « PHP Programming Language « IT news, forums, messages
Re: howto: please wait, this may take a few seconds...

Posted by Erwin Kloibhofer on 10/01/37 11:27

thanks for all your input, it did help a lot!

i came up with a piece of code that does exactly what i want. that is...

o) send out a page with a "this may take a while..." message
o) wait on the server until a certain event has happened
o) once it did happen, redirect to a different page

the only drawback i can see is that the browser keeps displaying "opening
page bla". that is something i can live with and i guess any other solution
that would avoid this would be too difficult to implement, where else the
current solution seems elegant and simple.

one problem i had to solve was to force the browser to do a full reload of
that page, and not taking the page from the cache. is there a more elegant
method to achieve this?

can anyone see any other problems with this code? what i am concerned about
is that after i sent the </body> and </html> tags i keep sending data...

======================================================

<?php
// create a header from the past to make sure the page does not get cached
header("Expires: Mon, 01 Jan 1999 05:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
?>
<html>
<body onload="location.href='index.php'">
This may take a while...
</body>
</html>
<?php
if (ob_get_level() == 0) ob_start();
for ($i = 0; $i < 3; $i++)
{
echo "<b></b>"; // send some useless tags
echo str_pad('', 4096)."\n"; // send at least a 4K buffer
ob_flush();
flush();
sleep(2);
}
ob_end_flush();
?>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация