function getLoginState($get, $default = false)
{
    global $login_url;
    $conf = $get['hash'];
    $s = $get['secret'];
    $id = $get['dblink'];
    $u = new UserFunctions();
    $userDetail = $u->validateUser($id, $conf, $s, true);
    $loginStatus = $userDetail['status'];
    try {
        unset($userDetail['userdata']['password']);
        unset($userDetail['userdata']['secret']);
        unset($userDetail['userdata']['pass_meta']);
        unset($userDetail['userdata']['secdata']);
        unset($userDetail['userdata']['emergency_code']);
        unset($userDetail['userdata']['auth_key']);
        unset($userDetail['userdata']['data']);
        unset($userDetail['userdata']['private_key']);
        unset($userDetail['userdata']['random_seed']);
        unset($userDetail['userdata']['special_1']);
        unset($userDetail['userdata']['special_2']);
        unset($userDetail['userdata']['app_key']);
        unset($userDetail['userdata']['phone_verified']);
        unset($userDetail['userdata']['last_ip']);
        unset($userDetail['source']);
        unset($userDetail['salt']);
        unset($userDetail['calc_conf']);
        unset($userDetail['basis_conf']);
        unset($userDetail['iv']);
    } catch (Exception $e) {
        # Do nothing, that unset just failed
        $userDetail = $e->getMessage();
    }
    $response = array('status' => $loginStatus, 'defaulted' => $default, 'login_url' => $login_url, 'detail' => $userDetail, "unrestricted" => $u->meetsRestrictionCriteria(), "has_alternate" => $u->hasAlternateEmail(), "email_allowed" => $u->emailIsAllowed(), "alternate_allowed" => $u->alternateIsAllowed(), "restriction_criteria" => $u->getRestrictionCriteria());
    if ($default) {
        $response["provided_arguments"] = $_REQUEST;
    }
    return $response;
}