persistent cookies / added expiration date to cookies

If you do not set the cookie's expiration, the cookie is created but it is not stored on the user's hard disk. Instead, the cookie is maintained as part of the user's session information. When the user closes the browser, the cookie is discarded. 

I added the optional expiration-date to the cookie creation.

This is my first pull request. 
I have not done any testing - but i hope i can make a start with this.