Yes, it was pseudo code. Thank you very much for your clear examples. I will
take into account everything you've stated here. Thank you.

Nathan

On Wed, Apr 23, 2008 at 8:57 PM, Randy Moller <[EMAIL PROTECTED]> wrote:

> Not sure why header() needs to be the first line in the script. the header
> function can be used anywhere. But your code example (maybe more of a pseudo
> code?) doesn't appear to use a class at all.
>
> 1. On every page the user needs to be authenticated you should include an
> authentication block. If they authenticate, then let them proceed. If not,
> then redirect them to the login page to do so. If you're wanting to do this
> using a class object, you can either instantiate the object, or use a static
> method :
>
> an object oriented approach:
>
> $user = new User();   //assumes you've implemented the User class
> $is_logged_in = $user->authenticate();
> if (!$is_logged_in)   {
>   header('location: login.php');
>   exit;
> }
>
> more of a static library approach:
>
> if (!User::is_logged_in())    {
>   header('location: login.php');
>   exit;
> }
>
> Obviously these are very basic examples, and you could encapsulate things
> any way you want. The decision should be made based on the application
> architecture you're using overall. By having your "check" on the page the
> user is trying to get to (rather than sending them somewhere else first and
> redirecting, you minimize redirection, and can use the same process
> everywhere you need in the application.
>
> Hope this helps!
> Randy Moller
>
>


-- 
Nathan Lane
Home, http://www.nathandelane.com
Blog, http://nathandelane.blogspot.com

_______________________________________________

UPHPU mailing list
[email protected]
http://uphpu.org/mailman/listinfo/uphpu
IRC: #uphpu on irc.freenode.net

Reply via email to