views:

66

answers:

1

What does the following line mean?

Put the boolean variable isLogin to your session such that you check the session each time your user goes to the secured site.

I would like to know how you can put a variable to a session. I know at the abstract level that

session is a semi-permanent interactive information interchange, also known as a dialogue, a conversation or a meeting, between two or more communicating devices, or between a computer and user

I know that you can store data in a URL by separating variables by the character &. I know at the abstract level that you need to use post orget and some read -function to check the data in the URL.

I know that cookies are files where you store data, but I have never stored data to them.

Does he mean that I should put the login -variable to the URL or to cookies?

+1  A: 

Taking out all the context doesn't make it any easier to answer your question - actually I have to guess that you are talking about php, because it looks like you might be.

Sessions. Sessions are a way of 'remembering' users for a limited time. Say I visit page A.php on your website first. Now, that website might define an isLoggedIn session variable for me. If a bit later I go to page B.php on your site, that site 'remembers' that variable and can tell what it' s value was.

Sessions and Cookies do have a relation, but that only matters when you want to know how sessions work. This will be important later on as you will need to know the weaknesses of sessions, but first it is important you get to know how to use them.

Before you can use session variables, you must call session_start(), to start a session - this must be called on each page that uses the session variables. Once we have we can simply access the array $_SESSION and all that's in there will be remembered with the session. Take a look over here to get a more complete explanation and a number of examples.

Jasper
I opened a new question about the same feature in Python at http://stackoverflow.com/questions/1185406/to-start-a-session-in-a-python-webapp
Masi