|
Posted by Jerry Stuckle on 10/19/07 12:29
salonowiec wrote:
>
> Uzytkownik "Jean-Baptiste Nizet" <jnizet@gmail.com> napisal w wiadomosci
> news:1192794161.771509.304950@y27g2000pre.googlegroups.com...
>
>> If what you want to do is sending a gif, jpeg, pdf file or whatever
>> file to the browser and the browser displays it as it would if you had
>> clicked on a direct link to the file, then you must send the mime type
>> of the file in the HTTP response:
>>
>> header("Content-Type: image/gif");
>>
>> for a gif file, for example.
>>
>> With direct links, the web server does it automatically, but if you
>> want to do it in PHP, you have to do it yourself. Read the user
>> comments on http://www.php.net/readfile to see some examples.
>>
>> JB.
>>
> It's working good with this header function, it displays O. K. There is
> another question (I'm probably stubborn): the address line shows
> something like http://www.xxx/vvv/alpha.pdf. And this is my problem -
> can I "force" system (server, browser?) to keep showing
> http://......something.php ? The true reason for this is, that in my PHP
> script I put the code that redirects unlogged user to somewhere. But
> when you remember once only the address http://......./alpha.pdf you
> will reach it any time without logging. Sorry, I'm not sure if it's
> clear enough...
>
It is doing exactly what you asked. Use used the header() function to
redirect to a different page. The browser requested the new page and
displayed its url. If you redirect, that's how it works.
And even if the browser didn't display the URL your files would not be
secure. Security by obfustication is worse than no security - at least
with no security, you know you're insecure.
If you want to protect them from being downloaded, you need to either
use HTTP authentication or deliver the files in your script (with the
appropriate headers).
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Navigation:
[Reply to this message]
|