此行位于模板和模块的顶部:defined('_JEXEC') or die('Restricted access');
来自Joomla! Documentation :
This statement checks to see if the file is being called from within a Joomla! session and it protects your site by making it more difficult for a cracker/hacker to damage your site.
_JEXEC
在 index.php
中定义Joomla 根目录中的文件!网站 [source] ,是什么阻止了某人定义 _JEXEC
在他们自己的网站上,包括我的模块,因为 defined('_JEXEC')
那么会返回true吗?
最佳答案
我猜如果黑客控制了您的站点,_JEXEC - 测试将没有任何功能。但只要有人只是试图破坏你的网站,代码就会确保他们不能直接在文件层次结构中执行文件,而总是必须通过/index.php 进入。
what stops someone from defining _JEXEC in their own site and including my module
这是不可能的。如果您尝试在另一个站点上包含一个 php 文件,那么将返回给您的只是生成的输出,而不是 php 代码本身,对吗?
关于乔纳斯
关于security - 定义的 ('_JEXEC' )或死 ('Restricted access' )如何工作?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22852355/