|
|
|
LDAP query test
<?php
// basic sequence with LDAP is connect, bind, search, interpret search result,
close connection
echo "Connecting .. ";
$ds=ldap_connect("ds1.ruralwales.net"); // ! this must be a valid LDAP server !
echo "connect result is ".$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
$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 "";
echo "dn is: ". $info[$i]["dn"] ."";
echo "first cn entry is: ". $info[$i]["cn"][0] ."";
echo "first email entry is: ". $info[$i]["mail"][0] ."";
}
echo "Closing connection";
ldap_close($ds);
}
else {
echo "Unable to connect to LDAP server";
}
?>
|
|
| Windows 2003 Active Directory User Query (Ldap) Categories : PHP, LDAP | | | Authentication script to authenticate users in Active Directory through LDAP. Categories : LDAP, Authentication, Cookies, PHP | | | Class for sending mail with MIME attachments in multipart format using external sendmail, mimencode and zip Categories : Email, Network, PHP, PHP Classes | | | ldap_add -- Add entries to LDAP directory Categories : PHP, PHP Functions, LDAP | | | A web-based php3 IMAP email client supporting address books, attachements (downloading and sending), LDAP searching, and much much more. Categories : Email, PHP, LDAP | | | PHP4 HTTP Compression Speeds up the Web Categories : PHP, Zlib, HTML and PHP, HTTP, Network | | | WebServerSpy checks which kind of Webserver is running, Apache, Netscape, Fasttrack, IIS, HTTP-Header, HTTP 1.0, GET, spy, WWW Categories : HTTP, Network, Apache, PHP, Web Servers | | | Examines the user's computer for open Netbus (the trojan horse) port and reports the conclusion to the user. Categories : Network, PHP | | | Introduction to LDAP Categories : LDAP, PHP | | | How to get the exit code and result of an exec() command. Categories : PHP, Network | | | Client classes for Dictionary servers UPDATED: 2000-06-06 Categories : Network, Search, Complete Programs, PHP Classes, PHP | | | whois domain name lookup dns url Categories : PHP, Search, Network | | | Create MRTG Graphic from rrd database (Need MRTG and RRDTool installed). Categories : PHP, Network, Graphics | | | Sample usage of IPv6 and IPv4 with PHP Categories : PHP, PHP Classes, Network | | | IPTables Bandwidth statics Categories : PHP, Security, Network | |
|
|
|