PHP 8.5.0 Alpha 2 available for testing

Voting

: one plus six?
(Example: nine)

The Note You're Voting On

wkaiser at mpimf-heidelberg dot mpg dot de
20 years ago
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!";}}

?>

<< Back to user notes page

To Top