I want to be able to allow a single ou in Active directory to have authentication access to an internal website of my company. Please help as I have wasted too much time on it. This is what I have got so far:
$domain ='ab.cd.ef.gh.ij';
$host='xxx.xxx.xx.x';
$ds = ldap_connect($host); //has to be domain or hostname
ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3);
ldap_set_option($ds, LDAP_OPT_REFERRALS, 0);
if($ds)
{
$bind=ldap_bind($ds,$name, $pass);
if($bind)
{
$_SESSION['status'] = 'authorized';
header("location: index.php");
} else return "Please enter correct username and password.";
}
Thanks in advance