Mass Changes to SQL and the site.

Changed most of the SQL queries to prevent SQL injection.