I need to have a page that shows "Please Wait" and shows progress periodically while a background process runs (think Expedia or Orbitz).
I found some code on the web and tested it on my Windoze XP Pro box...worked just fine. I then placed the code on my web server (W2K server, IIS 5) in a new file, but it does not work.
The process is:
- User submits files on page A
- Page A uploads the files to a remote directory
- Page B loads. Says "Please wait" and shows 4 graphics. One graphic is "highlighted" and it changes every time page B refreshes -> every 3 seconds
- Meanwhile, a perl script is handling the uploaded files. When the script completes, a log file is generated.
- Page B "sees" the log file, then loads Page A
Here is page B:
When I enter this page in my web browser (IE6) it just hangs and never loads the page. Note: Before I go to this page I pass thru a login page that registers the session variables.
Any ideas on what I am doing wrong?
I found some code on the web and tested it on my Windoze XP Pro box...worked just fine. I then placed the code on my web server (W2K server, IIS 5) in a new file, but it does not work.
The process is:
- User submits files on page A
- Page A uploads the files to a remote directory
- Page B loads. Says "Please wait" and shows 4 graphics. One graphic is "highlighted" and it changes every time page B refreshes -> every 3 seconds
- Meanwhile, a perl script is handling the uploaded files. When the script completes, a log file is generated.
- Page B "sees" the log file, then loads Page A
Here is page B:
Code:
<?PHP
require("session_globals_etc.inc")
$goback = "pageA.php";
$thispage= "pageB.php";
//Check if the process is done
$sid = session_id();
$logfile = $sid . '.log';
if (file_exists("/somelocation/$logfile"))
{
$_SESSION['counter'] = 1;
next_step($goback);
}
// Build out the page structure
if(($_SESSION['counter'] < 1) || ($_SESSION['counter'] > 5))
{
$_SESSION['counter'] = 1;
}
$images = '';
for($idx = 1; $idx < 5; $idx++)
{
if($idx == $_SESSION['counter'])
{
$images .= "<img src='../images/target_gold.gif' alt='Waiting'>";
} else {
$images .= "<img src='../images/target_gray.gif' alt='Waiting'>";
}
if($idx < 4)
{
$images .= "<img src='../images/spacer.gif' height='1' width='12'>";
}
}
$tblMain = "<table width='95%' align='center' class='list'>";
$tblMain .= "<tr>";
$tblMain .= " <td align='center'><h3>Please Wait</h3></td>";
$tblMain .= "</tr>";
$tblMain .= "<tr>";
$tblMain .= " <td align='center'>$images</td>";
$tblMain .= "</tr>";
$tblMain .= "</table>";
// Function to determine if this page is refreshed, or go back (we are finished)
function next_step($sUrl)
{
if (!headers_sent())
{
header('HTTP/1.1 201 Created');
header ("Location: $sUrl");
exit;
// Use refresh if header does not work.
} else {
echo "\n<meta http-equiv=\"refresh\" "
. " content=\"0;URL=$sUrl\">\n";
}
}
echo "
<html>
<head>
<LINK HREF='../include/my.css' REL='stylesheet' TYPE='text/css' />
</head>
<body leftmargin='5'>
$tblMain
</body>
</html>
";
flush();
sleep(3);
$_SESSION['counter']++;
next_step($thispage);
?>
When I enter this page in my web browser (IE6) it just hangs and never loads the page. Note: Before I go to this page I pass thru a login page that registers the session variables.
Any ideas on what I am doing wrong?