I am wanting to authenticate against a MS server (active directory) using LDAP.
Now, the following works perfect

print "Connecting ...";
$ds=ldap_connect("192.168.73.238");
if (($ds) and ($_POST['user'])) { 
	print "Binding ..."; 
	if ($r=@ldap_bind($ds,$_POST['user'],$_POST['password'])) {
		print "<br>yahoooo, you are in";
	} else {
		print "<br>failed to bind, probably bad name/password<br>";
	}
    echo "Closing connection";
    ldap_close($ds);
}

BUT the username is the full name of the person (e.g. Fred Dagg) not their login name (e.g. daggf). How would this need to be changed to user the username instead of the fullname. I would have thought that both might work, but it doesn't.
Note the code is test code, so no checking is done, but would be heavily verified in production-land! At the moment I just want to figure out why you can't login with the username, only the full name!

    Write a Reply...