Everytime a genuine user logs into the website we create a session object, which stores his userID.
Every page a user visits logging in to the wesite, should have a session check at the begining of each page. This is done by a function sessionExists().
This function checks if the session object is created for the particular user. If the session is created it will return true, else it will just redirect the user to the home page of this website.
Function: sessionExists()
Defination:
function sessionExists(){
//start the session session_start();
if(!session_is_registered('userID'))
{
//the session variable isn't registered, send them back to the login page
header( "Location: http://discern.uits.iu.edu:8490/UI/index.php" );
}
else {return true;}
}
Usage:
include("../modules/login_func.php");
if (sessionExists())
{
//your page
}
Wednesday, February 20, 2008
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment