By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,733 Members | 907 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,733 IT Pros & Developers. It's quick & easy.

PEAR Auth - check on each page

P: n/a
I have a framework working where I have multiple pages each checking the
authentication status.

Unauthorised users are redirected to a login page - otherwise the requested
page is shown.
Now my question is just to get a little clarification.

On the login page I create and object of type Auth
$a = new Auth("MDB2", $options, "loginFunction");

and then run

$a->start();

Fine so far.

Now at the top of the each authorised-only page I create a new Auth object
and then check the auth status.

$a = new Auth("MDB2");

if (!$a->checkAuth()) {

HTTP::redirect("login.php");
}

My question is that the new Auth object - $a - can be created with *any*
parameters. It could even be:

$a = new Auth("DB");

And the check works fine.

Do I take it that the Auth object only needs the correct container and
options set up when it runs the start() method? If the name/password come
back in as POSTED correctly then start() will create session variables.

And I take it that these session variables can then be checked by any old
invocation of Auth?

Thanks for any clarification,

Kevin

Oct 13 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.