1. That's character logins, not account logins.
2. That won't auto-refresh.
3. You're not caching so you're going to put a lot of stress on your server, doing query-per-second for every person viewing the page (After you get the refresh part fixed).
4. The code is just plain out messy, I could sit here and point out things that are bad practice.

