note 47685 added to function.ldap-bind

From: Date: Thu, 25 Nov 2004 07:40:14 +0000
Subject: note 47685 added to function.ldap-bind
Groups: php.notes 
Request: Send a blank email to php-notes+get-81004@lists.php.net to get a copy of this message
If you do not want to bind as unixadmin or *manager (i. e., for authentication on web applications), the following code could be useful: <?php $ldaphost = "ldap.yourdomain.com"; /*for a SSL secured ldap_connect() $ldaphost = "ldap.yourdomain.com"; */ $ldapport = 389; $ds = ldap_connect($ldaphost, $ldapport) or die("Could not connect to $ldaphost"); if ($ds) { $username = "some_user"; $upasswd = "secret"; $binddn = "uid=$username,ou=people,dc=yourdomain,dc=com"; $ldapbind = ldap_bind($ds, $binddn, $upasswd); if ($ldapbind) { print "Congratulations! $some_user is authenticated.";} else { print "Nice try, kid. Better luck next time!";}} ?> ---- Manual Page -- http://www.php.net/manual/en/function.ldap-bind.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+47685 Delete -- http://master.php.net/manage/user-notes.php?action=delete+47685&report=yes Reason: bad code -- http://master.php.net/manage/user-notes.php?action=delete+47685&report=yes&reason=bad+code Reason: spam -- http://master.php.net/manage/user-notes.php?action=delete+47685&report=yes&reason=spam Reason: useless example -- http://master.php.net/manage/user-notes.php?action=delete+47685&report=yes&reason=useless+example Reason: contains commercial links -- http://master.php.net/manage/user-notes.php?action=delete+47685&report=yes&reason=contains+commercial+links Reason: useless note -- http://master.php.net/manage/user-notes.php?action=delete+47685&report=yes&reason=useless+note Reject -- http://master.php.net/manage/user-notes.php?action=reject+47685&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#81004) next »