PDA

View Full Version : PHP timout



thesleuth
September 11th, 2006, 03:37 AM
I have a process page which process some data, and it shows an image of a loading bar, I want the page to display success after 5 seconds, how do I do that?

I believe I have to use set time limit function but I don't know what or how to write. Thanks for helping :)

thesleuth
September 11th, 2006, 04:58 AM
During process, if the process is not completed, I'll put a loading page, if it is, I'll put a success page.


if(!$register){
?>
Loading...
<?
}else if($register){
echo 'Success';
}

Does the above work? (It will show the success page when the process is completed) I am unable to try it out...

Sniper Jo
September 11th, 2006, 11:01 AM
you can just use javascript to set a time out of 5 seconds and then goto yourpage.php?sucess=1,

thesleuth that wont work, as all the script is parsed as one at the end. if you unbuffered the output you might be able to

raz
September 11th, 2006, 06:12 PM
Have the PHP process whatever its going to process and use javascript to show success.

Basically have something like:



<?

if ($register) {
?>
<put some div here name="success">
Success
<?
}
else {
Loading...
}
?>


And Have in the div - <img src="loading" /> ect. Use javascript to have a timeout (I'm not sure the exact script) and have it do document.div.style='visibility:hidden';

What I'm talking about is quite similar to a preloading page thats on DynamicDrive - It sets a <div></div> directly under <body> that is the whole pages length and width, and until the page completely loads, the div stays up. Once the page loads, the div disappears. If you want to see the code, I'll have to find it for you. Just tell me and I'll go look for it.

thesleuth
September 12th, 2006, 02:05 AM
That won't be necessary, thanks for being such a great help, both of you :D