PHP Define security issues? -
index.php:
define("included", true);
included pages:
if (included !== true) header('http/1.1 404 not found');
the purpose codes disallow access directly allow if included. not sure if opens risks. not allowed override .htaccess
stuck php alternative.
any appreciated!
a sexier way is...
defined('included') or exit;
that is, use correct function (defined()
) see if value defined, , exploit short circuit evaluation.
also, can use existing define rather create 1 specifically, e.g. bootstrap file may define like...
define('docroot', realpath(basename(__file__)));
...in case safe use docroot
.
you should keeping php files besides bootstrap above document root, , ensuring site safe directory traversal attacks :)
Comments
Post a Comment