我有一个变量,它可能是组 id 的字符串或许多组 id 的数组。有没有办法缩短检查以查看它们是否属于一个组。
if(is_array($groups)){
/* Check for multiple groups */
$total = count($groups);
$hasperm = false;
while($total > 0){
/* If account has a bad status dont login */
switch($group[$total]){
case 4:
$errmsg_arr[] = array('type'=>'crucial','alert'=>'Alert!','msg'=>'Your account is not active, contact admin');
failedAttempt($errmsg_arr);
break;
case 6:
$errmsg_arr[] = array('type'=>'crucial','alert'=>'Alert!','msg'=>'Your account is banned, contact admin');
failedAttempt($errmsg_arr);
break;
case 5:
$errmsg_arr[] = array('type'=>'crucial','alert'=>'Alert!','msg'=>'Your account is scheduled for deletion, if you are reading this you may still have time to recover your account, Call 716-698-9236. $50 Reactivation fee required.');
failedAttempt($errmsg_arr);
break;
}
$total--;
}
}else{
/* If account has a bad status dont login */
switch($groups){
case 4:
$errmsg_arr[] = array('type'=>'crucial','alert'=>'Alert!','msg'=>'Your account is not active, contact admin');
failedAttempt($errmsg_arr);
break;
case 6:
$errmsg_arr[] = array('type'=>'crucial','alert'=>'Alert!','msg'=>'Your account is banned, contact admin');
failedAttempt($errmsg_arr);
break;
case 5:
$errmsg_arr[] = array('type'=>'crucial','alert'=>'Alert!','msg'=>'Your account is scheduled for deletion, if you are reading this you may still have time to recover your account, Call 716-698-9236. $50 Reactivation fee required.');
failedAttempt($errmsg_arr);
break;
}
}