[feature/api] Implemented serial check in authentication

To stop replay attacks and reusing API calls the auth function now
makes sure a request with the same serial or lower hasn't already
been made.

PHPBB3-11595