use a single db function for recording a play

this also adds an authentication function into the database