|
Posted by Chung Leong on 11/13/05 06:10
Greg Scharlemann wrote:
> I thought I had a workable approach to specifing which pages required a
> redirect in a config file, but it appears the way I'm attempting to do
> it is not going to work.
>
> The idea is that I can specify in the config file all of the pages that
> require a user to login otherwise the page will redirect if the user is
> not logged in.
That's not an approach I'd favor for practical reason. While you're
working in your config file, it's hard to remember exactly and fully
which pages require login and which do not. Personally I prefer to let
the page make the determination individually, as the context is clear
while you're working in it.
What I usually do is have a function like this:
function RestrictAccess() {
if(!GetUserID()) {
Redirect("login.php");
}
}
And then call it on any page that isn't public. For an application with
multi-level access, the function would take a parameter, indication
what level is required.
Navigation:
[Reply to this message]
|