Ldap authentication with windows login
Hi all,
I have been trying to authenticate windows login credentials by using ldap.Below is the code by which i am trying to authenticate the login credentials by accessing active directory of windows server but i am unable to authenticate it.Can anyone please help me resolve the problem.
Thank you.
) && isset($_POST['password">)){
$adServer = "192.168.2.14";
$ldap = ldap_connect($adServer);
$username = $_POST['username">;
$password = $_POST['password">;
$ldaprdn = 'relyon' . "\\" . $username;
ldap_set_option($ldap, LDAP_OPT_PROTOCOL_VERSION, 3);
ldap_set_option($ldap, LDAP_OPT_REFERRALS, 0);
$bind =ldap_bind($ldap, $ldaprdn,$password);
if ($bind) {
$filter="(sAMAccountName=$username)";
$result = ldap_search($ldap,"dc=relyon,dc=.com",$filter);
ldap_sort($ldap,$result,"sn");
$info = ldap_get_entries($ldap, $result);
for ($i=0; $i<$info["count">; $i++)
{
if($info['count"> > 1)
break;
echo "You are accessing ". $info[$i]["sn">[0] .", " . $info[$i]["givenname">[0] ."
(" . $info[$i]["samaccountname">[0] .")
\n";
echo '';
var_dump($info);
echo '';
$userDn = $info[$i]["distinguishedname">[0];
}
@ldap_close($ldap);
} else {
$msg = "Invalid email address / password";
echo $msg ." & ".$ldaprdn;
}
}else{
?>
Username:
Password:
-
I have been trying to authenticate windows login credentials by using ldap.Below is the code by which i am trying to authenticate the login credentials by accessing active directory of windows server but i am unable to authenticate it.
Hello, Could you provide some more information on how this relates to the cPanel software or the cPanel server? Thank you.0
Please sign in to leave a comment.
Comments
1 comment