Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 03-01-2007, 05:48 PM   PM User | #1
kehers
Regular Coder

 
Join Date: Mar 2006
Location: Nigeria
Posts: 192
Thanks: 0
Thanked 0 Times in 0 Posts
kehers is an unknown quantity at this point
Header/Session

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 Code:
<?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?
kehers is offline   Reply With Quote
Old 03-01-2007, 07:02 PM   PM User | #2
CFMaBiSmAd
Senior Coder

 
CFMaBiSmAd's Avatar
 
Join Date: Oct 2006
Location: Denver, Colorado USA
Posts: 2,711
Thanks: 2
Thanked 251 Times in 243 Posts
CFMaBiSmAd is a jewel in the roughCFMaBiSmAd is a jewel in the roughCFMaBiSmAd is a jewel in the roughCFMaBiSmAd is a jewel in the rough
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?
__________________
If you are learning PHP, developing PHP code, or debugging PHP code, do yourself a favor and check your web server log for errors and/or turn on full PHP error reporting in php.ini or in a .htaccess file to get PHP to help you.

Last edited by CFMaBiSmAd; 03-01-2007 at 07:16 PM.. Reason: fixed word
CFMaBiSmAd is offline   Reply With Quote
Old 03-01-2007, 07:51 PM   PM User | #3
JohnDubya
Super Moderator


 
JohnDubya's Avatar
 
Join Date: Nov 2006
Location: Missouri
Posts: 634
Thanks: 12
Thanked 18 Times in 18 Posts
JohnDubya is on a distinguished road
Is there an error, or is it just not working?
__________________
JDub
http://johnnyzone.com/blog
JohnDubya is online now   Reply With Quote
Old 03-01-2007, 11:08 PM   PM User | #4
aedrin
Senior Coder

 
Join Date: Jan 2007
Posts: 1,648
Thanks: 1
Thanked 58 Times in 54 Posts
aedrin will become famous soon enough
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
aedrin is offline   Reply With Quote
Old 03-02-2007, 02:57 PM   PM User | #5
kehers
Regular Coder

 
Join Date: Mar 2006
Location: Nigeria
Posts: 192
Thanks: 0
Thanked 0 Times in 0 Posts
kehers is an unknown quantity at this point
No errors displayed. Though it puts up the save as dialogue box, it simply downloads the script page
kehers is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 03:53 PM.


Advertisement
Log in to turn off these ads.