2011-12-12 06:29
浏览 62


Try the following URL: https://cms1.gre.ac.uk/collaborativeprogrammes/student/index.asp

It brings up an authentication prompt with username and password which is separate from the accounts on their site; groups of users have the same username and password to gain entry, however once inside, you log in with you own username and password.

How could I implement this? i.e. the first authentication prompt only.

图片转代码服务由CSDN问答提供 功能建议

请尝试以下网址: https://cms1.gre.ac.uk/collaborativeprogrammes/student/index.asp

它会带来一个 用户名和密码的身份验证提示,与其网站上的帐户分开; 用户组具有相同的用户名和密码以获得输入,但是一旦进入,您就可以使用自己的用户名和密码登录。

我如何实现此功能? 即仅第一个身份验证提示。

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

3条回答 默认 最新

  • dtnbjjq51949 2011-12-12 06:32

    If you're hosting on windows then turn on windows authentication in IIS. Your users would need their Active Directory credentials to log on.


    You can read this article on HTTP Authentication in PHP

    点赞 打赏 评论
  • douyue1481 2011-12-12 06:34

    Although this is an asp page, you can do this in php with .htaccess file

    See this article: http://www.addedbytes.com/lab/password-protect-a-directory-with-htaccess/

    点赞 打赏 评论
  • dqq48152418 2011-12-12 06:35

    See http://php.net/manual/en/features.http-auth.php

    if (!isset($_SERVER['PHP_AUTH_USER'])) {
        header('WWW-Authenticate: Basic realm="My Realm"');
        header('HTTP/1.0 401 Unauthorized');
        echo 'Text to send if user hits Cancel button';
    } else {
        echo "<p>Hello {$_SERVER['PHP_AUTH_USER']}.</p>";
        echo "<p>You entered {$_SERVER['PHP_AUTH_PW']} as your password.</p>";
    点赞 打赏 评论

相关推荐 更多相似问题