Where Store Admin Information? |
Hi to all developers...
I'm developing a web application. In this app, There is one Admin and maybe, maybe in the future there is another (with restricted controls). My question is: Should I create a table for admin or save the necessary admin info in a file (xml file or...)? Please mention to different aspects (like security or...) that I will encounter with these. thanks a lot...
Yes, have a database table called "users" which would have fields like "username", "password", "last_login_date"
You can then query this table when the admin user wants to login. Having the details in a database table means you can have more than one user, and in the future you can include things like permissions, logging the number of failed login attempts, etc
I recommend an authentication library for CI, like Ion Auth from Ben Edmunds. It comes with tables for users, groups and users_groups. And a lot of powerful functions in it's library.
Example: PHP Code: $this->ion_auth->is_admin(); Also, you can check if a user is member of any other group, like this: PHP Code: $employee = $this->ion_auth->in_group('employee'); |
Welcome Guest, Not a member yet? Register Sign In |