tags:

views:

21

answers:

1

I was reading this article: http://www.devarticles.com/c/a/PHP/Creating-a-Membership-System/2/

I am not sure if I understand sessions properly. Do I have to start a session for each member protected page? or do I just have to create one session and check if the user is in a session on each and evey page? how would I do that? Examples apprecited! :)

+2  A: 

you (usally) don't really create a session. You just session_start(); on beginning of EVERY page and assign data to $_SESSION.

EDIT:

PHP sessions are not really "sessions", they're just containers of data.

When users logs in, you assign to session for example:

$_SESSION['loggedin'] = '1';

And on every page you check that:

if($_SESSION['loggedin'] !== '1')
{
   exit;
}

// your stuff

very simple.

radex