Re: Protecting include files
| From: | Daniel Page | Date: | Fri, 07 Feb 2003 20:23:42 +0000 |
| Subject: | Re: Protecting include files | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-134784@lists.php.net to get a copy of this message | ||
If someone wants to call your .inc file like http://www.my.site/lib.inc
they will see the code, as it is a text file. OK, we all know that.
As the .inc file is in reality a renamed php script, containing variables,
functions, etc, if you call it .php instead of .inc, it will be parsed by
PHP, but as you have no output (echo or print() ), you will just see a blank
page.
To illustrate better, I use a large (20k) PHP library on my site. It was
called stdlib.inc, but because of the problem listing .inc files, I renamed
it stdlib.php. If you want to test, look here. You should only see a blank
page, and not 1200 lines of code!
http://www.dlpage.com/lib/stdlib.php
Cheers,
Daniel
"Sid" <cyco_sid@phreaker.net> a écrit dans le message news:
5.0.2.1.2.20000814075725.009f3790@pop.phreaker.net...
> Hi,
>
> I have a php script which includes .inc files. Is there any way in which I
> can prevent a normal surferfrom viewing these files. Is there any command
> that I can add to a .htaccess file.
>
> Thanks
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~ \\\\\\__________________________________
> ! SIDDHARTH HEGDE / CHAOSGAMERZ.COM !
> ! Webmaster \____ For PC Game screeshots, cheat !
> ! http://www.ChaosGamerz.COM o| o codes, trainers,
> downloads, !
> ! webmaster@chaosgamerz.com( |_ game music, FREE e-mail and even !
> ! ICQ 84475206 |-- FREE FULL VERSION games for that !
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ \___/ 486------------------------------
>