WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDES  |  PHP CLASSES  |  CODE SEARCH  |  ARTICLES SEARCH  |  PHP FORUMS  |  PHP MANUAL  |  PHP FUNCTIONS LIST  |  WEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Submit Your Code
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
WeberDev's Monthly code contest PHP Code Contest
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Index
PHP Web Logs (BLogs)
Web Development Resources
Web Development Content
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
Submit Site
Forex Trading Online forex trading platform

Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES ADD CODE EXAMPLES PRINT
Title : How to query a directory server using LDAP. Keywords: ldap_connect ldap_search
Categories : LDAP, Network, PHP Update Picture
Nick Talbott
Date : Jul 10th 1998
Grade : 1 of 5 (graded 1 times)
Viewed : 8796
File : No file for this code example.
Images : No Images for this code example.
Search : More code by Nick Talbott
Action : Grade This Code Example
Tools : My Examples List

  Submit your own code examples 
 

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