Articles tagged with cookies

How to Pre-Enter Author Data in Comment Form

I wanted a new feature for my blog site that fills the Author, Email and Website fields of my comment form with data collected from a previous comment. That is, if a visitor has made a comment before, the visitor won't have to fill in those fields on the next comment (provided that the visitor is using the same computer). I accomplished this by placing a cookie on the visitor's computer which holds the visitor's name, email address and website URL, and then retrieving that information before a comment form is displayed.

The cookie is created in my save-comment event. The last six lines in its __trigger() function now look like this:

Read the full article.

Sessions and Cookies

The purpose of this article is to describe how PHP Sessions and Cookies are used in Symphony CMS and how that affects the user of a website powered by Symphony. I won't get into great detail about the general usage of sessions and cookies because Googling those terms will turn up several good tutorials.

When a new visitor views a Symphony powered site a cookie is placed on the visitor's computer, a session record is stored in the site database and some parameters are set. The session and cookie are related through a unique key that is stored in both. The cookie is set to expire two weeks from the time it is created. The session, however, doesn't contain an expiration date. It just keeps a record of the last time the visitor loads or refreshes a page on the site. The session record also contains a visitor's username and password if the visitor has logged in.

Read the full article.