This topic is locked

Can anyone offer advice on this please?

6/27/2006 12:01:05
PHPRunner General questions
M
mike-pt author

I need to create a database with the following functionality:

  1. Registration of New Users.

    ANYONE can register as a new user with a valid email.

    New user receives email with their user id and password.

    This user defaults to "level 1"
  2. With this access code "level 1" the user can log into their own record to view it or submit changes to only fields relating to their own contact details.
  3. After Login page - A page with complete view of user record with buttons in each section to edit
    5 Sections:

  1. Client details
  2. RK
  3. RY
  4. AL
  5. CG
    Each section above contains several fields containing data. Example Client data would be in Client details that would be editable for "Level 1" users.
    The data in the following fields is also editable on condition that the user editing is a higher level than the user in the record:
  6. RK "level number","date","otherdata","moredata"
  7. RY "level number","date","otherdata","moredata"
  8. AL "level number","date","otherdata","moredata"
  9. CG "level number","date","otherdata","moredata"
    Each user has a level number that is contained in the fields as shown above. Any user can view and edit the record of another user as long as his level is the same or higher than the record he his attempting to change.
    Example: A level 3 user can log in, locate a single record by username of a lower level user for instance a "level 1" or a "level 2" and upgrade that users level to a "level 2" or "level 3" if he has the password of the lower users account.
    Maybe I have not explained this in the best possible way but can anyone see what I am trying to achieve here and is this possible to setup with this phprunner system.
    Can anyone help or offer advice on this? Or point me in the right direction?

    I would like to build this myself if I could see how to go.
    Thanks
    Mike

Sergey Kornilov admin 6/27/2006

It sounds like you need to build PHP code using Users can see and edit their own data only security mode. Use Level number as a OwnerID field. After that modify generated files so users can see data of the same level and all levels below.
Here is the typical SQL query that pulls data that belong to current user:

select ... from TableName where LevelNumber = "Level Number from login table"


You need to modify it the following way:

select ... from TableName where LevelNumber >= "Level Number from login table"
M
mike-pt author 6/28/2006

Great that was the answer I was looking for.
I knew there would be a simple way to achieve so much, cool.
Another question:
Lets say that a "level 3" user has logged in and found the record he wants to raise from a "level 1" to a "level 2" he then chooses from a drop down list the new level and hits the save button, Then what I want is before the edit takes place I want the "level 3" user to have to enter the password of the "level 2" user so that the edit is allowed to take place and if the password is incorrect maybe a page that states this and offers another attempt.
I can see that this is going to be done by a table event and probably some custom code, this is where I need some help.
I appreciate your help.
Thank you
Mike