Re: [PHP] Problems downloading a PDF / Partially solved

2007-04-04 Thread Richard Davey
Mário Gamito wrote: I don't get the warnings anymore, but the PDF is still being displayed with its binary code inside in the PHP page: Are you opening the file as a binary file? Cheers, Rich -- Zend Certified Engineer http://www.corephp.co.uk "Never trust a computer you can't throw out of

Re: [PHP] Problems downloading a PDF

2007-04-04 Thread Richard Davey
Jochem Maas wrote: fine. so exactly what is the 100% bullitproof validation that will catch every attack attempt? other than basename()ing the input and suffixing it to the relevant path and then checking that to see if the file exists?? It depends how you want to handle invalid data. If you'r

Re: [PHP] Problems downloading a PDF / Partially solved

2007-04-04 Thread Jochem Maas
Mário Gamito wrote: > Ok, > > I don't get the warnings anymore, but the PDF is still being displayed > with its binary code inside in the PHP page: > > "%PDF-1.4 %âãÏÓ 351 0 obj <> endobj xref 351 434 16 0 n > 010281 0 n 010417 0 n 010574 0 n 010607 > 0

Re: [PHP] Problems downloading a PDF

2007-04-04 Thread Jochem Maas
Mário Gamito wrote: > Hi, > >> by reading the freaking replies that you get?!? :-), I did give you >> the answer to this in the rewritten code I offered. (granted > You the code you gave me i get I didn't write 120+ liones of code - so what your running is definitely not what I gave you. .. >

Re: [PHP] Problems downloading a PDF / Partially solved

2007-04-04 Thread Mário Gamito
Ok, I don't get the warnings anymore, but the PDF is still being displayed with its binary code inside in the PHP page: "%PDF-1.4 %âãÏÓ 351 0 obj <> endobj xref 351 434 16 0 n 010281 0 n 010417 0 n 010574 0 n 010607 0 n 012850 0 n 01288

Re: [PHP] Problems downloading a PDF

2007-04-04 Thread Mário Gamito
Hi, by reading the freaking replies that you get?!? :-), I did give you the answer to this in the rewritten code I offered. (granted You the code you gave me i get "Warning: Cannot modify header information - headers already sent by (output started at /var/www/telbit_website/2/products-testud

Re: [PHP] Problems downloading a PDF

2007-04-04 Thread Zoltán Németh
2007. 04. 4, szerda keltezéssel 14.23-kor Mário Gamito ezt írta: > Hi, > > > that's what I said before. you echo out some html before the file > > headers. that will never work. > > remove the echo statement on line 14 and you should be okay > But i need the line > > echo " " rel=\"ex

Re: [PHP] Problems downloading a PDF

2007-04-04 Thread Jochem Maas
Mário Gamito wrote: > Hi, > >> that's what I said before. you echo out some html before the file >> headers. that will never work. >> remove the echo statement on line 14 and you should be okay > But i need the line > > echo "" rel=\"external\">Download TESTUDIO flyer"; > > to displa

Re: [PHP] Problems downloading a PDF

2007-04-04 Thread Jochem Maas
Richard Davey wrote: > Jochem Maas wrote: > >>> You don't need to basename() it, you already know what the filename is, >>> because it was requested via $_GET['file']. >> >> I would say almost the opposite: > > Let me rephrase: if you are properly validating the $_GET['file'] input > anyway, base

Re: [PHP] Problems downloading a PDF

2007-04-04 Thread Mário Gamito
Hi, that's what I said before. you echo out some html before the file headers. that will never work. remove the echo statement on line 14 and you should be okay But i need the line echo " " rel=\"external\">Download TESTUDIO flyer"; to display the link for download!!! How can i so

Re: [PHP] Problems downloading a PDF

2007-04-04 Thread Zoltán Németh
2007. 04. 4, szerda keltezéssel 14.04-kor Mário Gamito ezt írta: > Hi, > > Ok, i've hardcoded the filename and i no longer get a 404 error. > But the "PDF" file i get is this: > > "Warning: Cannot modify header information - headers already sent by > (output started at /var/www/telbit_website/2/

Re: [PHP] Problems downloading a PDF

2007-04-04 Thread Mário Gamito
Hi, Ok, i've hardcoded the filename and i no longer get a 404 error. But the "PDF" file i get is this: "Warning: Cannot modify header information - headers already sent by (output started at /var/www/telbit_website/2/products-testudio.php:14) in /var/www/telbit_website/2/products-testudio.php

Re: [PHP] Problems downloading a PDF

2007-04-04 Thread Mário Gamito
Hi, Thank you all for your answers. I would say almost the opposite: I get a Page Not found. The problem is that $file variable is empty (tested with a print). Any ideas ? Warm Regards -- :wq! Mário Gamito -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.p

Re: [PHP] Problems downloading a PDF

2007-04-04 Thread Richard Davey
Jochem Maas wrote: You don't need to basename() it, you already know what the filename is, because it was requested via $_GET['file']. I would say almost the opposite: Let me rephrase: if you are properly validating the $_GET['file'] input anyway, basenaming it is a superfluous step that ma

Re: [PHP] Problems downloading a PDF

2007-04-04 Thread Jochem Maas
Richard Davey wrote: > Mário Gamito wrote: > >> To prevent people to insert the full URL to the documents, i moved >> them outside Apache's DocumentRooot, which is /var/www. >> >> My site is in /var/www/telbit and i put the PDFs in /var/www >> >> I've coded in order to do the trick, but it's faili

Re: [PHP] Problems downloading a PDF

2007-04-04 Thread Richard Davey
Mário Gamito wrote: To prevent people to insert the full URL to the documents, i moved them outside Apache's DocumentRooot, which is /var/www. My site is in /var/www/telbit and i put the PDFs in /var/www I've coded in order to do the trick, but it's failing. I can't get the name of the file.

Re: [PHP] Problems downloading a PDF

2007-04-04 Thread Zoltán Németh
2007. 04. 4, szerda keltezéssel 12.46-kor Mário Gamito ezt írta: > Hi, > > I'm building this site that has several PDFs to download, but only to > registered users. > > To prevent people to insert the full URL to the documents, i moved them > outside Apache's DocumentRooot, which is /var/www. >

RE: [PHP] Problems downloading a PDF

2007-04-04 Thread Peter Lauri
> -Original Message- > From: Mário Gamito [mailto:[EMAIL PROTECTED] > Sent: Wednesday, April 04, 2007 1:46 PM > To: php-general@lists.php.net > Subject: [PHP] Problems downloading a PDF > > Hi, > > I'm building this site that has several PDFs to download, but only to > registered users.