Add SQL injection security and html escaping to insert event query.

Also make categories field an array for php.
Fix merge conflict in insert.php