Fixed all unsafe calls to mysql_*, replaced with parameterized queries