Jump to content

What's Best Way To Do This?


phprocker

Recommended Posts

Hey all.  I have a script that checks if a user is an admin and then allows that person to change certain page layouts and other things.

 

My question is, of the following 2 examples, which is best way to check if the user is an admin.

 

1st example:

Should I have just a session that is set if the user is an admin and then have the pages displayed if he/she is?

 

or

 

2nd example:

Should I have each and every single admin query/request check if the user is an admin or not?

 

What's the proper method?

 

Cheers!

Link to comment
https://forums.phpfreaks.com/topic/217320-whats-best-way-to-do-this/
Share on other sites

To make things simple, many people will create an admin area to do all the major administration tasks.  One each page, when checking for the session, also check to see if the user has admin status.

 

It would be unwise to allow regular users to see admin tools and functions, only to have them be denied access when executing the script.  Just deny them access altogether by not letting them see the admin features in the first place.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.