Security fixes to mysql.php