+ Post New Thread
Results 1 to 7 of 7
Windows Server 2000/2003 Thread, Using Active Directory to Login to a website in Technical; Hi, our website uses the users Active Directory details to login to the school website using php and ldap. Is ...
  1. #1

    Join Date
    Oct 2008
    Posts
    9
    Thank Post
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Using Active Directory to Login to a website

    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

  2. #2

    Gatt's Avatar
    Join Date
    Jan 2006
    Posts
    6,644
    Thank Post
    858
    Thanked 645 Times in 428 Posts
    Rep Power
    498
    It should be possible - depends on what language you are using ASP(.net) or PHP?
    Never done it myself but it should be possible...

  3. #3

    maniac's Avatar
    Join Date
    Feb 2007
    Location
    Kent
    Posts
    3,037
    Thank Post
    209
    Thanked 425 Times in 306 Posts
    Rep Power
    144
    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!

  4. #4

    Join Date
    Aug 2005
    Location
    London
    Posts
    3,154
    Thank Post
    114
    Thanked 527 Times in 450 Posts
    Blog Entries
    2
    Rep Power
    123
    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"

  5. #5

    Join Date
    Oct 2008
    Posts
    9
    Thank Post
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    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??

  6. #6

    Join Date
    Aug 2005
    Location
    London
    Posts
    3,154
    Thank Post
    114
    Thanked 527 Times in 450 Posts
    Blog Entries
    2
    Rep Power
    123
    Quote Originally Posted by uraknai View Post
    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://<domain>/index.php instead of http://<domain> 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.

  7. #7

    powdarrmonkey's Avatar
    Join Date
    Feb 2008
    Location
    Alcester, Warwickshire
    Posts
    4,859
    Thank Post
    412
    Thanked 777 Times in 650 Posts
    Rep Power
    182
    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)

SHARE:
+ Post New Thread

Similar Threads

  1. Active Directory
    By Neville in forum Windows
    Replies: 6
    Last Post: 25th June 2008, 03:24 PM
  2. Replies: 7
    Last Post: 31st January 2008, 12:17 PM
  3. Replies: 2
    Last Post: 28th November 2007, 04:40 PM
  4. script for active directory
    By chalkwellstu in forum Scripts
    Replies: 8
    Last Post: 24th September 2007, 01:53 PM
  5. Website authentication with active directory
    By dhassen in forum Web Development
    Replies: 15
    Last Post: 6th April 2006, 01:13 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •