Reply to Re: Is a .php file protected from inclusion in outside domains?

Your name:

Reply:


Posted by Jonathan N. Little on 12/04/05 01:44

NC wrote:
> nc wrote:
>
>>If www.any1.com has a lib\file1.php, can someone at
>>www.any2.com include the script
>
>
> Yes.
>
>
>>and access the items in the script?
>
>
> No.
>
The above it true, but your can also stop them from accessing the
'output' for the script as well. Set a special constant in your calling
PHP scripts and have the included script check for the constant to
insure it is an 'authorized' include.

Calling PHP:

<?php
define("THE_MAGIC_WORDS", TRUE); //Your special constant
require_once("myincludes/included.php');
//the rest of your script here
...

In the included PHP:
<?php
if(!defined("THE_MAGIC_WORDS")){
die("Tisk-tisk! Do you have my permission to use this file?");
}
//the rest of your script here
...

If the server is set up correctly they should never be able to see your
actual code, just the output.


--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com

[Back to original 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

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