I use the following code to see if a user is authorized to view the current page:
I use various other security checks within my script such as checking against the database. But to display a basic page is the above good enough, obviously I only set the above sessions once the username and password have been checked against the database.PHP Code:session_start();
$uid = $_SESSION['uid'];
$username = $_SESSION['username'];
$userpass = $_SESSION['userpass'];
$firstname = $_SESSION['firstname'];
$lastname = $_SESSION['lastname'];
// Check to see if the session varibles are correct
if(!empty($uid) & !empty($username) & !empty($userpass) & !empty($firstname) & !empty($lastname)) {
//page content
} else {
// not logged in
}
Thanks




Bookmarks