내부 LAN에서만 실행되고 네트워크의 모든 Windows 컴퓨터가 SBS 또는 완전 손상된 Windows Active Directory에 대해 인증하는 경우 LDAP 쿼리로 페이지를 탐색하는 사용자의 로그인을 쿼리 할 수 있습니다. 저는 몇 년 전부터 인트 라넷을 위해 이것을 해왔습니다. 꽤 신뢰할 만하지만 Windows 도메인에 대해 인증 된 내부 사용자 만 사용할 수 있습니다.
기본 LDAP 쿼리
<?php
// basic sequence with LDAP is connect, bind, search, interpret search result,
// close connection
$ds=ldap_connect("192.168.0.1"); // ! Your LDAP/Active Direcotry Server !
echo "Connection: ".$ds."";
if ($ds) {
echo "Binding ..";
$r=ldap_bind($ds); // this is an "anonymous" bind, typically read-only access
echo "Bind result is ".$r."";
echo "Searching for (sn=A*) .."; // this example searches surname entry for all surnames starting with A
$sr=ldap_search($ds,"o=Organisation Name, c=UK", "sn=A*"); // ! must use real base dn here !
echo "Search result is ".$sr."";
echo "Number of entires returned is ".ldap_count_entries($ds,$sr)."";
echo "Getting entries ...";
$info = ldap_get_entries($ds, $sr);
echo "Data for ".$info["count"]." items returned:";
for ($i=0; $i<$info["count"]; $i++) {
echo "dn is: ". $info[$i]["dn"] ."";
echo "first cn entry is: ". $info[$i]["cn"][0] ."";
echo "first email entry is: ". $info[$i]["mail"][0] ."";
}
//now close connection
ldap_close($ds);
} else {
echo "Unable to connect to LDAP server";
}
?>
사용자가 Windows에서 사용자를 검색하는 것을 어떻게 알 수 있습니까? – Joe