Hallo,
I’m working on a newsletter system (tested on Apache 1.3.29 (Win32) and PHP 4.3.6) and I’m stuck with showing the progress of the send process to the client.
If the client initializes the send process…
1) …a new window pops up that actually sends the letters. After each letter that is send, this script writes the progress state into the SESSION array. Code:
for ($i2=0; $i2<Count($this->subscr->subscribers); $i2++) {
// sending…
$_SESSION['PROGRESS_PCENT'] = (int)$pcent;
}
2) At the same time the client is supposed to see the progress in an iframe that actually refreshed itself to get the new progress value. Code:
echo $_SESSION['PROGRESS_PCENT'].' %';
This code is simplified to the relevant fragments. The problem seems that the iframe (2) WAITS for the other process (1) to be finished.
I also tried to print for example date(“H:i:s”). The page refreshed, but it was always the same time!
I’ve had a similar experience with trying to write the progress into a file and read this file into the iframe.
I can’t click a link or do anything in the window that started the process. But if I open a new browser window I can use the system as usual and with good performance. So I guess it has to do with the PHP thread, that doesn’t store and free the used resources until the send process is finished.
What is a possible solution for this problem? I read the threads in this forum about progress bar problems and the only thing I found was that I might have to use ouput buffering. Is that right and does anyone have a code example (based on my code) how I could realize that?
Please help, I’m at the end of my capabilities and tired from working the whole 2 days on this problem. Thanks in advance,
Lynky