note 38285 added to ref.com
| From: | kleontiv-at-combellga-dot-ru at rn2 dot php dot net | Date: | Mon, 15 Dec 2003 14:20:49 +0000 |
| Subject: | note 38285 added to ref.com | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-61980@lists.php.net to get a copy of this message | ||
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.
----
Manual Page -- http://www.php.net/manual/en/ref.com.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+38285
Delete -- http://master.php.net/manage/user-notes.php?action=delete+38285&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+38285&report=yes
Search -- http://master.php.net/manage/user-notes.php