Can I use superglobals to authenticate users of a PHP page?
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_USE开发者_如何学JAVAR]
.
Is there any way to add it?
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?
精彩评论