开发者

Error: Notice: Undefined index: SESSION_ADMIN_MEMBER_TYPE in

开发者 https://www.devze.com 2023-01-19 04:18 出处:网络
hi i\'m receiving this error Notice: Undefined index: SESSION_ADMIN_MEMBER_TYPE in ... how do I go about fixing this error?

hi i'm receiving this error Notice: Undefined index: SESSION_ADMIN_MEMBER_TYPE in ... how do I go about fixing this error?

if((isset($_GET['p']) && $_GET['p'] != 'docs'开发者_如何学运维) 
&& ( $_SESSION["SESSION_ADMIN_MEMBER_TYPE"] == 'normal' 
|| $_SESSION["SESSION_ADMIN_MEMBER_TYPE"] == 'restricted' 
|| $_SESSION["SESSION_ADMIN_MEMBER_TYPE"] == 'c_account' ) )


This means that SESSION_ADMIN_MEMBER_TYPE is not set (obviously). So you can add an additional check:

isset($_SESSION['SESSION_ADMIN_MEMBER_TYPE'])

to your conditional logic. Then you will suppress the notice and keep the same check. Make sure you are setting that session variable at the right time (and it is named correctly).

Note that this this notice is harmless. It is just to let you know that the key is not set.


THis is because you're checking the session variable before its set. So, add a check to see if its set first

if((isset($_GET['p']) && $_GET['p'] != 'docs' &&
isset($_SESSION["SESSION_ADMIN_MEMBER_TYPE"]))
&& ( $_SESSION["SESSION_ADMIN_MEMBER_TYPE"] == 'normal' 
|| $_SESSION["SESSION_ADMIN_MEMBER_TYPE"] == 'restricted' 
|| $_SESSION["SESSION_ADMIN_MEMBER_TYPE"] == 'c_account' ) )


if((isset($_GET['p']) && $_GET['p'] != 'docs') 
&& isset($_SESSION["SESSION_ADMIN_MEMBER_TYPE"]) && ( $_SESSION["SESSION_ADMIN_MEMBER_TYPE"] == 'normal' 
|| $_SESSION["SESSION_ADMIN_MEMBER_TYPE"] == 'restricted' 
|| $_SESSION["SESSION_ADMIN_MEMBER_TYPE"] == 'c_account' ) )

By checking if $_SESSION["SESSION_ADMIN_MEMBER_TYPE"] is set

0

精彩评论

暂无评论...
验证码 换一张
取 消