PDA

View Full Version : php require includes



Epgs
October 10th, 2001, 18:14
ok i want a php to require a .inc file held on a remote server. now i have htaccessed these files. will it work. And can i get it to display the content or save the contents of the .inc file to my hard drive?

Beans
October 10th, 2001, 22:17
Won't work. require is just like calling/executing the page.

Epgs
October 11th, 2001, 19:06
well i know it can be done because when they are set on the webserver i can have php scripts on that webserver require them. Why can't i do it remotely. or is it anything within the server can request it?

Canuckkev
October 11th, 2001, 21:52
Is include any different? If this is possible over a different domain, just use that.

Beans
October 15th, 2001, 08:23
heoretically, your idea won't work. Why? Coz once you make an include or require call, you are actually getting out of the current script and executing another. So consider the example:

Hello blah blah <? include("file.inc"); ?> blah blah

You are actually getting out of the page and executing file.inc

Ig the file.inc is protected by .htaccess, it won't be accesible because once it is called using include, it would have to be executed. And once executed, it would invoke .htpasswd

Just figure the logic. If I kept a very important file in one of my directories and made an .htaccess file to protect the directory, and in one way or another, a hacker knows the exact path of my file... however, he does not know my password. He can then make a file that calls my file and wallah! He got it! Not so logical right? Even if the calling file and the called file is in the same server, security measures would be used for the called file.

Canuckkev
October 15th, 2001, 18:30
Ah...that makes sense. You can't execute files over different domains! That would be messed up security if you could.

keith
October 15th, 2001, 18:46
just put the files you're calling in a directory no one would figure out, like /d9fsadf60sd7f098sa/

they'd never know where the actual file is stored because the path is embedded in the coding, which doesn't show up in the html.

Beans
October 16th, 2001, 04:59
Originally posted by Canuckkev
Ah...that makes sense. You can't execute files over different domains! That would be messed up security if you could.

Actually, you can.. depending on the webhost. However, you cannot do it if the directory is protected by .htaccess.

My last post is also applicable for including files on the same domain.

Beans
October 16th, 2001, 05:00
Originally posted by keith
just put the files you're calling in a directory no one would figure out, like /d9fsadf60sd7f098sa/

they'd never know where the actual file is stored because the path is embedded in the coding, which doesn't show up in the html.

This is a good one...... you sly you..

Epgs
October 16th, 2001, 15:04
Originally posted by Beans
heoretically, your idea won't work. Why? Coz once you make an include or require call, you are actually getting out of the current script and executing another. So consider the example:

Hello blah blah <? include("file.inc"); ?> blah blah

You are actually getting out of the page and executing file.inc

Ig the file.inc is protected by .htaccess, it won't be accesible because once it is called using include, it would have to be executed. And once executed, it would invoke .htpasswd

Just figure the logic. If I kept a very important file in one of my directories and made an .htaccess file to protect the directory, and in one way or another, a hacker knows the exact path of my file... however, he does not know my password. He can then make a file that calls my file and wallah! He got it! Not so logical right? Even if the calling file and the called file is in the same server, security measures would be used for the called file.

ok that is what i thought. it is actually the exact answer i was looking for. the security an all.