You are here: Re: Suggestion for handling pages requiring redirect using Config File « PHP Programming Language « IT news, forums, messages
Re: Suggestion for handling pages requiring redirect using Config File

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация