By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,852 Members | 2,152 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,852 IT Pros & Developers. It's quick & easy.

fpassthru sessions and avant browser issues

P: n/a
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.
Jul 17 '05 #1
Share this Question
Share on Google+
1 Reply


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

"GameDev" <sp**@spambaron.com> wrote in message
news:Ft********************@giganews.com...
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.

Jul 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.