Jump to content

[SOLVED] security with includes


ohdang888

Recommended Posts

is it "safer" for my site to put the included files in a place that people can't reach them.

 

i'm not talkign about putting passwords in place to protect them, i'm saying something like this..

 

<?php include (".../menu.php")?>

 

so that the include is loacted in the same directory as htdocs?

Link to comment
https://forums.phpfreaks.com/topic/82548-solved-security-with-includes/
Share on other sites

depending on what is in the include file, you can place it outside the root folder.

 

 

so, if you want to access menu.php from index.php where index.php is in the root folder, you would do this:

 

<?php include ("../menu.php");?>

 

(exactly what you have, except you have an extra dot which I removed.)

 

That means, that this file can NEVER be accessed by ANYONE, unless they use the file index.php

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.