Prevent direct access to a php include file

by Jayanthi 2014-08-05 10:42:38

Prevent direct access to a php include file

in .htaccess file
 
<Files yourinclde.php>
order allow,deny
deny from all
</Files>
in php file

add this code into include php file

<?php
if(!defined('restrict')) {
   die('Direct access not permitted');
   exit();
   // Redirect to 404 page
}
?>

include file using main page define restrict variable


<?php
define('restrict', TRUE);
?>
1264
like
0
dislike
0
mail
flag

You must LOGIN to add comments