I'm using the mod_auth_sspi module in Apache to do NT authentication. The problem I'm having is that I also want to get the username of the person who logged in so I can compare them against a local database to see if they should have administrator access.
I can extract the username using perl, but I can't get it to work using php.
The following perl script works to get the username and IP address:
#!/perl/bin/perl.exe
print "Content-type: text/html\n\n";
print "<body>\n";
$user = $ENV{'REMOTE_USER'};
$ip = $ENV{'REMOTE_ADDR'};
print "User: ";
print $user;
print "IP: ";
print $ip;
print "</body>\n";
But for some reason the following php code will give me the IP address but not the username:
<body>
<?php
$user = getenv("REMOTE_USER");
$ip = getenv("REMOTE_ADDR");
echo "User: $user";
echo "<p>IP: $ip";
?>
</body>
Please help. This is driving me insane.
Thanks