Jump to content

new to oop: user management class - advice wanted


wrathican

Recommended Posts

hey guys im relativley new to oop.

i have read all three parts of the oop tutorials here on phpfreaks, a few times.

what i want is something to create to practice oop.

 

so i thought the best way would be to recreate something i already have in place, a user management system.

my system is all written proceduraly and it has most things i think a basic system need.

 

it already features user registration, activation, administration(deletion, activation, password change, promote, demote), user hierarchy, login, log out, password and profile management.

i use mysql databases to store the data.

 

so, i guess i would need a class to do the database stuff and a user class.

writing classes isnt that much different to just creating functions/methods. so i guess that would be easier than i thought.

 

what i see as my problem is using the classes to actually log users in and do all the stuff i would want them to do.

 

has anyone seen a tutorial on this subject in particular? or could offer me some advice?

 

thanks.

See, you wouldn't just use a database class and a user class....there's no way to implement code correctly with enough separation that way.  You'd probably need many classes for this.  First of all, for users, I'd probably make a few classes that all extend a User abstract class or an interface and all can be handled the same, but have different logic for figuring things out, i.e admins, users, mods, etc, then a factory method for getting the correct object based on certain criteria (a level indicator in the database, maybe).  But that's just how I'd probably do it.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.