Connecting Tech Pros Worldwide Forums | Help | Site Map

retrieve windows username in php

Johan den Boer
Guest
 
Posts: n/a
#1: Jul 17 '05
Hi,

I am new to php. Is it possible to find out the windows user name in php ?

Logon in windows domain with 'user1'. I want to get the username in php in
my example : user1.

How do you that ?

thanks



Randell D.
Guest
 
Posts: n/a
#2: Jul 17 '05

re: retrieve windows username in php



"Johan den Boer" <me@knoware.nl> wrote in message
news:vq3lg63h1gkk5c@corp.supernews.com...[color=blue]
> Hi,
>
> I am new to php. Is it possible to find out the windows user name in php ?
>
> Logon in windows domain with 'user1'. I want to get the username in php in
> my example : user1.
>
> How do you that ?
>
> thanks
>
>[/color]

Short answer = NO

Long answer: PHP is a server side language - it will read headers and form
data sent by the client browser, but it cannot request the data. I don't
believe Javascript has access to this information either but I believe
ActiveX or perhaps ASP *might* give you this information...

To get a rough idea of what information PHP does read from a client web
browser, write the following simple script in to a file and visit it with
your web browser

<?
phpinfo();
?>

Note: Different browsers deliver different headers so you cannot rely that
all the information you see in phpinfo() will be avialable every time...


Daniel Bengs
Guest
 
Posts: n/a
#3: Jul 17 '05

re: retrieve windows username in php


Johan den Boer wrote:
[color=blue]
> Hi,
>
> I am new to php. Is it possible to find out the windows user name in php ?
>
> Logon in windows domain with 'user1'. I want to get the username in php in
> my example : user1.
>
> How do you that ?[/color]

If you mean client-side then no, not with PHP. That kind of information
is not transmitted with the HTTP headers.

And I don't know what it would good for on the server-side, since it
would most probably be the same all the time.

Ian.H
Guest
 
Posts: n/a
#4: Jul 17 '05

re: retrieve windows username in php


On Fri, 31 Oct 2003 12:14:55 +0200, Daniel Bengs wrote:
[color=blue]
> And I don't know what it would good for on the server-side, since it would
> most probably be the same all the time.[/color]


Can't say I've tried, but I believe the info is in the manual about this
(with some pre-req's of some kind?), but as for how useful, I see your
point, if it's an Internet site.. but what if the OP is asking for info on
an Intranet? the windoze login could be as useful as perhaps, .htaccess /
..htpasswd authentication recognition. Not everyone is developing "public
Internet" sites (I obviously don't know for sure what the OPs targets are) =)



Regards,

Ian

--
Ian.H [Design & Development]
digiServ Network - Web solutions
www.digiserv.net | irc.digiserv.net | forum.digiserv.net
Programming, Web design, development & hosting.

Jon Kraft
Guest
 
Posts: n/a
#5: Jul 17 '05

re: retrieve windows username in php


Johan den Boer <me@knoware.nl> wrote:
[color=blue]
> I am new to php. Is it possible to find out the windows user name in php ?
>
> Logon in windows domain with 'user1'. I want to get the username in php in
> my example : user1.[/color]

Hi Johan,

If the web server is in the same domain, i.e. intranet, try echoing
$_SERVER['LOGON_USER'] and $_SERVER['AUTH_USER']. Might only work with IE
though.

A good start is generally having a phpinfo() running to check what headers &
information the browser sends to the server.

JOn
Kevin Thorpe
Guest
 
Posts: n/a
#6: Jul 17 '05

re: retrieve windows username in php


Johan den Boer wrote:[color=blue]
> Hi,
>
> I am new to php. Is it possible to find out the windows user name in php ?
>
> Logon in windows domain with 'user1'. I want to get the username in php in
> my example : user1.[/color]

To do this you need to add an extra module to Apache (assuming Apache
not IIS). This will do a lookup on the domain controller to work out who
the user is.

http://modntlm.sourceforge.net/

Alan Little
Guest
 
Posts: n/a
#7: Jul 17 '05

re: retrieve windows username in php


Carved in mystic runes upon the very living rock, the last words of
Johan den Boer of comp.lang.php make plain:
[color=blue]
> Logon in windows domain with 'user1'. I want to get the username in
> php in my example : user1.[/color]

You might have more success asking in a Windows and/or IIS forum, as to how
you can get the user name into the server environment.

--
Alan Little
Phorm PHP Form Processor
http://www.phorm.com/
Eto Demerzel
Guest
 
Posts: n/a
#8: Jul 17 '05

re: retrieve windows username in php


In article <T%mob.229825$pl3.105712@pd7tw3no>, Randell D.'s output was...[color=blue]
>
>
> Long answer: PHP is a server side language - it will read headers and form
> data sent by the client browser, but it cannot request the data. I don't
> believe Javascript has access to this information either but I believe
> ActiveX or perhaps ASP *might* give you this information...[/color]

Snip

Not sure if this is patched yet, but.......

http://www.insecure.org/sploits/NT.N...ntication.html

may be of some use to you. Plug in a sniffer and see what's happening...

Also, stepping away from PHP, and into some client-side scripting:

http://beta.experts-exchange.com/Web..._20717958.html

might help you out.
Closed Thread