www.webdeveloper.com
+ Reply to Thread
Results 1 to 5 of 5
  1. #1
    Join Date
    Jun 2007
    Posts
    392

    Using PHP to get computer name / login (active directory) name?

    Hey, my manager suggested that he would like to be able to track certain key transactions by saving the computer name and active directory login name of whomever made said transactions.

    I was able to get... something (computer name I think?) using this:

    Code:
    gethostbyaddr($_SERVER['REMOTE_ADDR'])
    Not really sure to go from here, or if getting all of this information through PHP is even possible. I can totally see why it maybe wouldn't be for an Internet application for user privacy reasons, but this would be running on our intranet where we have the "right" to know who is doing what.

  2. #2
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    18,049
    Is this only for Windows server-based intranet?
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

  3. #3
    Join Date
    Jun 2007
    Posts
    392
    Unfortunately I don't totally understand much about networking / our network. I do know that all of the workstations that would be accessing the php scripts are Windows machines, and the server running the script is a Linux machine.

  4. #4
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    18,049
    It's stuff I've never worked with, so can't really help much, but I suspect you're looking at doing something with the LDAP functions.
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

  5. #5
    Join Date
    Jan 2007
    Location
    Wisconsin
    Posts
    2,120
    If you can tolerate forms authentication, it's easy enough to validate their credentials:

    PHP Code:
    $ldap_connection ldap_connect('ActiveDirectoryServer');
    if (
    $ldap_connection) {
        
    $user $_POST['user'];   // domain\user format;
        
    $pass $_POST['pass'];
        
    $bind_success = @ldap_bind($ldap_connection$user$pass);
        if (
    $bind_success) {
            print 
    "authenticated.\n";
        } else {
            print 
    "NOT authenticated.\n";
        }
    } else {
        print 
    "could not connect.\n";

    If you want a seamless logon experience, you need to implement "Windows Authentication" (NTLM). For that, you might start by looking into this little library:

    https://github.com/loune/php-ntlm/blob/master/ntlm.php
    Jon Wire

    thepointless.com | rounded corner generator

    I agree with Apple. Flash is just terrible.

    Use CODE tags!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center



Recent Articles