I read this article, but I have no idea how to implement this on my site.

The article has the codes, but it doesn't show me exactly where to implement the codes.

Also, I would like to set the cookie to expire in 10 hrs. How can I do this?

Thanks for your time and assistance!