使用PHP_AUTH_DIGEST进行pgp身份验证

时间:2018-06-19 05:07:54

标签: php apache digest-authentication

我使用以下代码创建受密码保护的内容

function check_user_cradentials($user_name = 'username', $password = 'userpassword'){

    $users = array( $user_name => $password );

    if (empty($_SERVER['PHP_AUTH_DIGEST'])) {
        header('HTTP/1.1 401 Unauthorized');
        header('WWW-Authenticate: Digest realm="'.$realm.
               '",qop="auth",nonce="'.uniqid().'",opaque="'.md5($realm).'"');

        die('Text to send if user hits Cancel button');
    }
}

当我试图访问页面时,我正在获取登录模式,但它一直在询问我的用户名和密码

我的服务器上激活了以下模块:

mod_auth_digest mod_authn_anon mod_authz_owner

0 个答案:

没有答案