In PHP often see the following code if (!defined (' in_ecs ')) {die (' Hacking attempt '); The reasons and principles of the implementation are as follows: There are some in Ecshop. PHP pages are not required to be accessed directly by the user via a URL, such as/includes/init.php, which does not require direct access and accesses your URL through the URLs/includes/ Init.php is meaningless, so we add define (' In_ecs ', true) to the PHP that can be directly asked, such as the following code in index.php, set in_ at the beginning The value of ECS is true before it is loaded init.php so the value of in_ecs in the init.php file is true, the introduction of cls_mysql.php can also be introduced, because the value of in_ecs at this time is also true define (' In_ecs ' , true); Require (DirName (__file__). '/includes/init.php '); This results in direct access to the page with the IF (!defined (' in_ecs ')) {die (' Hacking attempt ') in PHP that cannot be accessed directly;} In this way, the direct access to the init.php will not hacking attempt from the page to the purpose of forbidden access, and other pages in the call init.php is normal to do this is also a design idea to prevent other files from not calling or prevent the foreground directly access files.
The implementation principle of defined (' In_ecs ') in Ecshop