Pyh.conf’25: a new PHP conference for the Russian-speaking community

Voting

: max(two, one)?
(Example: nine)

The Note You're Voting On

Richie Bartlett(at)ITsystems-Online com
20 years ago
This is an update to <i>wtfo at technocraft dot com</i> (23-May-2002 03:40)... This function allows additional (optional) parameters. The prev function listed, failed to close the ldap connection after successful authenication.

<?php
function checkNTuser($username,$password,$DomainName="myDomain",
$ldap_server="ldap://PDC.example.net"){//v0.9
// returns true when user/pass enable bind to LDAP (Windows 2k).
$auth_user=$username."@".$DomainName;
#echo $auth_user."->";
if($connect=@ldap_connect($ldap_server)){
#echo "connection ($ldap_server): ";
if($bind=@ldap_bind($connect, $auth_user, $password)){
#echo "true <BR>";
@ldap_close($connect);
return(
true);
}
//if bound to ldap
}//if connected to ldap
#echo "failed <BR>";
@ldap_close($connect);
return(
false);
}
//end function checkNTuser
?>

<< Back to user notes page

To Top