...

View Full Version : Header/Session



kehers
03-01-2007, 05:48 PM
Ive been having problems with when using header() and session() on the same page. I am actually trying to create a download page that checks if a certain session is registered before bringing up the save as dialogue box via header. The script looks something like this -


<?php
session_save_path('../../../my_sessns');
session_start();
if($_SESSION['cur_usr']){
//get $_get variable and declare some variables
header("Pragma: no-cache");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Cache-Control: no-cache, must-revalidate, post-check=0, pre-check=0");
header("Content-type: $mime");
header("Content-Length: $filesize");
header("Accept-Ranges: bytes");
header("Content-Disposition: attachment; filename=\"$file\"");
header("Content-Transfer-Encoding: binary");
set_time_limit(0);
readfile("../../../files/$dir/$file");
exit;
}
else{
include_once '../includes/register.php';
}
?>

The script seem to work well on firefox and opera (9) but doesnt on IE7. Any ideas what could be wrong?

CFMaBiSmAd
03-01-2007, 07:02 PM
Define: "doesnt on IE7" Telling us that it does not work does not narrow it down. We can guess this much because you are asking a question on a help forum.

What does it do? What symptoms are there?

JohnDubya
03-01-2007, 07:51 PM
Is there an error, or is it just not working?

aedrin
03-01-2007, 11:08 PM
There's quite some pickyness with browsers and sending files like this.

Just look at the notes for header(). I've found all my solutions for this here.

http://us2.php.net/manual/en/function.header.php

kehers
03-02-2007, 02:57 PM
No errors displayed. Though it puts up the save as dialogue box, it simply downloads the script page



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum