Hello,

I need to find out how I can get the windows-username of visitors of my intranet-website. All users are on Windows XP with IE. The website is PHP-written, and I need the username in my login-procedure. Is there a way to get that username?

Maybe it can be done with JavaScript or some other programming language, but I don't know how to use those or where to find out if it's possible... Can anyone hel me with this please?

Kind regards,
Lieven Van Coninckxloo

    
    <?php 
    $ip = getenv("REMOTE_ADDR"); 
    echo("IP address is $ip<BR>"); 
    $user_chunks = explode("\\",strtoupper(getenv("REMOTE_USER"))); 
    $user_domain = $user_chunks[0]; 
    $user_name = $user_chunks[1]; 
    
    echo("User domain is $user_domain<BR>"); echo("User name is $user_name<BR>");
     ?> 
    

      Parse error: parse error, unexpected T_STRING in /var/www/html/test.php on line 4

      This is the error I get when I surf to the webpage... :-(
      What do I need to get the page to work?

      kind regards,
      Lieven

        it should be available in the $ENV superglobal array as $ENV['USERNAME'].
        <?php echo $ENV['USERNAME']; ?> should work ok. also getting the computer name would be $ENV['COMPUTERNAME']

          Do I need to configure something on my server for this to work?
          When I use all of these ENV-variables, I get empty results.

          eg:
          <?
          $temp = getenv("REMOTE_USER");
          echo('this is the remote user: -->' . $temp . '<--');
          ?>

          the result is:
          this is the remote user: --><--

          so the variable is empty, no error, but no result as well.
          I have a RedHat server, maybe that is the problem, but i really need to get the username...

          Kind regards,
          Lieven

            Write a Reply...