Of course I know better ways to pass the authentication (I'm thinking http authentication over SSL), but that requires a rewrite of a lot of parts of the script, right now I'm looking for a fast way to solve this, to start using the scripts. I thought a couple of functions like that would be a simple solution.
Thanks for your help. :)