php - 退出 Windows 身份验证

标签 php mysql iis active-directory

在我的公司,我设计了一个用于内网库存的 php-mysql-jquery 网站。 Web 服务器 (iis8) 托管在连接到 Active Directory 的 Windows 8 计算机中。我需要为我的网站提供 AD 身份验证,为此我启用了 Windows 身份验证功能,以便在用户访问我的网站之前对用户进行身份验证。

该功能运行正常,用户现在可以登录!但我需要他们从网站注销。但我在互联网上找不到任何代码来做到这一点。我现在需要做的是,告诉用户重新启动浏览器并清除浏览器历史记录。有人知道这件事吗?有其他方法吗?

我尝试了这段代码

html><head>
<script type="text/javascript">
function logout() {
    var xmlhttp;
    if (window.XMLHttpRequest) {
          xmlhttp = new XMLHttpRequest();
    }
    // code for IE
    else if (window.ActiveXObject) {
      xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
    if (window.ActiveXObject) {
      // IE clear HTTP Authentication
      document.execCommand("ClearAuthenticationCache");
      window.location.href='/where/to/redirect';
    } else {
        xmlhttp.open("GET", '/path/that/will/return/200/OK', true, "logout", "logout");
        xmlhttp.send("");
        xmlhttp.onreadystatechange = function() {
            if (xmlhttp.readyState == 4) {window.location.href='/where/to/redirect';}
        }


    }


    return false;
}
</script>
</head>
<body>
<a href="#" onclick="logout();">Log out</a>
</body>
</html>

/path/that/will/return/200/OK 是什么?

最佳答案

如果我明白的话。

您是否在 $_SESSION 中存储变量以保持用户登录?

如果是,您可以创建一个注销文件并将 session 销毁。 如果您使用cookie,您需要清除注销文件中的cookie。

关于php - 退出 Windows 身份验证,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24833138/

相关文章:

asp.net - IIS 7.5 32 位应用程序池以 64 位启动

PHP插入大量值问题

循环中的Php动态变量名

php - 哪种编写 PDO 语句更好、更安全的方法?

silverlight - Silverlight 客户端和 WCF 服务之间的间歇性通信问题

asp.net - 在 IIS 服务器上运行的哪个进程为每个 asp.net 应用程序生成一个 w3wp.exe?

php - 如何使用 PHP 从字符串中删除前 n 个数字字符?

php - 如何根据表单提交的日期搜索记录

python - Django通配符查询

mysql - 使用 Limit 从 a 到 z 排序