Welcome Guest, Not a member yet? Register   Sign In
Where Store Admin Information?
#1

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...
Reply
#2

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
Reply
#3

(This post was last modified: 04-29-2016, 06:19 AM by Wouter60.)

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(); 
This will return a boolean (true or false) to check if the current user is a member of the group "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'); 
Reply




Theme © iAndrew 2016 - Forum software by © MyBB