Connecting Tech Pros Worldwide Forums | Help | Site Map

Getting Windows Network login username using PHP

Newbie
 
Join Date: Jul 2007
Posts: 7
#1: Jul 17 '08
Hi,
I am trying to develop intranet for my company as the new web admin. When users log in to the network with their username and password, they do not need to login again into the intranet; a single sign-on situation. The intranet will be PHP-MySql on Apache driven. Please does anyone know how i can get the username they used to log on to windows (Network) in my PHP scripts on the intranet. Thank you.
TheServant's Avatar
Expert
 
Join Date: Feb 2008
Location: Australia
Posts: 913
#2: Jul 18 '08

re: Getting Windows Network login username using PHP


I don't think this is possible using PHP, because PHP is an internet language which feeds information to browsers and gets information from online databases.

I think that ASP can do what you are after and so maybe there is a way to get username and passwords using ASP and then hand it over to a PHP login script?
Newbie
 
Join Date: Jul 2007
Posts: 7
#3: Jul 21 '08

re: Getting Windows Network login username using PHP


Thank you! How is this ASP-PHP handover done? can the PHP script reside in ASP file? I have seen a segment of code in ASP where windows username was fetched but dont know how to pass this to PHP.
TheServant's Avatar
Expert
 
Join Date: Feb 2008
Location: Australia
Posts: 913
#4: Jul 22 '08

re: Getting Windows Network login username using PHP


Mate, I wish I could help, but I have no experience with ASP. I do know that ASP can interact with databases, so I have a feeling that if they can't directly handover variables you might need a middleman like MySQL.

I have tried to get variables to pass between javascript and PHP before and eventually gave up, but there has to be help out there. Maybe ask on the ASP.NET forums in here? If you do find a solution, I would really appreciate it if you could post it back here for me and others to learn as well.

Maybe a better php programmer with some ASP/PHP experience will see this and be able to help, so check again in a little while.
Newbie
 
Join Date: Jun 2008
Posts: 25
#5: Jul 23 '08

re: Getting Windows Network login username using PHP


Get the login username in windows using PHP:

Expand|Select|Wrap|Line Numbers
  1. <?php
  2. $username = getenv('USERNAME');
  3. ?>
  4.  
Newbie
 
Join Date: Jul 2008
Posts: 13
#6: Jul 23 '08

re: Getting Windows Network login username using PHP


that script doesnt work?
Reply