retrieve windows username in php

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Johan den Boer

    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


  • Randell D.

    #2
    Re: retrieve windows username in php


    "Johan den Boer" <me@knoware.n l> wrote in message
    news:vq3lg63h1g kk5c@corp.super news.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...


    Comment

    • Daniel Bengs

      #3
      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.

      Comment

      • Ian.H

        #4
        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.ne t | forum.digiserv. net
        Programming, Web design, development & hosting.

        Comment

        • Jon Kraft

          #5
          Re: retrieve windows username in php

          Johan den Boer <me@knoware.n l> 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

          Comment

          • Kevin Thorpe

            #6
            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.



            Comment

            • Alan Little

              #7
              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

              Comment

              • Eto Demerzel

                #8
                Re: retrieve windows username in php

                In article <T%mob.229825$p l3.105712@pd7tw 3no>, 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.......

                Internet Explorer running on NT will attemt to authenticate using your (hashed) password to anyone who asks! Worse, it doesn't even tell you that it is doing this. Even if you have a very strong password, a man-in-the-middle attack is possible. The server can request a challenge from another server, and then feed it back to you for encryption!


                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:

                Find answers to Write Windows Username Into Input Field - Important from the expert community at Experts Exchange


                might help you out.

                Comment

                Working...