Skip to content

Instantly share code, notes, and snippets.

@scuba323
Forked from theredstapler/PHP LDAP Part 3
Created May 18, 2020 03:24
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 scuba323/31d4ed99cb11e78ed768e4ef59f0a393 to your computer and use it in GitHub Desktop.
Save scuba323/31d4ed99cb11e78ed768e4ef59f0a393 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";
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment