Used prepared statements instead of strings in MySQLConnect
specifically the functions CreateUser and CreateEventType.
Also added support for foreign keys for users, groups and files in the latter.
Small bugfixes in other files too.