essjay_d12 Posted May 30, 2007 Share Posted May 30, 2007 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 Quote Link to comment https://forums.phpfreaks.com/topic/53592-getting-computers-username/ Share on other sites More sharing options...
per1os Posted May 30, 2007 Share Posted May 30, 2007 Not without some type of activex control, and even then that might be a privacy violation of some type. Quote Link to comment https://forums.phpfreaks.com/topic/53592-getting-computers-username/#findComment-264894 Share on other sites More sharing options...
pocobueno1388 Posted May 30, 2007 Share Posted May 30, 2007 No, I don't think there is a way to do that with PHP...how exactly would you know their windows username would be the same as the username they entered in your DB? To keep them logged in, why not just set a cookie? Quote Link to comment https://forums.phpfreaks.com/topic/53592-getting-computers-username/#findComment-264896 Share on other sites More sharing options...
essjay_d12 Posted May 30, 2007 Author Share Posted May 30, 2007 we know that the username is the same as the database - and we also know it is possible to obtain windows' username through asp so is it not possible in php? cheers d Quote Link to comment https://forums.phpfreaks.com/topic/53592-getting-computers-username/#findComment-264906 Share on other sites More sharing options...
Diego17 Posted May 30, 2007 Share Posted May 30, 2007 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. Quote Link to comment https://forums.phpfreaks.com/topic/53592-getting-computers-username/#findComment-264910 Share on other sites More sharing options...
per1os Posted May 30, 2007 Share Posted May 30, 2007 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. Quote Link to comment https://forums.phpfreaks.com/topic/53592-getting-computers-username/#findComment-264911 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.