Implemented xsrf cookies and db write checking