Page 1 of 1
passing username entered on Login Windows onto php page
Posted: Mon Oct 09, 2006 3:07 am
by ansa
Hi,
I was wondering if it is possible to get the username entered from a windows login. What I mean with windows login is an automatic pop-up login from the browser, when someone tries to access a certain folder.
What I would like to do is, to pass(or get) the username entered on this login window onto a php page, so I can manipulate the navigation depending on who has logged in.
I hope you guys can understand what I'm trying to do...
Posted: Mon Oct 09, 2006 3:21 am
by chakhar86
Try looking in PHP manual about server variables
$_SERVER[];
Posted: Mon Oct 09, 2006 3:27 am
by ansa
I already thought of $_SERVER[], but I don't know what the variable name is for the user name. The thing is, I have to continue someone else's work. Is there a way to find out what the variable name is, or perhaps is it a fixed (reserved) variable name?
Posted: Mon Oct 09, 2006 3:33 am
by s.dot
Posted: Mon Oct 09, 2006 3:53 am
by chakhar86
I searched and found $_SERVER['PHP_AUTH_USER'], but i'm not so sure about it. Because it says that it'll provide you with username when you use http login authentification...
I found $_ENV variable though, it can retreive the shell (OS) environment vars, I think this is more like it.
But I don't know to use it
Posted: Mon Oct 09, 2006 4:56 am
by volka
chakhar86 wrote:I searched and found $_SERVER['PHP_AUTH_USER'], but i'm not so sure about it. Because it says that it'll provide you with username when you use http login authentification...
Yes, but if not configured otherwise the Internet Explorer trys a ntml authentication with the current user's credentials - without confirmation of the user

There's no other way the webserver can automagically identifiy the windows logon user.
chakhar86 wrote:I found $_ENV variable though, it can retreive the shell (OS) environment vars, I think this is more like it.
The enviroment variables of the machine php is running on - the server, not the client.
Posted: Mon Oct 09, 2006 7:04 am
by ansa
Yes, I have found out that PHP_AUTH_USER is the right variable name, have tested it and worked the way I wanted it.
Thanks.
I don't know any other or better solution for this. I could use $_SESSION, but that would mean I had to modify all the pages with session_start() and all.
Posted: Mon Oct 09, 2006 7:06 am
by volka