If you don't set an expiry time with the setcookie() function, by default it expires when the browser is closed. Keep in mind, though, that this does not guarantee that the cookie is cleared from the browser's cookie file, only that the browser will not return it to your page on the next request.
Personally, I don't think it is a good idea to set user id's and passwords in cookies, but every application and circumstance is different ;-)
-- Rich Rijnders
-- Irvine CA US