Assinment of Session New
Assinment of Session New
Assinment of Session New
Contents
According to the oxford dictionary there are four general meanings for the word session they are 1. 2. 3. 4. A period of time that is spent doing a particular activity A formal meeting or series of meetings of a court, a parliament etc. ;a period of time when such meetings are held. A school or university year. An occasion when people meet to play music.
Introduction of session
According to Wikipedia session a conversation or a meeting, between two or more communicating devices, or between a computer and user (example: Login session) between computer and user.
Analysis
PHP Sessions
When you opening an application in your computer and do some change and then you will closed it that period of time call session. The problem is computer will know who you are, but server does not know who you are and what you do, because the HTTP address doesn't maintain state. So here PHP session will give you the answer
A PHP session variable is used to store information about, or change settings for a user session. Session variables hold information about one single user, and are available to all pages in one application.
A PHP session will allowing you to store user information on the server for later use (i.e. username, shopping items, etc). However, session information is temporary and will be deleted after the user has left the website. If you need a permanent storage you may want to store the data in a database. Sessions work by creating a unique id (UID) for each visitor and store variables based on this UID. The UID is either stored in a cookie or is propagated in the URL.
page with a browser, it will send the cookie too. With PHP, you can both create and retrieve cookie values.
The code above will register the user's session with the server, allow you to start saving user information, and assign a UID for that user's session. Destroying a Session
If you wish to delete some session data, you can use the unset() or the session_destroy() function.
ASP session
ASP session also similar to PHP but there are many differences between PHP & ASP among those, two differences as follows
Cost
To run ASP programs one needs IIS installed on a Windows platform server, which is not free. PHP programs run on Linux, which is free. Even the connectivity of the database is expensive in the case of ASP as MS-SQL is a product of Microsoft that needs to be purchased. PHP generally uses MySQL, which is freely available.
Speed
If we compare the speed of ASP and PHP then PHP has an upper hand. PHP code runs faster than ASP. ASP is built on COM based architecture, which is an overhead for the server whereas...
When session start with:A new user requests an ASP file, and the Global.as a file includes a Session_On Start procedure
A user requests an ASP file, and the Global.asa file uses the <object> tag to instantiate an object with session scope
A session ends if a user has not requested or refreshed a page in the application for a specified period. By default, this is 20 minutes. If you want to set a timeout interval that is shorter or longer than the default, use the Timeout property. The example below sets a timeout interval of 5 minutes:
<% Session.Timeout=5 %>
The most important thing about the Session object is that you can store variables in it.
The example below will set the Session variable username to "nimal" and the Session variable age to "50":
<% Session("username")="nimal" Session("age")=50 %>