function processLDAPLogin($username, $password)
{
    if (authLDAPUser($username, $password)) {
        $userresult = getUserByUsername($username);
        if (mysql_num_rows($userresult) > 0) {
            return $userresult;
        } else {
            if (getConfigVar("login_to_register")) {
                return createUserFromLDAP($username, $password);
            } else {
                return false;
            }
        }
    } else {
        return false;
    }
}
function processLDAPLogin($username, $password){

	if(authLDAPUser($username, $password)){
	
		$userresult = getUserByUsername($username);
		
		if(mysql_num_rows($userresult) >= 1){
		
			return $userresult;
			
		}else{
		
			return createUserFromLDAP($username, $password);
		
		}
	
	}else{
	
		return false;
	
	}

}