This topic is locked
[SOLVED]

 Security / Permissions - How let a user choose if his en

5/4/2011 2:31:35 PM
PHPRunner General questions
M
mickna author

Hi there,
sitting here since hours to learn PM and also sql....

But now I stuck with following problem:

  • I have several Users who can make their own entries to their very own database (e.g. telephone book)
    Now I want to enable the users to choose by them self, if their phone book is public, or not. Best choice would be "Non public / private", "public only for users", "public for all"
    Anyone who can show me the right direction for this?
    Thanks,

    mickna

Sergey Kornilov admin 5/4/2011

Add a yes/no field named 'public' to your database.
Then use approach defined in 'Dynamic SQL Query' article to pull records that are either public or belong to the current user:



$strWhereClause = whereAdd($strWhereClause, " public=1 or UserID='".$_SESSION["UserID"]."'");


You can extend this approach making public field store more values i.e. 0-private, 1-visible to users, 2-visible to everyone etc)

M
mickna author 5/5/2011

Great! Thank you.