Doubt with PHP login and access level

Asked

Viewed 57 times

3

Well I have a question and I wanted the opinion of more experienced people.

I have a PHP system that uses Mysql. I have a table called 'access' where I save the options that the user has to access the system. The problem is that every time I load the page I have to select in the BD.

I want to improve the performance of the system, and I have taken several steps towards it. And one of them is to try to decrease the 'select''.

Well let’s have a doubt, what I want to know is: 1- Is that the best way to do it? 2- Would it be easier to save user permissions in the session to avoid select? 3- Session reading and faster than select in BD?

Well, I’m waiting for help with a good solution.

  • What information do you search for in the selection? And how often they are changed?

  • Well they are rarely changed, as they are saved when the user is registered. Well it is a table that is called 'access', and counts about 40 fields. Example: the fields 'edit product' in it I saved’s' or 'n'. With this I know if the user can edit the products.

  • 1

    Sorry for the delay, but I’ve seen that @Italorodrigo has given a good answer! + 1 for you and the answer.

1 answer

3


1- This is the best way to do this?

No, because every time you access the database, you lose time.

2-It would be easier to save the user permissions in the session, to avoid select?

Yes, this is the best solution in my opinion (there may be others), so you will not have to consult the bank each time you open the page.

3- Session reading and faster than select in BD?

Yes

  • I use ssl certificate, and it is possible that someone changes the session data or has access to it?

Browser other questions tagged

You are not signed in. Login or sign up in order to post.