Reply to Re: An elegant way to handle user-level assignable features?

Your name:

Reply:


Posted by J.O. Aho on 12/29/05 02:46

Curtis wrote:

> I'm looking for an elegant way for the calling software to:
>
> a. inform our program of how many and what designation of
> usertypes are desired;

A database is an excellent tool for this and you could have

table1: UserTypes(TypeID, TypeName) [Primary Key: TypeID]
table2: Feature(FeatureID, FeatureName, ScriptFile) [Primary Key: FeatureID]
table3: FeatureForType(FeatureID,TypeID) [Primary Key: FeatureID + TypeID]


> b. say which features are assigned to which usertypes;

That is done in table3.


> c. for our software to cleanly test for what's what:

As you will be storing username/logins somewhere, you can then store the
TypeID in that place too that the user in question has. Here you have a bit of
options how you make this value easy to access, one way is to store this in a
session.

You can use a $_SERVER['PHP_SELF'] to see which file you are accessing, then
you can join table 2 and 3, looking for matching ScriptFile and compare if
TypeID that you get from the SQL query matches with the current users TypeID,
if not, then redirect with a nice header() them to another page.



//Aho

[Back to original 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

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