What function? - PHP
This is a discussion on What function? - PHP ; After hard work and many attempts I found this:
<?php
/* logging test coming at this line */
header("Content-Type: application/pdf");
$fname='not1.pdf';
readfile($fname);
?>
This is quite enough for me, the address keeps being ........./*.php so for
unlogged user the site ...
-
Re: What function?
After hard work and many attempts I found this:
<?php
/* logging test coming at this line */
header("Content-Type: application/pdf");
$fname='not1.pdf';
readfile($fname);
?>
This is quite enough for me, the address keeps being ........./*.php so for
unlogged user the site will not be accessible.
Many thanks...
Uzytkownik "Jerry Stuckle" <jstucklex@attglobal.net> napisal w wiadomosci
news:NdudnTsk4tCnNIXanZ2dnUVZ_r7inZ2d@comcast.com...
> salonowiec wrote:
>>
>> Uzytkownik "Jerry Stuckle" <jstucklex@attglobal.net> napisal w wiadomosci
>> news:Zb-dnQ0AD6ulPoXanZ2dnUVZ_vShnZ2d@comcast.com...
>>> If you want to protect them from being downloaded, you need to either
>>> use HTTP authentication
>>
>> ...this I'd like to avoid...
>>
>>> or deliver the files in your script (with the appropriate headers).
>>>
>> Could you, please, give a sample of such a hader?
>>
>
> RTFM.
>
> http://us2.php.net/manual/en/function.header.php
>
> --
> ==================
> Remove the "x" from my email address
> Jerry Stuckle
> JDS Computer Training Corp.
> jstucklex@attglobal.net
> ==================
>
-
Re: What function?
On Fri, 19 Oct 2007 08:55:56 -0400, Jerry Stuckle wrote:
> Henri wrote:
>> On Fri, 19 Oct 2007 14:06:48 +0200, 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...
>>
>> you can use sessions to check if the user is authorized (eg logged in
>> or whatever) to view the content. Just to this check before actually
>> displaying any content.
>>
>>
> Not if the user is directly accessing a non-php file, i.e. a pdf.
well, then what about an htaccess?
-
Re: What function?
Henri wrote:
> On Fri, 19 Oct 2007 08:55:56 -0400, Jerry Stuckle wrote:
>
>> Henri wrote:
>>> On Fri, 19 Oct 2007 14:06:48 +0200, 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...
>>> you can use sessions to check if the user is authorized (eg logged in
>>> or whatever) to view the content. Just to this check before actually
>>> displaying any content.
>>>
>>>
>> Not if the user is directly accessing a non-php file, i.e. a pdf.
>
> well, then what about an htaccess?
>
For authentication it still uses HTTP authentication.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================