Connecting Tech Pros Worldwide Forums | Help | Site Map

fpassthru sessions and avant browser issues

GameDev
Guest
 
Posts: n/a
#1: Jul 17 '05
I have a section of my website where customers can login and download a few
select files.
The download links are to php scripts that decide which files to download.

Generally it works fine. However I have one browser compaibilty problem and
an annoyance with MS Internet Explorer

With IE if the user cancels the download (they are only small downloads so
this is unlikely) the browser will stop working corectly from then on: All
links on the page will stop working until the browser is closed and
reopened.

With the Avant Browser (http://www.avantbrowser.com ) Downloads fail as the
DL script seems to bump the user to the customer login page.

Here's the code:


<?php
//Generic PHP Header Commands
session_start();

//Check the Customer is Logged In and kick them if they aren't (I think this
is where avant browser fails)
if( !$_SESSION['CustomerID'] )
{
header("Location: http://{$_SERVER['HTTP_HOST']}" .
dirname($_SERVER['PHP_SELF']) . '/cust-login.php');
exit();
}

//then I get some data about the filename from our database and assign the
correct filename to $filepath
//I've deleted this section because it is irrelevant to this problem

//here's where I output the file
$fp = fopen($filepath, "rb");
// send the right headers
header('Cache-Control: no-cache, must-revalidate');
header('Pragma: no-cache');
header("Content-Type: application/octet-stream");
header("Content-Disposition: attachment; filename=\"".$urlfilename."\"");
header("Content-Length: ".filesize($filepath));
fpassthru($fp);
exit;
?>

PHP version is: 4.1.2 and I'm using the latest versions of IE and avant
browser running under Windows 2000

Really appreciate any help from any php masters!

-Nick.



Game Dev
Guest
 
Posts: n/a
#2: Jul 17 '05

re: fpassthru sessions and avant browser issues


Incase anyone had the same problem: the Avant issue is fixed in the latest
update to their browser.



"GameDev" <spam@spambaron.com> wrote in message
news:Ft-cnW9MQZk1zS-iU-KYjw@giganews.com...[color=blue]
> I have a section of my website where customers can login and download a[/color]
few[color=blue]
> select files.
> The download links are to php scripts that decide which files to download.
>
> Generally it works fine. However I have one browser compaibilty problem[/color]
and[color=blue]
> an annoyance with MS Internet Explorer
>
> With IE if the user cancels the download (they are only small downloads so
> this is unlikely) the browser will stop working corectly from then on: All
> links on the page will stop working until the browser is closed and
> reopened.
>
> With the Avant Browser (http://www.avantbrowser.com ) Downloads fail as[/color]
the[color=blue]
> DL script seems to bump the user to the customer login page.
>
> Here's the code:
>
>
> <?php
> //Generic PHP Header Commands
> session_start();
>
> //Check the Customer is Logged In and kick them if they aren't (I think[/color]
this[color=blue]
> is where avant browser fails)
> if( !$_SESSION['CustomerID'] )
> {
> header("Location: http://{$_SERVER['HTTP_HOST']}" .
> dirname($_SERVER['PHP_SELF']) . '/cust-login.php');
> exit();
> }
>
> //then I get some data about the filename from our database and assign the
> correct filename to $filepath
> //I've deleted this section because it is irrelevant to this problem
>
> //here's where I output the file
> $fp = fopen($filepath, "rb");
> // send the right headers
> header('Cache-Control: no-cache, must-revalidate');
> header('Pragma: no-cache');
> header("Content-Type: application/octet-stream");
> header("Content-Disposition: attachment; filename=\"".$urlfilename."\"");
> header("Content-Length: ".filesize($filepath));
> fpassthru($fp);
> exit;
> ?>
>
> PHP version is: 4.1.2 and I'm using the latest versions of IE and avant
> browser running under Windows 2000
>
> Really appreciate any help from any php masters!
>
> -Nick.
>
>
>[/color]


Closed Thread