PHP から LDAP への認証スクリプトを作成しています。私の問題は、ユーザーが管理者でない場合にユーザーを確認する方法が本当にわからないことです。
よくわかりません。ldap_bind
ここでは、管理者ユーザーとしてしかログインできませんが、ou で他のユーザーを検索できますが、パスワードを確認する方法がわかりません。
私がこれまでに持っているもの:
function login($up, $pw){
$ldap = ldap_connect("dejan.local") or die("Could not connect to LDAP server.");
if ($ldap){
ldap_set_option($ldap, LDAP_OPT_REFERRALS, 0);
ldap_set_option($ldap, LDAP_OPT_PROTOCOL_VERSION, 3);
//if I try $up and $pw here, I get an error
if ($bind = ldap_bind($ldap, "Admin", "Somepassword")){
$sr = ldap_search($ldap, "ou=testunit,DC=dejan,DC=local", "samaccountname=$up");
$info = ldap_get_entries($ldap, $sr);
//so here I've gotten information from the user $up
//but I would like to check if his password matches and then get his information
}
}
}
私は他の人からある種の認証スクリプトを見て、彼らは を通じて情報をチェックしましたldap_bind
が、私は自分の管理者ユーザーとしか接続できません。