September 13

Use of Session cookies……

images

As we know webpages have no memories. A user going from page to page will be treated by the website as a completely new user. Session cookies enable the website you are visiting to keep track of your action or navigation from page to page so you don’t get asked for the same information again and again you’ve already given to the site. The cookies allow user to proceed through many pages of a site quickly and easily without having to authenticate or reprocess each new area you visit.

Session cookies allow users to be recognized within a website so any page changes or item or data selection you do is remembered from page to page. The most common example of this functionality is the shopping cart feature of any e-commerce site. When you visit one page of a catalog and select some items, the session cookie remembers your selection so your shopping cart will have the items you selected when you are ready to check out. Without session cookies, if you click CHECKOUT, the new page does not recognize your past activities on prior pages and your shopping cart will always be empty.

Without cookies, websites and their servers have no memory. Without a cookie every time you open a new web page the server where that page is stored will treat you like a completely new user.

September 11

How does PHP session work?

Session in PHP is loaded into PHP core as an extension, we can understand it as an extension. When session extension is loaded, PHP will call core functions to get the session save_handler, i.e interface or functions for reading and writing session data. By default, PHP will handle session data by writing and reading files on the server. But PHP also supplies custom methods for handling session data, we can use session_set_save_handler() to register the save_handler. At the same time, PHP will check whether session_auto_start is on or off in the configuration file, if it is on, PHP will call internal functions to create session automatically.

Continue reading

September 2

Difference between CACHE and SESSION

The very big  difference in cookies and session is,  cookies and sessions is that cookies are stored in the user’s browser, and sessions are NOT.

A cookie can keep information in the user’s browser until deleted. If a person has a login and password, this can be set as a cookie in their browser so they do not have to re-login to your website every time they visit. You can store almost anything in a browser cookie. The trouble is that a user can block cookies or delete them at any time. If, for example, your website’s shopping cart utilized cookies, and a person had their browser set to block them, then they could not shop at your website. Continue reading