I was in the process of uploading when I caught the time. I should have waited to test it, thanks for pointing out the errors though.
As for the constants, there is the slim possibility that the user won't always be using the same connection, so I'd rather leave that up to them to define. However, I'll replace them with a connection function.
As it stands right now, PHP seems to be pick and choosing which files it parses (which is really stating to make me mad) and I can't test it. I'll bring this up with the server admin and sort this out. As for now, use at your own disgression, though it SHOULD be safe and fixed now.