working database access and replaced ldapuser.php functionality