Copy link to clipboard
Copied
Hey guys,
I am quite new to PHP and MySQL and I have a question concerning access restriction. For a website project I am experimenting with Dreamweaver's login and restrict access behavior, which works fine. However, on the website I would like to restrict access for users that only have a 1 set in the corresponding MySQL database (which means that e.g. each page has a different variable in the database that can be set to 1, which would allow me to personify access beyond the level of the out-of-the box option, where each user can only have one access level). So it is quite similiar to the out-of-the-box restrict access to page based on user group, but just depending on another variable in the database.
I guess it can be done with an if condition that checks in the database if the logged in user has a 1 in this variable, and if yes give her/him access if not redirect to another page. However, I could not figure out how to implement that.
Your help is highly appreciated!
Thanks in advance!
Copy link to clipboard
Copied
Hello guys,
I spend quite some time on the internet reseaching my wish and redefined my need: I would basically like to have the possibility to assign a user multiple access levels. There would be e.g. 10 pages for each I create an access level. Then a user with e.g. access to pages 2 and 8 can only access these two pages. So my basic question is if and if yes how I can assign a user muliple access levels at a time and store these values in the MySQL database.
Thanks a lot for your help!!
Copy link to clipboard
Copied
If your access levels are indeed discreet, with no hierarchical relationships, then you need to store a flag for each level that the user has. I would probably create an access level table for this, storing one row for each user/level combination.
Another way...
I usually don't recommend using the MySQL set datatype, but it's probably fine for this application. PHP has functions for accessing values in SET data types.
Copy link to clipboard
Copied
Hello bregent, thanks a lot for your answer. I tried to do it with the SET datatype and I gave my testing user 3 access levels: page1, page2, page3. However if I restrict access in Dreamweaver to page2 and/or page3 the access is rejected. It only works with page1... Do I need to change sth. in Dreamweaver's standart restrict access to page behavior?
Thanks in advance!
Copy link to clipboard
Copied
Hello bregent, thanks a lot for your answer. I tried to do it with the SET datatype and I gave my testing user 3 access levels: page1, page2, page3. However if I restrict access in Dreamweaver to page2 and/or page3 the access is rejected. It only works with page1... Do I need to change sth. in Dreamweaver's standart restrict access to page behavior?
Thanks in advance!
Copy link to clipboard
Copied
Yes, you will need to modify the DW server behavior. As far as I know, it doesn't natively handle multiple levels per user.
Copy link to clipboard
Copied
Hello bregent! Thanks for your answer. I tried to find tutorials on how to modify the native DW behavior that it can handle muliple access levels per user. Unfortunately I was not very successful. Can you maybe help me out here? Help is highly appreciated!! Thx!
Copy link to clipboard
Copied
Sorry, I'm a VBScript guy and don't know enough about PHP to give coding advice. You may want to start a new thread with a more specific topic.
Copy link to clipboard
Copied
Ok, thanks a lot for your help! I will follow your advice and open a new thread.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now