文件为include/func.inc.php
cp include/func.inc.php include/func.inc.php_$(date ‘+%Y%m%d%H%M‘)
vi include/func.inc.php
在适合的地方加入获取当前页面完整URL地址,如在function access_deny($mode = ACCESS_DENY_OBJECT) {前加入:
function get_url() {
$sys_protocal = isset($_SERVER[‘SERVER_PORT‘]) && $_SERVER[‘SERVER_PORT‘] == ‘443‘ ? ‘https://‘ : ‘http://‘;
$php_self = $_SERVER[‘PHP_SELF‘] ? $_SERVER[‘PHP_SELF‘] : $_SERVER[‘SCRIPT_NAME‘];
$path_info = isset($_SERVER[‘PATH_INFO‘]) ? $_SERVER[‘PATH_INFO‘] : ‘‘;
$relate_url = isset($_SERVER[‘REQUEST_URI‘]) ? $_SERVER[‘REQUEST_URI‘] : $php_self.(isset($_SERVER[‘QUERY_STRING‘]) ? ‘?‘.$_SERVER[‘QUERY_STRING‘] : $path_info);
return $sys_protocal.(isset($_SERVER[‘HTTP_HOST‘]) ? $_SERVER[‘HTTP_HOST‘] : ‘‘).$relate_url;
}
修改为
1692 else {
1693 $data = [
1694 ‘header‘ => _(‘你还没有登录,无权限查看该网页。‘),
1695 ‘messages‘ => [
1696 _(‘你必须登录系统后才能查看该网页。‘),
1697 _(‘如果需要开通权限或者其它问题,请联系管理员(邮箱[email protected]),多谢。‘),
1698 _(‘你访问的链接为:‘),
1699 (get_url())
1700 ],
效果图:
加上404网页:
404.php内容如下:
[[email protected] html]# cat 404.php
<?php
define(‘ZBX_PAGE_NO_AUTHORIZATION‘, true);
require_once dirname(__FILE__).‘/include/config.inc.php‘;
access_deny(ACCESS_DENY_PAGE);
?>
效果图如下: