I can't comment on your actual problem, but I thought I should point out that using cookies to store password information is not a very secure practice. You can check out
http://www.google.com/search?q=cross-site+scripting+vulnerability+cookie+javascript for some examples of how easy it is to snatch passwords this way. Also, are you running on a secure server? If not, then you're sending the password out every time the cookie is set, thus increasing the vulnerability. Since you are sending the username WITH the password, you're handing over the keys to the kingdom.
Cheers,
Ovid
Update: lindex has a good point. Sometimes this isn't an issue.
Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.