note 38285 deleted from ref.com by nlopess
| From: | nlopess@php.net | Date: | Mon, 15 Dec 2003 15:08:59 +0000 |
| Subject: | note 38285 deleted from ref.com by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-61983@lists.php.net to get a copy of this message | ||
Note Submitter: kleontiv -at- combellga -dot- ru
----
I think some one wants to access to Microsoft Active Directory using ADSI with different credential
by PHP. You can also do it via pure LDAP but using ADSI it is more simpler.
On VB, VBS or ASP you can do like folowing (so not trivial):
<%
Set dso = GetObject("LDAP:")
Set DsObj = dso.OpenDSObject( _
"LDAP://DC=combellga,DC=ru", _
"OFFICE\Installer", _
"Install@combellga.ru", _
ADS_SECURE_AUTHENTICATION + ADS_SERVER_BIND + ADS_USE_ENCRYPTION)
for each Obj in DsObj
Response.Write Obj.name & " with class of: " & Obj.class &
"<br>"
next
%>
On PHP you can do like that:
<?php
$ADSI = new COM("LDAP:") ;
$DsObj = $ADSI->OpenDsObject("LDAP://DC=combellga,DC=ru",
"OFFICE\Installer",
"Install@combellga.ru",
515) ;
while($Obj = $DsObj->Next())
{
echo $Obj->name.' with class of: '.$Obj->class.'<br>' ;
}
?>
The access type enumeration you can use ADS_AUTHENTICATION_ENUM.