Skip to content

Instantly share code, notes, and snippets.

@kgust
Created March 4, 2023 18:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kgust/4971d3b395ecbd535b60de76a6ec0571 to your computer and use it in GitHub Desktop.
Save kgust/4971d3b395ecbd535b60de76a6ec0571 to your computer and use it in GitHub Desktop.
Testing LDAP Bind
<?php
// using ldap bind
$ldaprdn = $RDN; // ldap rdn or dn
$ldappass = $PASS; // associated password
// connect to ldap server
$ldapconn = ldap_connect($ldapUrl)
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...";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment