Ejemplo n.º 1
0
 public static function is($group = false)
 {
     $email = infra_session_getEmail();
     if (!$email) {
         return false;
     }
     $verify = infra_session_getVerify();
     if (!$verify) {
         return false;
     }
     $conf = infra_config();
     infra_cache_no();
     if (!$group) {
         return true;
     }
     if (empty($conf['user'][$group])) {
         return false;
     }
     return in_array($email, $conf['user'][$group]);
 }
Ejemplo n.º 2
0
        return infra_err($ans, 'You are already logged in.');
    }
    if ($submit) {
        $email = trim(strip_tags($_POST['email']));
        if (!User::checkData($email, 'email')) {
            return infra_err($ans, 'You must specify a valid email address.');
        }
        $userData = infra_session_getUser($email);
        $password = trim($_POST['password']);
        if (md5($email . $password) != $userData['password']) {
            return infra_err($ans, 'Wrong password or email.');
        }
        infra_session_change($userData['session_id']);
        $ans['go'] = '?user';
        return infra_ret($ans, 'You are logged in.');
    }
}
if ($type == 'logout') {
    if (!$myemail) {
        return infra_err($ans, 'You are not logged in.');
    }
    if ($submit) {
        infra_session_logout();
        $ans['go'] = '?user';
        return infra_ret($ans, 'Your status guest.');
    }
}
if ($type == 'user') {
    $ans['verify'] = infra_session_getVerify();
}
return infra_ret($ans);