simplify and optimize ontherun page
simplify and optimize ontherun page

- check existence of request parameters 'u' and 't' before using them
- use sprintf to construct SQL queries
- stop execution when redirecting to auth/login.php
- fix indent and whitespace
- simplify JavaScript

coffeestats/coffeestats,coffeestats/coffeestats,coffeestats/coffeestats