uraknai Posted February 4, 2009 Posted February 4, 2009 Hi, our website uses the users Active Directory details to login to the school website using php and ldap. Is it possible to get the users AD username that they used to login to the networked PC with and pass it as a variable to log them into the website. Cheers, Nick
Gatt Posted February 4, 2009 Posted February 4, 2009 It should be possible - depends on what language you are using ASP(.net) or PHP? Never done it myself but it should be possible...
maniac Posted February 4, 2009 Posted February 4, 2009 It is possible using this add on for PHP. adLDAP - LDAP Authentication with PHP for Active Directory However, I never suceeded in getting it to work, so good luck!
srochford Posted February 4, 2009 Posted February 4, 2009 I've not used adLDAP with PHP so can't comment on it but it looks as if it should work :-) Are you running PHP on IIS? If so, could you change the home page to be an ASP page; that can then use integrated authentication to find out who's there and then that ASP page can call the "real" home PHP page and pass the user to it. You can also set something in every PHP page to say "is logon user set?; yes - carry on; no - redirect to ASP code to find it"
uraknai Posted February 4, 2009 Author Posted February 4, 2009 Thanks guys. I'll have a look adLDAP and see if I can figure it out. I'm using PHP on IIS. The home page is heavily reliant on PHP so unfortunately ASP isn't an option. Could there be a way to do it with javascript??
srochford Posted February 4, 2009 Posted February 4, 2009 Thanks guys. I'll have a look adLDAP and see if I can figure it out. I'm using PHP on IIS. The home page is heavily reliant on PHP so unfortunately ASP isn't an option. Could there be a way to do it with javascript?? You can still keep your existing home page. Let's say the home page is called "index.php" and that's picked up because you have IIS set to use that as default. You change IIS so that it uses default.asp as the default page. All that page does is get the ID and call index.php - users see nothing apart perhaps from a very quick URL change. If users have a short cut to http:///index.php instead of http:// then just adding code to index.php to check if you have a username and, if not, doing a quick call to default.asp The javascript idea is good but I don't think you can do it - you need to do something like reading environment variables or making shell calls and I think pretty much everything like that is blocked by the browser for security reasons.
powdarrmonkey Posted February 4, 2009 Posted February 4, 2009 Sounds like you're already doing integrated authentication, which means you can just use the environment variables IIS gives you from your PHP script. Off the top of my head I don't remember what they are ($_SERVER['AUTH_USER'] rings a bell)
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now