Sessions

Sessions are an essential part of any interactive website.  A session is what a programmer calls the time whilst the user is making use of the software.  In the case of a website, that is the time from when they first browse to the side, to when they close the webpage.   Each time the user comes to the website, it is considered to be a separate session.

Here is an example of a simple PHP Session

<?php
session_start();
if(isset($_SESSION['views']))
    $_SESSION['views'] = $_SESSION['views']+ 1;
else
    $_SESSION['views'] = 1;

echo "views = ". $_SESSION['views'];
?>
This example works simply by creating a session cookie.

So what is cookies are disabled?   Well this is where the use of multiple pages is a good idea.   The first page starts the session cookie.   This page displays a splash screen. As part of that splash screen there is a hyperlink to the login pages.
The logon page checks for the cookie, if it is not present, it instructs the user that cookies need to be enabled.

UK Law: There is a UK Law in place about the use of cookies.  Basically I think this means that if you are using the cookie to provide access to a logon there isn't a problem.
if you are trying to use the cookie to track a user and get information for advertising you need to gain explicit consent.

For my applications, I will be using them for a logon and to allow that user to keep accessing their session.  Therefore the law isn't an issue for me.  If I were to have another use I would have to look again at the law.

Leave a Reply

Your email address will not be published. Required fields are marked *