wlogeshwaran Posted April 18, 2011 Share Posted April 18, 2011 Hi , I am coding for an intranet site in which I have to get Username of the windows machine. How to get that in Javascript ? Is that possible to get the username in PHP ?If yes, tell me how?? Thanks in advance. Link to comment https://forums.phpfreaks.com/topic/234023-getting-windows-username/ Share on other sites More sharing options...
Adam Posted April 18, 2011 Share Posted April 18, 2011 Not possible with JavaScript, PHP or any other web-technology. It would be a security risk for websites to be able to retrieve the user's personal information such as that. Link to comment https://forums.phpfreaks.com/topic/234023-getting-windows-username/#findComment-1202874 Share on other sites More sharing options...
Adam Posted April 18, 2011 Share Posted April 18, 2011 There is a way to retrieve the Window's username using VBScript, but that doesn't work when accessed through the HTTP protocol or for any other browser than IE. You mentioned it's an Intranet site though, so I guess that's ruled out. Link to comment https://forums.phpfreaks.com/topic/234023-getting-windows-username/#findComment-1202878 Share on other sites More sharing options...
trq Posted April 18, 2011 Share Posted April 18, 2011 You can retrieve a Windows username in PHP providing you are using HTTP authentication and your user has logged in accordingly. There username will turn up within $_SERVER['PHP_AUTH_USER']. Link to comment https://forums.phpfreaks.com/topic/234023-getting-windows-username/#findComment-1202896 Share on other sites More sharing options...
Adam Posted April 18, 2011 Share Posted April 18, 2011 You can retrieve a Windows username in PHP providing you are using HTTP authentication and your user has logged in accordingly. There username will turn up within $_SERVER['PHP_AUTH_USER']. How would you validate the details are correct? Link to comment https://forums.phpfreaks.com/topic/234023-getting-windows-username/#findComment-1202915 Share on other sites More sharing options...
trq Posted April 18, 2011 Share Posted April 18, 2011 When they login? Most intranet applications Ive dealt with authenticate against LDAP. Link to comment https://forums.phpfreaks.com/topic/234023-getting-windows-username/#findComment-1202923 Share on other sites More sharing options...
Adam Posted April 18, 2011 Share Posted April 18, 2011 Yeah.. You'd need an LDAP server installed and set-up with the required users' details replicated as LDAP entries, that you can then form a request to validate the login. Be aware this method would require you to maintain the LDAP server whenever someone changes their password or username. The point I was getting at was that there's no way of retrieving the actual, real-time Windows username; though thorpe you were more constructive in your answer. Link to comment https://forums.phpfreaks.com/topic/234023-getting-windows-username/#findComment-1202933 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.