You are here: Re: protect php file « PHP Language « IT news, forums, messages
Re: protect php file

Posted by My Pet Programmer on 12/20/07 09:10

You could put this in the top of the two.php and three.php, as well:

if (!basename(__FILE__) == "one.php") {
Throw new Exceotion ("Get the hell out of here!");
exit();
}

A bit of a hack, but if you can't get it into a non-web directory, then
you VERY likely should never, ever touch .htaccess

~A!


Gufo Rosso took the time to say:
> artev ha scritto:
>> example that I want to do:
>> if I have this 3 files
>> MYSITE.com/index.php
>> MYSITE.com/one.php
>> MYSITE.com/two.php
>>
>> I want that file two.php and file three.php aren't never accesible by url;
>> I think that is necessary some row in htaccess; not sure if is this
>> solution; or is necessary change file's CHMD ?
>>
>> ------------------------------------------------------------------------------------------------
>> other similar
>> MYSITE.com/index.php
>> MYSITE.com/A/B/one.php
>> MYSITE.com/A/C/X/other.php
>>
>> is possible write in htaccess a code that if one write
>> MYSITE.com/A/B/one.php or MYSITE.com/A/C/X/other.php
>> is redirect always at index or see an error in the page?
>>
>> -------------------------------------------------------------------------
>> other:
>> for a directory which is the code for protect all the file excluse the
>> index files ?
>
> any.php
> <?
> if(empty($pippo)){
> exit;
>
> .....
>
> index.php
> <?
> $pippo = "ciao";
> include(other.php)..
>
>
>
>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация