Skip to content

Instantly share code, notes, and snippets.

@redknitin
Created January 8, 2015 13:11
Show Gist options
  • Save redknitin/c215ed780ec6ae03ef70 to your computer and use it in GitHub Desktop.
Save redknitin/c215ed780ec6ae03ef70 to your computer and use it in GitHub Desktop.
LDAP Authentication through PHP
<?php
require_once 'Net/LDAP2.php';
$cfg = array(
'binddn'=>'isdbwdom\nithinr', //'cn=nithinr,ou=users,dc=isdbwdom,dc=local',
'bindpw'=>'gorillacheese',
'basedn'=>'dc=isdbwdom,dc=local',
'host'=>'isdbwdom.local'
);
$ldap = Net_LDAP2::connect($cfg);
if (PEAR::isError($ldap)) {
die('Could not connect to LDAP-server: '.$ldap->getMessage());
} else {
echo 'Connect OK';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment