Connecting Tech Pros Worldwide Help | Site Map

retrieve windows username in php

  #1  
Old July 17th, 2005, 01:51 AM
Johan den Boer
Guest
 
Posts: n/a
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, 01:51 AM
Randell D.
Guest
 
Posts: n/a

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, 01:51 AM
Daniel Bengs
Guest
 
Posts: n/a

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, 01:51 AM
Ian.H
Guest
 
Posts: n/a

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, 01:51 AM
Jon Kraft
Guest
 
Posts: n/a

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, 01:51 AM
Kevin Thorpe
Guest
 
Posts: n/a

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, 01:51 AM
Alan Little
Guest
 
Posts: n/a

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, 01:52 AM
Eto Demerzel
Guest
 
Posts: n/a

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
upload to ftp through a php script printline answers 2 October 23rd, 2008 03:23 PM
"error_reporting" setting not being recognized in my php.ini file laredotornado@zipmail.com answers 1 October 3rd, 2006 03:25 PM
Cannot use mail() in IE, only works in a debugger--help baustin75@gmail.com answers 8 October 5th, 2005 06:15 PM
php sessions problem - wrong logic maybe Bartosz Wegrzyn answers 9 July 17th, 2005 01:59 PM