Jump to content

Recommended Posts

is there a way in which php can grab a computers username,

 

i log into windows as john

 

so i want php to grab john and use that to open up a mysql database with information on the user john.

 

Basically so users do not need to log in themselves twice... ie windows then the website (just windows)

 

as that is enough authentication

 

thanks

 

d

Link to comment
https://forums.phpfreaks.com/topic/53592-getting-computers-username/
Share on other sites

It is only possible for asp without asking the user because internet explorer automatically sends a authorization request with the username to the iis webserver. php probably also can read this value from $_SERVER['PHP_AUTH_USER'] when installed as iis module not as cgi. The manual says

'PHP_AUTH_USER'

    When running under Apache or IIS (ISAPI on PHP 5) as module doing HTTP authentication this variable is set to the username provided by the user.

Most likely not, unsure. ASP probably has that "special" function since it is Microsoft based.

 

<?php
$hostname = gethostbyaddr($_SERVER['REMOTE_ADDR']);

echo $hostname;
?>

 

About the only thing I could come up with but unsure if that works, un-tested.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.