Skip to content

Instantly share code, notes, and snippets.

@theredstapler
Created August 12, 2016 16:50
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 5 You must be signed in to fork a gist
  • Save theredstapler/f440d9cf19c03094e6627cfca6aa1d8a to your computer and use it in GitHub Desktop.
Save theredstapler/f440d9cf19c03094e6627cfca6aa1d8a to your computer and use it in GitHub Desktop.
<?php
$ldap_dn = "uid=".$_POST["username"].",dc=example,dc=com";
$ldap_password = $_POST["password"];
$ldap_con = ldap_connect("ldap.forumsys.com");
ldap_set_option($ldap_con, LDAP_OPT_PROTOCOL_VERSION, 3);
if(@ldap_bind($ldap_con,$ldap_dn,$ldap_password))
echo "Authenticated";
else
echo "Invalid Credential";
?>
@jackietw
Copy link

jackietw commented May 8, 2023

if LDAP server need auth, how could I do?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment