We know that Webpages are getting displayed using stateless Protocol.
So there should be someway for keeping the session of the user navigating the webpages within a website.
Session variables and Cookie variables can be used for this purpose.
Basically Session variables are maintained by webserver. (i-e)Physically the value of any Session variable will be written to a file located in the web server.
In php, we can set/use the session variable using $_SESSION. Say for example, if we need to put the user email (e.g $email) in session, we can use it as $_SESSION['email'] whose value should be set as $_SESSION['email']=$email.
Whenever assigning this session variable, a file will be written to the web server at location specified by session_path variable in php.ini file.
Suppose 1000 users are using your website, there will be 1000 files created for storing one session variable.
So it will become a big memory issue if you are not managing the session properly. (i-e) we should unset the session variables during logout. Appropriate session timeout value should be specified to enable automatic expiration of the session if the user forgets to logout. And also we need to take additional care to manage session if security is more important for your website.
Or alternatively we can use cookie variables which are stored by the web browser in the users machine. As the cookie variables are stored in the client machine, it can be available till it gets deleted either by browser setting, or by the code or by the user manually.
Since cookie variables can live even after closing the browser session, it can be very useful for improving user experience. (i-e) Lot of data related to user preferences can be stored in the cookie. So whenever the same user logs in, his previous settings can be applied automatically by using these cookie values. For example if the user allows the website to store his password in cookie variable, he can log in to the website without typing his password again.
In php, cookie variables can be set using setcookies function.
But anyway, privacy is important for you, you can restrict the cookies by changing the browser settings.
More Articles...
Search This Blog
Blog Archive
-
▼
2009
(257)
-
▼
April
(56)
- Ways to improve user experience in any website
- Steps for using FCK editor
- For using javascript Calendar in web page
- Focusing HTML element immediately after loading t...
- How to avoid multiple lines in <td> tag?
- Getting current Page Name in PHP
- PHP function to get the ID generated from the prev...
- Javascript example for selectively displaying part...
- Javascript validation for radio button in HTML form
- Detecting browser type using javascript
- Displaying Random records from MySQL database table
- Handling Date and Time in PHP/MySQL
- Email syntax validation using javascript
- Removing text from Textbox on giving Focus
- Displaying vertical scroll bar dynamically in HTML...
- Doing case insensitive search in C#.Net
- Converting Letter Case in php/MySql
- Doing page redirection in PHP
- Workaround for Back button issue in FCKeditor.
- Quick Introduction to RSS feed/Syndication
- How to detect Plagiarism?
- QTP Learning Steps for Beginners
- MySQL - Resolved null issue in query.
- Resolving delimiter issue in PHP
- PHP - Disabling Display of Notice messages
- Understanding Object Repository in QTP (Quick Test...
- HTML - Displaying Content in the same line using ...
- Basics of QTP (Quick Test Professional)
- Basics of Session and Cookies
- PHP - Resolved the issue of setcookies not setting...
- Importance of Software Testing
- PHP code for preventing session hijacking
- Dynamically changing/displaying web page content u...
- Javascript code for preventing user from copying c...
- SQL query for deleting duplicate records in parent...
- Web Development Best Practices
- C# - Performance difference between use of Datatab...
- URL for checking usage of Broadband provided by BSNL
- How to dynamically change attribute (e.g height) o...
- Best practices in Software Testing
- Importance of Software Test Automation using tool...
- Always explicitly use $_GET when using querystrin...
- How to change Row of Data into Column Data in Excel?
- Free Markup validation service provided by W3C
- Basics of Quality Assurance (QA) in Sofware Develo...
- We are growing firmly with our Vision and Values
- Priority order of Style for HTML tags
- Allowing Users to Change attribute of the HTML tag...
- How to find PageRank (PR) of a web page?
- Creating Captcha using PHP and Handling Captcha us...
- Looking for Trainee Software Engineer
- Resolved the timed out error while using HttpWebRe...
- How to disable Wireless LAN in BSNL Modem?
- HTML - Use "return false" to avoid page jump on c...
- C#- Workaround for inconsistent behaviour of invok...
- Unicode Character for Space and Line Feed
-
▼
April
(56)

AI Course | Bundle Offer | Unlocking AI | Dream Big | Listen to Dream Big
Today's Deals | Timesheet | Products | SQL ebook | Earn 50% commission
About | Privacy | Follow | TOS | WhatsApp | Contact
I may earn a commission from Amazon affiliate links
No comments:
Post a Comment