Helping ordinary people create extraordinary websites!
HOME TUTORIALS SCRIPTS WEB HOSTING BLOG FORUM
Get Our Newsletter
Your Email:

Working with a Stateless Protocol

By Tony Marston
2006-08-13


Maintaining State manually

As you can see, with a traditional client-server application state is maintained automatically. It does not require any manual intervention on the part of the programmer. This is not the case with a web application, but what manual steps are available to maintain state between requests?

  • Using arguments in the URL. This can lead to large and unmanageable URLs, and there is a limit to the maximum size of a URL. It also means that a user can edit a URL and effectively change state, with unpredictable results.
  • Using hidden fields in a form. This can lead to large forms which are therefore slower to transmit. Even though the data may be hidden in the rendered document it is still possible for the user to see it by using the browser's "view source" option. It is even possible for the user to edit the source and change some of the values before they are transmitted back to the server.
  • Using cookies. There is a limit to the amount of data which can be stored in a cookie, there is a limit to the number of cookies which can be active at any one time, and larger cookies will take longer to transit. Even worse, the client has the option to disable cookies altogether
  • Using files on the server. In PHP this ability is provided through a facility called sessions which allows data to be recorded either in a disk file or in a database table. The advantage here is that that all data is maintained on the server, so nothing is transmitted to the client (except for a session id). It is therefore not possible for the client to view or edit this session data.


Tutorial Pages:
» Introduction
» The Differences
» Maintaining State manually
» Other points to consider


 | Bookmark
Related Tutorials:
» Port Scanning and Service Status Checking in PHP
» Web Database Access from Desktop Applications
» CubeCart 3.0 Installation and Configuration
» PHP Site Search Made Easy
» Installing and Configuring Drupal 6.1
» Desktop Application Development with PHP-GTK