Did some changes

I changed a ton of variables that are used multiple times and but have already been defined either globally like $userid, $ir, $_GET, etc this way it will reduce some strain on the server because it doesnt have to keep checking the same stuff over and over again. Basically just some micro-optimization.