Fixed usage of real_escape_string
Fixed more SQL INJECTION DUDES! And also improved some bits of code that passed in front of my eyes