Re: [PHP] Re: force download in IE -- conclusion

2001-08-23 Thread Tim Frank

I have had success getting IE 5.5 for PC recognising the suggested 
filename by changing the content type to something other than 
application/octet-stream.  If it was left as that for IE 5.5(which the 
script snippet indicates) it would tend to take the filename of the 
script that executed it, or HTML file where the link to the script was 
located.

I have been using the forced download for txt and pdf files, dynamically 
generated with PHP of course, for about 2 years.  It is a pain in the ass 
to figure out the correct combinations for every different IE browser.  
Luckily it is a campus only system and the users are on PC or Linux.

Oh, and there is a bug if you try to force download in IE over an SSL 
connection WHEN USING SESSIONS.  I stumbled accross someone working on 
the SquirrelMail project who found a solution.  You just have to send 
these two extra headers to get IE force these downloads over SSL

if (ereg(MSIE, $HTTP_SERVER_VARS['HTTP_USER_AGENT'])) {
header('Pragma: ');
header('Cache-Control: cache');
}

That one had me stumped for 2 years and I had to bail out of the sessions 
and pass everything through the URL to force a download.

Hope that helps too.

Tim Frank

 Original Message 

On 22/08/01, 5:47:26 PM, [EMAIL PROTECTED] (Pierre-Yves) wrote regarding 
Re: [PHP] Re: force download in IE -- conclusion:


 I worked on a script like yours for a looong time now!

 I need to force the download of various type of file, doc, pdf, zip, even
 html!

 Your script works fine on Opera 5.02 and netscape 4.76 on my win NT 4.0 
box,
 but
 not on IE 5.5 On this one, it offers me to download the script file but
 instead of being
 a php file it has now an html extension !!

 Anyhow, I do have a download by email attachment button also, because I 
gave
 up on trying
 to find a script to force download

 py


 - Original Message -
 From: David Minor [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Wednesday, August 22, 2001 4:10 PM
 Subject: [PHP] Re: force download in IE -- conclusion


  I ran some tests of different header configurations of 6 browser/platform
  combinations to find out what worked and what didn't.  I didn't cover all
 of
  the platforms available, just those that my user-base uses, so this isn't
  complete.
 
  combinations tested was IE5.5, NN4, NN6 for Windows 98 and IE5.5, NN4.7
 for
  Mac 9.1.  I tested all of these browsers using/not using 'attachment' in
 the
  Content-Disposition header.  and also changed out the Content-Type header
  with 'application/octet-stream', 'application/download', and '*/*'.
 
  Here's the summary and what I did to make things work as well as 
possible.
  My goal is to prompt the user with a save-as dialog for an mp3 file.
 
  IE5.5 for Mac always uses the quicktime plugin to play the file no matter
  what the disposition or type is.  (also no matter what the file extension
  is.  Couldn't figure out how to trick it to download the file.)
 
  IE5.5 for Win98 would attempt to download the file if
 (content-disposition:
  attachment; filename=) attachment was there.
 
  All 3 of the Win98 browsers would do prompt with as few clicks as 
possible
  when content-type was application/octet-stream.  Therefore,  I test in
 my
  script for the Mac users and give them Content-type:
 application/downlaod
  while I give other users Content-Type: application/octet-stream.  Of
  course, this doesn't help the IE5.5 Mac users who still have to use
  Downlaod Link to Disk routine to get a save-as prompt.
 
  Anyone who sees different ways this could be done, please respond.
 
  Here's my code:
 
  if (eregi(mac,$HTTP_USER_AGENT))
 $type = application/download;
  else
 $type = application/octet-stream;
 
  // stream file to user
  header(Content-Type: $type);
  header(Content-Disposition: attachment; filename=$filename);
  header(Content-Length: .filesize($tmp_file));
  header(Content-Transfer-Encoding: binary);
  readfile($tmp_file);
 
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  To contact the list administrators, e-mail: [EMAIL PROTECTED]
 
 

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: force download in IE

2001-08-21 Thread Tim Frank

Some versions of IE will sniff the file to determine what type it is 
rather than taking your word for it that you REALLY want to download the 
file.  From my memory this is IE 4, and IE 5.5 where this is a problem.  
The way I dealt with this is to totally make up an application type that 
IE will not have a helper app for... such as new/type or whatever you 
want.  This should then trick IE into forcing a download.
The other trick I noted was that IE 5.5 doesn't like the attachement 
keyword in the Content-Disposition header.  Don't ask me why, all I know 
is that it won't pick up the supplied filename if you include it.
That is from my experiences in forcing download files and it seems to 
work out once you figure out every combination of what does/doesn't work 
for the various versions of IE.  Netscape is always fine, and I haven't 
tried any others extensively.

Fiddle with the various headers for the different IE browsers and you 
will get it to work.

Tim Frank

 Original Message 

On 20/08/01, 1:45:29 PM, [EMAIL PROTECTED] (David Minor) wrote regarding 
Re: force download in IE:


 on 8/20/01 12:07 PM, [EMAIL PROTECTED] wrote:

 This gave the same result:  it launches the helper app.

 Please help!!

 Regards.
 dm

  Have you tried this?
 
  header(Content-Type: application/x-octet-stream);
  header(Content-Description: MP3 file);
 
  David Minor wrote:
 
  Can anybody tell me why this doesn't work in IE?  I need to force 
download
  mp3 files instead of IE5.5 trying to apply a helper app.  This code 
works
  fine for NN.
 
  // detect for MSIE bug
  if (strstr($HTTP_USER_AGENT, MSIE))
  $attachment = ;
  else
  $attachment =  attachment;;
 
  // stream file to user
  header(Content-Type: application/octet-stream);
  header(Content-Disposition:$attachment filename=$filename);
  header(Content-Length: .filesize($tmp_file));
  header(Content-Transfer-Encoding: binary);
  readfile($tmp_file);

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: Export to Excel

2001-07-13 Thread Tim Frank

Jorge,

I pieced together a way to do this from other suggestions I found on the 
mailing list and elsewhere. This is more of a trick to get Excel to think 
it has an Excel file, but it doesn't truly generate an Excel file.
Thanks to Excel versions 97 and up (don't recall 95) having nice little 
HTML import abilities we can trick it into loading a plain old HTML table 
and treating it as an Excel file.  Here is how you do it.

The following headers will let you throw the file for download so the 
client can save it to their computer.  Just name it with .xls and then 
when they try to open it Excel will automatically convert it from HTML.  
You can change this to inline if you want IE to display it in the 
browser.

header(Content-Type: application/vnd.ms-excel; name='excel');
header(Content-Disposition: attachment; filename=filename.xls);

Now, as far as the data goes, it's simple, just make your run of the mill 
HTML table.  The usual for loop for database records will do, and you 
will just end up with something like this

table
tr
tdColumn with Text/td
tdColumn with Numbers/td
tdColumn with Numbers/Text with leading zeros/td
/tr
tr
tdI am text/td
td1,500.00/td
td=0012/td
/tr
/table

When Excel loads that it will make a 3 column sheet and fill in the data. 
 Any cells you want to keep with leading zerios you use =0012 in the 
HTML table as the data.  Otherwise the column will be treated as numeric 
when it is loaded.  Text stays as text.

There are some tricks as well where you can store forumlas in the actual 
HTML table cells so when the sheet is loaded it would calculate the sum, 
avg, whatever of the columns or sheet.  I don't recall how to do that off 
the top of my head but I think you just plugged in regular formulae into 
the HTML table cells. Try it if you need it.

From there the user might have to set some data types for some columns as 
I don't think they can be set. You might want to check some of the help 
on MS Excel 2K or XP as I'm very sure the HTML capabilities are much more 
advanced than with 97 which we still use.

I hope that helps everyone out a little.  There are limitations with this 
method, but to just get a file that someone can safely open in Excel, it 
is a very convenient way to do it rather than having to muck around with 
binary files.

Have a good weekend,

Tim Frank


 Original Message 

On 7/13/01, 12:58:18 PM, [EMAIL PROTECTED] (Jorge Alvarez) wrote 
regarding Export to Excel:


 One of my clients is requesting me to export some data from PHP-generated
 pages to MS Excel files. I have no clue on how to do such export with 
PHP.
 I'm using PHP/Apache/Linux Mandrake.

 What options do I have?

 Your help is very appreciated.

 Regards,

 Jorge Alvarez
 --
 Let your screen saver contribute to cancer research.
 http://members.ud.com/vypc/cancer/
 A new way to help. Sponsored by Intel.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] mail() implementation problem

2001-03-16 Thread Tim Frank

Mathieu,

I believe the feature you are looking for has been made available in the 
new PHP 4.0.5 that is upcoming.  They have added a 5th paramether to the 
mail() function so you can actually pass sendmail command line arguments 
such as -f.  For those of us not running the development version, someone 
was kind enough to post a really good work around that isn't hard and 
gives the same functionality.  I won't post it here, but it can be found 
as the last of the user comments at 
http://www.php.net/manual/en/function.mail.php dated March 9th at 5:02 
am.  I implemented this on my servers and it works great.  You do have to 
add the one line to the scripts that use the mail function, but that is 
really it after sendmail is configured.
Hope that was what you were looking for.

Tim Frank

 Original Message 

On 16/03/01, 5:05:13 AM, [EMAIL PROTECTED] (Mathieu Arnold) wrote 
regarding Re: [PHP] mail() implementation problem:


 Manuel Lemos wrote:
 
  Hello,
 
  Mathieu Arnold wrote:
  
   Hi
  
   The actual implementation of the mail fonction use sendmail -t and
   relies on sendmail to parse the headers to get the recipients.
   It would be great if it was possible to switch from this way of using
   sendmail to a more classic
   sendmail -f sender rcpt
   it should be quite easy, but I lack time to do it.
 
  You may want to try this PHP MIME message composing and sending class
  that has subclasses for sending messages using directly sendmail, qmail
  or even a SMTP server.
 
  http://phpclasses.UpperDesign.com/browse.html/package/9

 looks nice, but I'm not going to ask all my clients to change their php
 scripts ;)
 I just need to change the way php calls sendmail :)
 I believe I'm going to do it myself next week or so.

 --
 Mathieu Arnold

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Creative solution with XML,PHP,MYSQL

2001-02-17 Thread Tim Frank

Siim,

You can do this with a combination of XML and XSL. I remember a demo 
from Microsoft's XML area that did exactly what you ask: Click a column 
and have it sort. I believe it was an example having to do with Stock 
listings. Basically XSL lets you use come programming/looping constructs 
when displaying data from an XML file. The downside is that it currently 
only works with IE 5 and greater. It might not be the best overall 
solution, but if you are looking at the issue from a "can it be done" 
point of view, then yes, it can actually be done. It just might not be 
usable.

Tim Frank

 Original Message 

On 17/02/01, 9:23:00 AM, [EMAIL PROTECTED] (Siim Einfeldt aka Itpunk) 
wrote regarding [PHP] Creative solution with XML,PHP,MYSQL:


 Hi everybody,

 I want to implement ordering something on a website without refreshing 
the
 page. Lets say i have four columns in the html table - name,age,skill and
 phone. All these are links - under these are the information, eg:
 Name Age Skill Phone
 Siim 23  php   051...
 Tony 18  html  132...

 Now, when i click on the name, it should order the listings by name, if I
 click on the age, I get the listing ordered by age and etc,etc. Generally
 it is easy to do it, but how to do it without refreshing the page every
 time I want to order by something else?

 It should be possible with XML; I get the data from mysql database with
 php, I write it into an array and ... now how could I make it function 
the
 way I just described? Could someone point me some already written code or
 explain me in detail how to do it?


 Thank you,
 Siim Einfeldt

 PS: Sorry about sending this message to so many lists, but I haven`t seen
 this kind of code anywhere, but at the same time I know it is possible.


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] .php3 in PHP4?

2001-02-17 Thread Tim Frank

Or you could just put them all on one line like

AddType application/x-httpd-php .php .php3 .php4 .phtml

if you prefer.

Tim Frank

 Original Message 

On 17/02/01, 10:48:18 AM, [EMAIL PROTECTED] ("Ifrim Sorin") wrote regarding 
Re: [PHP] .php3 in PHP4?:


 Hello,

 I think this is rather a Web server issue.
 In Apache, just add in your conf file a line for each extension :

 AddType application/x-httpd-php .php3
 AddType application/x-httpd-php .php
 AddType application/x-httpd-php .php4
 AddType application/x-httpd-php .phtml

 HTH
 Sorin Ifrim

 - Original Message -
 From: Jeff Gannaway [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Saturday, February 17, 2001 12:39 PM
 Subject: [PHP] .php3 in PHP4?


  Can I configure PHP4 for to process .php .php4 .php3 and .phtml ??
 
  I'm a first timer to configuring the PHP engine, so a few detials on how
 to
  would be appreciated as well.
 
  Thanks,
  Jeff Gannaway
  ___
 
   2001 Wall Calendars
 * Art, Jazz, Blues, Women's, African-American.
 * Everyday Discounts.
 * Excellent paper and reproductions.
 
   And as always, a great selection of abstract,
   contemporary and African-American art prints.
 
   PopStreet.com is your avenue to art.
   http://www.popstreet.com
  ___
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  To contact the list administrators, e-mail: [EMAIL PROTECTED]
 


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] FDF Toolkit uncompression error

2001-02-09 Thread Tim Frank tfrank

Kurt,

I fought with this same problem for about an hour today.  For me there 
was something changed when the file was downloaded that made it 
corrupt... I think it was a LF to a CR + LF or something.  I tried Dling 
the file with Lynx on a linux machine and it was still corrupt.  My fix 
was to DL the file on a windows machine and then FTP the file to my unix 
box in ASCII mode (NOT BINARY).  I don't know why or what was causing the 
problem, but that is how I fixed it.

Now I'm trying to install it ;)

Hope that helps

Tim Frank

 Original Message 

On 05/02/01, 8:10:18 AM, [EMAIL PROTECTED] ("Kurt R. Hoehn") wrote 
regarding [PHP] FDF Toolkit uncompression error:


 Hello,

 I've downloaded the FDF toolkit from adobe (fdftk4_05_C.tar.Z) and it
 doesn't uncompress.  I've noticed that other people are using it.  Has
 anyone else experianced this same problem and if so what was your work
 around.

 Thank You
 Kurt







 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]