Re[2]: [PHP] problem with header-dispotition in IE

2004-09-20 Thread adwinwijaya
Hello Marek,

Monday, September 20, 2004, 6:58:46 PM, you wrote:

MK> adwinwijaya wrote:
>> Hi all ...
>> 
>> 
>> I have script that looks like :
>> 
>> if(file_exists($filename)){
>>   $len = filesize($filename);
>>   //header("Content-type: attachment/pdf");
>>   header('Content-Type: application/pdf');
>>   //header("Content-Type: application/octet-stream");
>>   header("Content-Type: application/force-download");
>>   header("Content-Length: $len");
>>   
>>if(preg_match("/MSIE/", $_SERVER["HTTP_USER_AGENT"])){
>> header("Content-Disposition:
>> attachment; filename=".$name.".pdf","pdf");
>>}else
>>{
>> header("Content-Disposition:
>> attachment; filename=".$name.".pdf","pdf");
>>}  
>>   
>>   //header("Content-Disposition: attachment;
>> filename=personal_inventory_forms.pdf");
>>   readfile($filename);
>> } else
>> {   
>> echo $filename ; 
>> echo ' ERROR :  file is not exist' ;
>> }
>> 
>> This script works very well on Mozilla, Opera and Safari..but doesnt
>> work with IE. can someone help me to solve this problem ?

MK> I suppose you are trying to force IE to download the pdf file, but it is
MK> always displaying it - you did not tell what is your problem.

MK> IE determines the type of file from the extension, if it is a known
MK> extension it ignores the content-type header. You might want to try
MK> adding space char after the filename, I've heard it works.

MK> PS: Second param to header should be bool


The error that I got just IE cannot download download.php from
mysite.com .. IE was not able to open this site and bla bla bla. No
hint in the error.

I think the problem that I faced is with SSL.
I try http://www.wazzup.co.nz/tutorials/protect_pdf/index.php
and it didnt work on my web

Why IE cannot work with SSL mode to download file ?
Is there any solution ?

-- 
Best regards,
adwin
www.kuya-kuya.net

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re[2]: [PHP] Problem with header

2004-03-25 Thread Tom Rogers
Hi,

Friday, March 26, 2004, 2:36:18 PM, you wrote:

pen> On 25 Mar 2004 at 14:10, Tom Rogers wrote:
 >> 
>> Any whitespace in any file before the > to the browser forcing the headers to be sent. So make sure the first
>> line of your page has  from
>> included pages as there may be blank lines following which are just as
>> bad. So the rule is, header() can go anywhere but before any output to
>> the browser.
>> 
pen> and also


>> One other little rule: get into the habit of putting the full url in
>> location, it will save you grief down the line :)
>> 
>> To redirect to the same page for example
>> 
>> $url = "http://".$_SERVER["HTTP_HOST"].$_SERVER["PHP_SELF";];
>> header("Location: $url");
>> 
pen> Thanks, Tom! That did the trick. I began the file with the  appears that for a web page that has a lot of ordinary HTML on it,
pen> the PHP must begin BEFORE even the Doc Type line. 

pen> I have a question about just how the PHP headers work; I have looked
pen> around in the PHP manual, but I am still not quite clear on this.

pen> I want to follow this logic when the user fills out the guestbook and
pen> clicks on the "submit" button. Is the following the general idea? (I
pen> have not tried to use the proper syntax, just want to know if the
pen> general logic is sound):

pen> if $submit //if the user has clicked the submit button
pen> then 
pen> check that the form is filled out correctly // validation routine
pen> if $notvalid then header("Location: $badform");
pen> else 
pen> check the URL's// make sure spammers are not trying to co-opt script
pen> if $urlfail then header("Location: $urlfail");
pen> else
pen> send the mail, redirect to thank you page // 
pen> header("Location: $url");

pen> $url = "http://www.whatever.com/thanks.shtml";;
pen> $urlfail ="http://www.whatever.com/warning.shtml";;
pen> $urlbadform="http://www.whatever.com/error.shtml";;

pen> Is that the way to use multiple headers for conditional statements?

pen> TIA --- Phil Matt

Yes that logic should work fine, and it will also stop the refresh
warning from the browser and help prevent multiple submissions.

-- 
regards,
Tom

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re[2]: [PHP] Problem with header

2004-03-24 Thread Tom Rogers
Hi,

TR> Any whitespace in any file before the  to the browser forcing the headers to be sent. So make sure the first
TR> line of your page has  from
TR> included pages as there may be blank lines following which are just as
TR> bad. So the rule is, header() can go anywhere but before any output to
TR> the browser.

TR> -- 
TR> regards,
TR> Tom

One other little rule: get into the habit of putting the full url in
location, it will save you grief down the line :)

To redirect to the same page for example

$url = "http://".$_SERVER["HTTP_HOST"].$_SERVER["PHP_SELF";];
header("Location: $url");


-- 
regards,
Tom

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php