Fixed some vulnerabilities and whatnot.

Decided to take a look at the source in my spare time and thought I'd fix a couple vulnerabilities, but more gruesome bugs lurk deeper.

Remember to add die() after a header redirect! :)
Cheers!