Page 1 of 1
showing progression bar
Posted: Sat Jul 03, 2004 4:34 am
by faheemhameed
Hi there,
I wanted to send a few thousands of email to my list of contacts using php. How can I show a progression bar in the browser? I want to display approximate time to finish, how many emails to send etc.
Please shed some lights
Thanks
Hameed
Posted: Sat Jul 03, 2004 5:40 am
by feyd
uh... use refreshes while you process. You'll likely have to batch the mailings, because a lot of servers have a limit they allow someone to send in a given period of time.
Posted: Sat Jul 03, 2004 5:45 am
by Weirdan
general idea is to echo js which would advance the progress bar:
Code: Select all
set_time_limit(0);
echo <<<EOF
<script language='Javascript'>
function advance() {
pg = document.getElementById('pg');
pg.style.width = (parseInt(pg.style.width)+1)+'px';
}
</script>
<div style='width:0px; height:10px; background:blue' id='pg'> </div>
EOF;
for($i = 0; $i<100; $i++) {
echo '<script language="Javascript">advance();</script>';
flush();
sleep(30);
}
bluescreen
Posted: Sat Jul 03, 2004 11:06 am
by djot
-
Hi,
I never had a bluescreen with WinXP since I tried this progress bar above.
I did change the for limit to $i<10000 and sleep(0.5).
After that my PC hang up with bluescreen
djot
PS: anyway I should have used usleep();
-
Posted: Sat Jul 03, 2004 11:09 am
by feyd
[php_man]sleep[/php_man] wrote:void sleep ( int seconds)
notice how it takes an integer, that may have caused the crash.
another one
Posted: Sat Jul 03, 2004 11:20 am
by djot
Posted: Sat Jul 03, 2004 3:21 pm
by John Cartwright
this will sleep for half a sec
dont know why it crashes
Posted: Sat Jul 03, 2004 4:10 pm
by djot
-
The php was running on a linux server. But my pC crashed

so perhaps it was the browser.
first attemp was $i<100 and sleep(0.5), that did not crash. But $i<10000 and sleep(0.5) did.
Anyway, i just wanted to point out that I had my first blue screen.
(and i did add a PS in my previous post also)
djot
-
Posted: Mon Jul 05, 2004 12:32 am
by faheemhameed
Thank you all for your help.
I am using the progression bar class from phpclasses
Works fine.
Thanks
Hameed