xhtml - Restrictions on PHP include() -
hey guys, separating xhtml php putting xhtml separate file , using php's include()
function within php script.
this works fine, however, users still able access .html
file directly if know address. can't it, rather not show.
i've seen scripts in past use form of referrer check, add basic (notice said 'basic') restrictions prevent being viewed accessing directly?
thanks!
clarification: forgot mention want within php, no web-server configuration (moving files out of document-root, configuring web-server disallow access, etc.). think logical choice here use define()
constant check, that's indeed i've seen in other scripts had forgotten, outlined in post. realize not best solution, given html file can access of no particular value, define()
constant should suffice. appreciate responses!
if place files (like index.php) in /something/public_html/
want move files /something/
. way users cannot access files.
the /public_html/
called document root. folder mapped example.com
, , and website starts there. if move files above website starts, no 1 can access files via browser.
as ignacio said, not work include
if safe mode turned on.
other methods place @ top of file thats says
if(!defined("running_script")) die("no direct access allowed");
and in php files put
define("running_script", true);
if running_script
not defined, means directly accessing it, , stops page loading. works though if php runs on .html
files.
you use .htaccess
file disallowed access folders.
Comments
Post a Comment