2002-04-15 00:12:54 +00:00
|
|
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
2002-12-09 03:27:15 +00:00
|
|
|
<!-- $Revision: 1.3 $ -->
|
2002-04-15 00:12:54 +00:00
|
|
|
<!-- splitted from ./en/functions/ldap.xml, last change in rev 1.2 -->
|
|
|
|
<refentry id="function.ldap-bind">
|
|
|
|
<refnamediv>
|
|
|
|
<refname>ldap_bind</refname>
|
|
|
|
<refpurpose>Bind to LDAP directory</refpurpose>
|
|
|
|
</refnamediv>
|
|
|
|
<refsect1>
|
|
|
|
<title>Description</title>
|
|
|
|
<methodsynopsis>
|
|
|
|
<type>bool</type><methodname>ldap_bind</methodname>
|
|
|
|
<methodparam><type>resource</type><parameter>link_identifier</parameter></methodparam>
|
|
|
|
<methodparam choice="opt"><type>string</type><parameter>bind_rdn</parameter></methodparam>
|
|
|
|
<methodparam choice="opt"><type>string</type><parameter>bind_password</parameter></methodparam>
|
|
|
|
</methodsynopsis>
|
|
|
|
<para>
|
|
|
|
Binds to the LDAP directory with specified RDN and
|
|
|
|
password. &return.success;</para>
|
|
|
|
<para>
|
|
|
|
<function>ldap_bind</function> does a bind operation on the
|
|
|
|
directory. <parameter>bind_rdn</parameter> and
|
|
|
|
<parameter>bind_password</parameter> are optional. If not
|
|
|
|
specified, anonymous bind is attempted.
|
|
|
|
</para>
|
2002-12-09 03:27:15 +00:00
|
|
|
<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>
|
2002-04-15 00:12:54 +00:00
|
|
|
</refsect1>
|
|
|
|
</refentry>
|
|
|
|
|
|
|
|
<!-- Keep this comment at the end of the file
|
|
|
|
Local variables:
|
|
|
|
mode: sgml
|
|
|
|
sgml-omittag:t
|
|
|
|
sgml-shorttag:t
|
|
|
|
sgml-minimize-attributes:nil
|
|
|
|
sgml-always-quote-attributes:t
|
|
|
|
sgml-indent-step:1
|
|
|
|
sgml-indent-data:t
|
|
|
|
indent-tabs-mode:nil
|
|
|
|
sgml-parent-document:nil
|
|
|
|
sgml-default-dtd-file:"../../../../manual.ced"
|
|
|
|
sgml-exposed-tags:nil
|
|
|
|
sgml-local-catalogs:nil
|
|
|
|
sgml-local-ecat-files:nil
|
|
|
|
End:
|
|
|
|
vim600: syn=xml fen fdm=syntax fdl=2 si
|
|
|
|
vim: et tw=78 syn=sgml
|
|
|
|
vi: ts=1 sw=1
|
|
|
|
-->
|