This topic is locked

Load Database based on username

8/14/2008 8:51:44 AM
PHPRunner General questions
G
GhOsT author

Hey , i searched and ddint find anything , so im sorry if this questio has been asnwered before.
my page displays Rows , From a table.
I have set up Username and passwords but my problem is , i need a way that will auto assign privleges just based on entries and tables.
I have though of this idea.
MAke the user log in at the front of the website and check if account is valid , if it is Load the Table.
can i set the Table to the {$userid} variable?? and if so how do i do it
also , is there a way to se it that only a user with the username can only view their corresponding table.
Eg.
Tables----

  • Perm ( TABLE WITH USERNAMES AND PASSWORDS)
  • User 1
  • User 2
  • User 3
    I want user 1 to view his table only and no1 elses.
    also i need this to do it auto based on Rows in Perm table and Tables in the database this is because because it will be Dealing with around a thousand Users.
    Thank You so much for reading and Thank you in advanced.
    Yours GhOsT

T
thesofa 8/14/2008

Hey , i searched and ddint find anything , so im sorry if this questio has been asnwered before.

my page displays Rows , From a table.
I have set up Username and passwords but my problem is , i need a way that will auto assign privleges just based on entries and tables.
I have though of this idea.
MAke the user log in at the front of the website and check if account is valid , if it is Load the Table.
can i set the Table to the {$userid} variable?? and if so how do i do it
also , is there a way to se it that only a user with the username can only view their corresponding table.
Eg.
Tables----

  • Perm ( TABLE WITH USERNAMES AND PASSWORDS)
  • User 1
  • User 2
  • User 3
    I want user 1 to view his table only and no1 elses.
    also i need this to do it auto based on Rows in Perm table and Tables in the database this is because because it will be Dealing with around a thousand Users.
    Thank You so much for reading and Thank you in advanced.
    Yours GhOsT



you can do this by having all the detail in one big table, having a field of Owner_id in the detail table and adding a new field of ID_Owner in the perm table, set this to autonumber so each new user added gets a number assigned; and using the Advanced tab in the Security section, set the middle option so users can see and edit their own data only, in the Users table:OwnerID field drop down select the new field you added, ID_Owner and in the Main Table, Owner ID field, select the Owner_id field.

Then when users log in, they can only see and alter their own data, all from one table, without any extra codding on your part, also, when you add a new user, you do not have to add a new table for them, their data goes in the same table as eveyone else.

Neat Innit?

J
Jane 8/15/2008

Hi,
I recommend you to have a look at the User group permissions dialog on the Security tab:

http://www.xlinesoft.com/phprunner/docs/us...permissions.htm

G
GhOsT author 8/15/2008

TY Thesofa and Jane , i can always count on u 2
ill give it a try and post bak results incase sum1 else might want dis l8r
Thank you agen
GhOsT

G
GhOsT author 8/16/2008

Hey Guys.
i tried both ways and here is the outcome
TheSofa , ur method was great , however its a must that each user hav a seperat table , this is because there are 8 rows in each table and adding 2000 in one table that is 16000 rows , dats scary , lol . but however if i do something with 1 row per user , thenyour method is great.
Jane , i looked in the permisions tab and similar rule applies. also , this wil require me to re generate a new site each time ill add people. unfortanelty , i cant do that.
i believe that adding the {$userid} variable to the sql command to grab the users rows , is the best way and the easiest.
however i dont know wat file to start on.
Any help is appreciated
Thankyou

GhOST
EDIT: it dosnt have to be the username , all i wnt is a way to load up the users table based on anything (possibly user ID) in In that case the table perm will have a field calld 'ID' and the Tables for the users will be cald the user's id,
Eg,
'Me' with a ID of 1 gets table '1'

'Bill' with a ID of 2 gets table '2'

and

'Joey' with ID field of 1278 gets tabel '1278'
Ty agen

J
Jane 8/18/2008

Hi,
please have a look at the Dynamic permissions option on the User group permissions dialog on the Security tab.

All dynamic permissions settings are stored in the database and you can change it on the web site.