Connecting Tech Pros Worldwide Help | Site Map

retrieve windows username in php

 
LinkBack Thread Tools Search this Thread
  #1  
Old July 17th, 2005, 12:51 AM
Johan den Boer
Guest
 
Posts: n/a
Default retrieve windows username in php

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



  #2  
Old July 17th, 2005, 12:51 AM
Randell D.
Guest
 
Posts: n/a
Default 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...


  #3  
Old July 17th, 2005, 12:51 AM
Daniel Bengs
Guest
 
Posts: n/a
Default 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.

  #4  
Old July 17th, 2005, 12:51 AM
Ian.H
Guest
 
Posts: n/a
Default 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.

  #5  
Old July 17th, 2005, 12:51 AM
Jon Kraft
Guest
 
Posts: n/a
Default 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
  #6  
Old July 17th, 2005, 12:51 AM
Kevin Thorpe
Guest
 
Posts: n/a
Default 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/

  #7  
Old July 17th, 2005, 12:51 AM
Alan Little
Guest
 
Posts: n/a
Default 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/
  #8  
Old July 17th, 2005, 12:52 AM
Eto Demerzel
Guest
 
Posts: n/a
Default 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.
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,662 network members.