I’m using this snippet of code to prevent manager pages from being accessed from the frontend:
<?php
if (realpath(__FILE__) == realpath($_SERVER['file_to_be_protected.php'])) {
exit('This file can not be accessed directly.');
}
if(IN_MANAGER_MODE!="true") die("Please use the MODx Manager.");
?>
While this works in one installation, it gives the following error in System Events:
Undefined index: file_to_be_protected.php
(Running: PHP Version 5.2.8)
In another installation when I insert it at the top of the page I get the following error on the page itself:
Error while inserting event log into database.
(Running: PHP Version 5.2.6)
...but no errors in the System Events log!