• Hi,
    I would like to capture the NT user name of the user who makes a comment in an intranet-based network [Windows 2003 server, with IIS]
    I do have a snippet of code, found out recently, that works on its own.
    However, being very new to php [with asp background] cannot get this to work.
    I would like this snippet to be inserted after line 967, or near enough, in the ‘pluggable.php’ file; where it sends out an email to the moderator notifying him/her of a new comment. The snippet is:

    —————–

    <?php
    /*
    Getting netbios info
    CopyLeft 2002 (GNU GPL V2) by polo
    */

    error_reporting(E_ALL);

    /* get the ip of the client */
    if (isset($_SERVER[“HTTP_X_FORWARDED_FOR”]))
    {
    $ip = $_SERVER[“HTTP_X_FORWARDED_FOR”];
    } else {
    $ip = $_SERVER[“REMOTE_ADDR”];
    }
    echo ‘ip : ‘.$ip.’
    ‘;

    /* send a “special” packet */
    $fp = fsockopen(‘udp://’.$ip, 137);
    fwrite($fp, “\x80b\1 CKAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA!\1”);

    /* wait 2 secs, and get the data */
    socket_set_timeout($fp, 2);
    $data = fread($fp, 256);

    /* get netbios records number */
    $nbrec = ord($data[56]);

    /* display nebios records : the username is a record of type 3 */
    echo ‘<table border=”1″>’;
    echo ‘<tr><th>no</th><th>type</th><th>value</th></tr>’;
    for($i = 0; $i < $nbrec; $i++) {
    $offset = 18 * $i;
    printf (“<tr><td>%02d</td><td>%02X</td><td>%s</td></tr>”,
    $i,
    ord($data[72 + $offset]),
    trim(substr($data, 57 + $offset, 15)));
    }
    echo ‘</table>’;
    ?>
    ——————-‘

    I would be grateful if someone who is a dab hand at php could modify the pluggable file and let me know.

    Thank you.

  • The topic ‘Capture NT user name’ is closed to new replies.