fpassthru sessions and avant browser issues

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • GameDev

    fpassthru sessions and avant browser issues

    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("Locatio n: http://{$_SERVER['HTTP_HOST']}" .
    dirname($_SERVE R['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=\"".$u rlfilename."\"" );
    header("Content-Length: ".filesize($fil epath));
    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

    #2
    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.c om...[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("Locatio n: http://{$_SERVER['HTTP_HOST']}" .
    > dirname($_SERVE R['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=\"".$u rlfilename."\"" );
    > header("Content-Length: ".filesize($fil epath));
    > 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]


    Comment

    Working...