Friday, 9 August 2013

Using uLogin Php Authentication to protect webpages

Using uLogin Php Authentication to protect webpages

I have recently came across uLogin PHP Authentication project at sourceforge:
http://ulogin.sourceforge.net/
I went through the example page and tried to figure it out. I think I got
it. Though, the example page is an authentication example. I want to know
how to protect the webpages on the website. I am using the current code to
do so:
require_once ('ulogin/config/all.inc.php');
require_once ('ulogin/main.inc.php');
// Start a secure session if none is running
if (!sses_running())
sses_start();
function isAppLoggedIn() {
return isset($_SESSION['uid']) && isset($_SESSION['username']) &&
isset($_SESSION['loggedIn']) && ($_SESSION['loggedIn'] === true);
}
if (isAppLoggedIn()){ Do something for authenticated users} else {Do
something for anonymous users}
Is this the right way to use it? Thanks for taking the time to help me out.

No comments:

Post a Comment