I didn't mean to give you a lesson.
I also used to hard-code the auth in the script and have also wondered which solution would be the best.
I share your overall feeling so I am in the same boat as you and would love to hear from one of the local gurus ;-)
jayrom