Fix PHP notice
If we're not going to display the rank, don't bother to calculate it.

This shaves off some queries and calculations on the team page
during a scoreboard freeze.
Two optimisations in putTeamRow() query behaviour.

Do not query categories, we're not using them later.
Do not requery the same team totals in the calcTeamRow function
we just queried before calling it, just pass them in.
Move updating of last_login to do_login function.

Otherwise it would be called on every page load which has shown to
be problematic in the past. The drawback to this change is that it
now only updates this info for auth methods that actually perform
a login operation. There is no real way around that unless we keep
a session for any login type, which is planned.