If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Unanswered: need guidance in ldap for php

hi all, recently i was given a project that involves php and Active Directory (win 2k server). One of the goals of this project is the ability to automatically redirect users who are logged in to the AD to a web page.

my question is, can i use ldap function in php to fetch the current logged on user in the active directory? do ask if my question is not clear. thanx.

Re: need guidance in ldap for php

Originally posted by b3njo
hi all, recently i was given a project that involves php and Active Directory (win 2k server). One of the goals of this project is the ability to automatically redirect users who are logged in to the AD to a web page.

my question is, can i use ldap function in php to fetch the current logged on user in the active directory? do ask if my question is not clear. thanx.

Yes it is possible because Active Directory is an LDAP implementation.
But it will be hard work, because Active Directory has a difficult structure. (in my opinion)

IMHO better way is replication of Active Directory to another LDAP and PHP will be binding to the replica.

i never worked on ldap before so im not sure how hard it is, but here's a sample:

- user logged on to domain w/ username: user1 & password: blank
- a php page automatically opened, the code in this page will detect the username, compare it with username in a mysql dbase and then redirect the page to a custom page that displays information relevant to the user.

Originally posted by b3njo
i never worked on ldap before so im not sure how hard it is, but here's a sample:

- user logged on to domain w/ username: user1 & password: blank
- a php page automatically opened, the code in this page will detect the username, compare it with username in a mysql dbase and then redirect the page to a custom page that displays information relevant to the user.

i really need help on how to make php detect the username.

PHP is server side running script not client side so you can't automaticaly detect the username on client. So you need to find another way how to do that.

1. Startup script on Windows domain which automaticaly run iesxplore with url and username in parameters

2. If Javascript can check OS username, then simply on the first page check OS username using Javascript and then call (redirect to) another script with username as input parameter.

3. Some Single-signon product

Imho best way is Nr. 3 (For example SunOne Identity server where LDAP is also included)