|
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]
|