我可以使用超全局变量来验证 PHP 页面的用户吗?
我有一个问题希望你能帮忙解决。
我想知道是否有一种方法可以使用超级全局来验证 PHP 页面的用户身份?
我的情况如下:
- 所有用户都将从我们的工作网络访问我的页面,并已使用其 Windows 密码进行身份验证。
- 我无权访问这些密码,因此我无法要求他们使用它们进行身份验证。
- 我宁愿不要求用户记住另一个密码。
我希望该页面能够执行以下操作: - 说“嗨,Tev,欢迎来到您的门户”。 - 自动提取用户名,以便页面可以自动显示其统计信息/通话/票证
我认为 REMOTE_USER 能够做到这一点,但我的 apache 服务器(我是其管理员)似乎没有返回此信息。我需要更改 Apache 配置中的某些内容吗?
我浏览了很多 PHP 和 Apache 论坛,但没能找到答案。
代表请求者:
感谢您的回复,但我们可能无法连接到 LDAP Active Directory 服务器。
在 php.ini 中,我们设置 register_globals = On
当在我们的服务器上运行 print_r($GLOBALS)
时,在 [_SERVER] => 下数组
,缺少[REMOTE_USER]
。
[REMOTE_ADDR]
正常存在,但 [REMOTE_USER]
不存在。
有什么办法可以添加吗?
I have a problem that I'm hoping you can help with.
I'm wondering if there is a way to use superglobals to authenticate users for PHP pages?
Here's my situation:
- All users will be accessing my page(S) from our work network and have been authenticated using their Windows passwords.
- I don't have access to those passwords, so I can't ask them to authenticate using them.
- I'd rather not ask the users to remember another pw.
I want the page to be able to do things like:
- Say "Hi Tev, welcome to your portal".
- Automatically pull the username so the page can automatically display their stats/calls/tickets
I thought that REMOTE_USER would be able to do this, but my apache server (which I'm an admin for) doesn't seem to return this. Do I need to change something in my Apache configuration?
I've looked through a lot of PHP and Apache forums, but haven't been able to find an answer.
On behalf of requester:
Thanks for the responses, but we might not be able to connect to the LDAP Active directory Server.
In php.ini, we set register_globals = On
When running print_r($GLOBALS)
on our server, under [_SERVER] => Array
, [REMOTE_USER]
is missing.
[REMOTE_ADDR]
is present alright, but not [REMOTE_USER]
.
Is there any way to add it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您的用户在工作网络上经过身份验证,那么您需要连接到 LDAP/Active Directory 服务器。这个问题应该对您有帮助:
您可以获得 Windows (AD) PHP 中的用户名?
If your users are authenticated on your work network, then what you need is to connect to the LDAP / Active Directory server. This question should help you:
Can you get a Windows (AD) username in PHP?