Skip to main content

Posts

Showing posts from November, 2007

PHP LDAP

Simple function to check if a username and password is correct with Active Directory.function checkNTuser($username, $pasword){ $Domain="SOMEDOMAIN"; $Server="ldap://someaddress.co"; $auth=$username."@".$Domain; if (extension_loaded('ldap')){ echo "LDAP Module Enabled"; $connect=ldap_connect($Server); if ($bind=ldap_bind($connect, $auth, $password)){ ldap_close($connect); echo "Success"; return(true); } else { ldap_close($connect); echo "Failed"; return(false); } } }