Fixed the persistent cookie code
The cookie expiration date should be set only if the cookie is
persistent, not the other way around.  The previous code did
exactly the opposite.