470,864 Members | 1,997 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,864 developers. It's quick & easy.

Program design help

I'm making a site that I'm having trouble wrapping my head around...it
makes sense in my head but I can't seem to figure out the best way to
code it.

Basically, there are different users levels...
beta, free, paid, etc...
and there are different user types
example: gamer, programmer, dog... etc
but each user has his own set of "objects" he can use...for example a
dog would have his bones, collar, etc
a gamer would have his PC, photos, videos etc... a programmer would
have his favorite projects, his current projects, his ideas, and to do
lists etc

and they can pay for new "objects" or "features" basically, I need to
figure out how to keep track of all this in the most optimized way as
possible... here's an example
User level: paid
User type: programmer
because he's a paying user, he gets all the objects for his user type,
make sense? so we need to then ON his "control panel" let him see the
objects he has since he's paid so like in a 3 column layout... blocks
on left and right and then a center column with.. whatever..so example
blocks would be, projects, blog...etc I hope this makes sense. any help
is much appreciated.

May 10 '06 #1
3 1070

bryan wrote:
I'm making a site that I'm having trouble wrapping my head around...it
makes sense in my head but I can't seem to figure out the best way to
code it.

Basically, there are different users levels...
beta, free, paid, etc...
and there are different user types
example: gamer, programmer, dog... etc
but each user has his own set of "objects" he can use...for example a
dog would have his bones, collar, etc
a gamer would have his PC, photos, videos etc... a programmer would
have his favorite projects, his current projects, his ideas, and to do
lists etc

and they can pay for new "objects" or "features" basically, I need to
figure out how to keep track of all this in the most optimized way as
possible... here's an example
User level: paid
User type: programmer
because he's a paying user, he gets all the objects for his user type,
make sense? so we need to then ON his "control panel" let him see the
objects he has since he's paid so like in a 3 column layout... blocks
on left and right and then a center column with.. whatever..so example
blocks would be, projects, blog...etc I hope this makes sense. any help
is much appreciated.


create three session variables

UserType
UserLevel

lets say that UserTyoe=1 is dog

If UserType=1 Then
give access to all dog objects
end if

Now to solve the type and level hieracrhy

If UserLevel=1 then
Case UserType
1: give access to all dog objects
2: give access to all gamer objects
......
End Case
elseif UserType=2 Then
Case UserType
1: give access to all dog objects
2: give access to all gamer objects
......
End Case
.....

and so on
Hope this helps
Zafar
--------------------------------------------------------------
http://www.vbuniverse.com

May 11 '06 #2
Yeah, help a little. THanks.

May 11 '06 #3

bryan wrote:
I'm making a site that I'm having trouble wrapping my head around...it
makes sense in my head but I can't seem to figure out the best way to
code it.

Basically, there are different users levels...
beta, free, paid, etc...
and there are different user types
example: gamer, programmer, dog... etc
but each user has his own set of "objects" he can use...for example a
dog would have his bones, collar, etc
a gamer would have his PC, photos, videos etc... a programmer would
have his favorite projects, his current projects, his ideas, and to do
lists etc

and they can pay for new "objects" or "features" basically, I need to
figure out how to keep track of all this in the most optimized way as
possible... here's an example
User level: paid
User type: programmer
because he's a paying user, he gets all the objects for his user type,
make sense? so we need to then ON his "control panel" let him see the
objects he has since he's paid so like in a 3 column layout... blocks
on left and right and then a center column with.. whatever..so example
blocks would be, projects, blog...etc I hope this makes sense. any help
is much appreciated.

The perfect place to use polymorphism. ;o)

Identify common properties for you users, e.g.

class user
{
var username;
var password;
}

then extend it for each user.

class programmer extends user
{
var favoriteLanguage;
}

class gamer extends user
{
var favoriteGame;
}

class dog extends user
{
var favoriteBone;
}
// store what kind of user they are in the database and at the top of
each page, instatiate that type. Actually, I'd create a "static" method
on user that returns the correct type.

e.g.
$currentUser = user::getUser($dbUserType); // get user return type of
dog, or whatever

Away you go.

Hope that helps.

May 11 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

33 posts views Thread by Nick Evans | last post: by
29 posts views Thread by 63q2o4i02 | last post: by
23 posts views Thread by JoeC | last post: by
6 posts views Thread by phkram | last post: by
1 post views Thread by Readon Shaw | last post: by
Banfa
2 posts views Thread by Banfa | last post: by
5 posts views Thread by istillshine | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.