mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-15 16:38:54 +00:00
Added 2 examples demonstrating ldap_bind.
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@107225 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
bf9bb718ab
commit
4f18866106
1 changed files with 58 additions and 1 deletions
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<!-- $Revision: 1.3 $ -->
|
||||
<!-- splitted from ./en/functions/ldap.xml, last change in rev 1.2 -->
|
||||
<refentry id="function.ldap-bind">
|
||||
<refnamediv>
|
||||
|
@ -23,6 +23,63 @@
|
|||
<parameter>bind_password</parameter> are optional. If not
|
||||
specified, anonymous bind is attempted.
|
||||
</para>
|
||||
<example>
|
||||
<title>Using LDAP Bind</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
// using ldap bind
|
||||
$ldaprdn = 'uname'; // ldap rdn or dn
|
||||
$ldappass = 'password'; // associated password
|
||||
|
||||
// connect to ldap server
|
||||
$ldapconn = ldap_connect( "ldap.example.com" )
|
||||
or die( "Could not connect to LDAP server." );
|
||||
|
||||
if( $ldapconn )
|
||||
{
|
||||
// binding to ldap server
|
||||
$ldapbind = ldap_bind( $ldapconn, $ldaprdn, $ldappass );
|
||||
|
||||
// verify binding
|
||||
if( $ldapbind )
|
||||
echo "LDAP bind successful...";
|
||||
else
|
||||
echo "LDAP bind failed...";
|
||||
}
|
||||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<example>
|
||||
<title>Using LDAP Bind Anonymously</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
//using ldap bind anonymously
|
||||
|
||||
// connect to ldap server
|
||||
$ldapconn = ldap_connect( "ldap.example.com" )
|
||||
or die( "Could not connect to LDAP server." );
|
||||
|
||||
if( $ldapconn )
|
||||
{
|
||||
// binding anonymously
|
||||
$ldapbind = ldap_bind( $ldapconn );
|
||||
|
||||
if( $ldapbind )
|
||||
echo "LDAP bind anonymous successful...";
|
||||
else
|
||||
echo "LDAP bind anonymous failed...";
|
||||
}
|
||||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
|
|
Loading…
Reference in a new issue