$ _ POST变量通过空来在IE7中一个子文件夹 [英] $_POST variables coming through empty in IE7 for one subfolder

查看:169
本文介绍了$ _ POST变量通过空来在IE7中一个子文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经具有$不是从形式收到了PHP网站内_POST变量的麻烦。

要澄清的问题,我创造了这个简单的PHP脚本POST_test.php

 &LT ;?
打印POST:其中,pre>中;
的print_r($ _ POST);
打印< / pre>中;
?>
<形式方法=POSTACTION =POST_test.php>
<输入类型=提交值=保存更改>
<输入类型=隐藏的名字=嗒嗒值=1>
< /表及GT;

比方说,我的Apache Web根目录是WEB_ROOT,而我的网站文件夹是websiteA。把上面的脚本中的WEB_ROOT / websiteA,并点击一个空$ _POST阵列在IE7结果的按钮。更改文件夹的名称为WEB_ROOT / websiteA2使其开始工作,它也能在网站根目录内的其他网站,如websiteB。有使用Firefox时,没有问题。近日,NTLM身份验证在我们的系统已启用 - 我不知道这是否会有所作为

阿帕奇&放大器;在服务器上运行PHP运行(有点老版),Debian的Linux操作系统。

我也尝试在网页在IE中,这没有帮助的CTRL刷新,并且也没有重新启动我的电脑。

更新::该论坛的帖子似乎说明问题:
http://lists.rubyonrails.org/pipermail/rails/2006-March /027283.html


  

      
  1. 您不能发布任何数据混合
      NTLM和非NTLM身份验证的Web
      网站。 Microsoft Internet Explorer中
      要求所有的NTLM身份验证
      访问一个网站,你以后参观
      1 NTLM身份验证的文件夹
      网站。

  2.   

我可以如下确认此行为:

当我访问 HTTP://mydomain/websiteA/index.php 随后的 HTTP://mydomain/websiteA/POST_test.php $ _ POST没有提交测试页填充

然而,关闭我所有的窗户IE7然后直接浏览到的http://mydomain/websiteA/POST_test.php 显示$ _ POST是提交测试页进行填充。

和似乎从上面的链接论坛上发帖建议的解决方案之一是:


  

我已经看到了让IE浏览器的唯一方式
  忘记它有previously
        NTLM身份验证的一个站点是发送401页的状态。这个
        有效地复位IE验证状态。



解决方案

感谢您的建议。

原来,这个问题是由previous请求,这使得使用NTLM身份验证的是这样的(或类似)不相关的页面所导致的:

 < PHP
  如果(!使用isset($头['授权'])){
    标题(HTTP / 1.1 401未经授权');
    标题(WWW验证:NTLM');
    出口;
  }
?>

这是身份验证已完成后,所有的$ _ POST数据到IE浏览器被关闭并重新打开收到的是空的。到目前为止,我已经围绕这一问题通过删除上述code和安排,而不是为Apache我们的局域网络中使用NTLM(它设置$ _ SERVER ['REMOTE_USER']变量)的工作。 (我们的内部网络之外,Apache的认证仍在使用)。

I've having trouble with $_POST variables not being received from forms within a PHP website.

To clarify the problem, I created this simple PHP script "POST_test.php":

<?
print "POST:<pre>";
print_r($_POST);
print "</pre>";
?>
<form method="POST" action="POST_test.php">
<input type="submit" value="Save Changes">
<input type="hidden" name="blah" value="1">
</form>

Let's say my Apache web root is folder "web_root", and my website folder is "websiteA". Putting the above script in "web_root/websiteA" and clicking the button in IE7 results in an empty $_POST array. Changing the name of the folder to "web_root/websiteA2" makes it start working, and it also works in other websites within the web root, such as "websiteB". There's no issue when using Firefox. Recently, NTLM authentication was enabled in our systems - I don't know whether this might make a difference.

Apache & PHP run on a server running (a somewhat old version of) Debian Linux.

I've also tried a ctrl-refresh of the page in IE, which didn't help, and neither did rebooting my PC.

Update: This forum post appears to describe the issue: http://lists.rubyonrails.org/pipermail/rails/2006-March/027283.html

  1. You cannot post any data to mixed NTLM and non-NTLM authenticated Web sites. Microsoft Internet Explorer requires NTLM authentication for all visits to a website after you visit one NTLM authenticated folder of the website.

I can confirm this behaviour as follows:

When I visit http://mydomain/websiteA/index.php then http://mydomain/websiteA/POST_test.php $_POST is not populated by submitting the test page.

However, closing all my IE7 windows then browsing straight to http://mydomain/websiteA/POST_test.php shows $_POST IS populated by submitting the test page.

And one of the suggested solutions from the above linked forum post appears to be:

The only way I have seen to get IE to "forget" it has previously NTLM-authenticated to a site is to send a 401 page status. This effectively resets the IE authentication state.

解决方案

Thanks for the suggestions.

It turned out that the problem was caused by a previous request to an unrelated page which made use of NTLM authentication like this (or similar):

<?php
  if (!isset($headers['Authorization'])){
    header('HTTP/1.1 401 Unauthorized');
    header('WWW-Authenticate: NTLM');
    exit;
  }
?>

After that authentication was done, all $_POST data was received empty until IE was closed and re-opened. So far, I've worked around the issue by removing the above code and instead arranging for Apache to use NTLM within our Intranet (which sets the $_SERVER['REMOTE_USER'] variable). (Outside of our intranet, Apache authentication is still used).

这篇关于$ _ POST变量通过空来在IE7中一个子文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆