fixed critical bug (cannot login or join) and invalid database connection check. moved referrer check to top.