WHMCS 8 - 除了登录名和密码选项外,强制登录所有页面

问题描述

我试图限制客户从门户(即支持、购物车等)访问,除非他们已经登录。所以基本上除了登录名和密码/2xauth 选项之外的所有内容。我有这个代码,但它实际上阻止了除登录之外的所有内容。因此客户端无法重置密码。是否可以更新此代码段以使其正常工作?有人可以帮我解决这个问题吗?

<?php
if (!defined("WHMCS"))
   die("This file cannot be accessed directly");
 
function hook_ForceEveryoneToLogin($vars) {
 
   $clientID = intval($_SESSION['uid']);
   $adminID = intval($_SESSION['adminid']);
   
   // Create the link for the incoming URL.
    $link = "https";
    $link .= "://"; 
    $link .= $_SERVER['HTTP_HOST']; 
    $link .= $_SERVER['REQUEST_URI'];
 
   if ($adminID===0){
       if (!in_array($vars['filename'],array("index")) && $clientID===0){
            // Check if the link is accurate.
            if($link != "https://mydomain/index.php?rp=/login"){
                header("Location: login.php");
                exit;
            }
       }
       else if($clientID===0){
           // Check if the link is accurate.
           if($link != "https://mydomain/index.php?rp=/login"){
                header("Location: login.php");
                exit;
            }
       }
   }
 
}
add_hook("ClientAreaPage",1,"hook_ForceEveryoneToLogin");

?>

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...