Authentication by email and group/access level - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Authentication by email and group/access level (/showthread.php?tid=23540) |
Authentication by email and group/access level - El Forum - 10-14-2009 [eluser]doubleplusgood[/eluser] Hi there, I have built and admin controller and would like the is_valid_user function to check the email address and also check that that user has a particular group/access level. My login and is_valid_user functions are as follows; Code: function login() I attempted the following query to check the email and groupid (access level); Code: $sql = "SELECT * FROM users WHERE email = ? AND groupid = ?"; I wondered if anyone had any ideas on how to get this working? Thank you. Authentication by email and group/access level - El Forum - 10-14-2009 [eluser]davidbehler[/eluser] Either do this Code: $sql = "SELECT * FROM users WHERE email = ? AND groupid = ? LIMIT 0,1"; Code: $this->db->where('email', $email); Authentication by email and group/access level - El Forum - 10-14-2009 [eluser]doubleplusgood[/eluser] Thanks man. Looks like I need to do some additional check as my site still lets me log in to the admin area even though my group isn't 5. This is my Admin controller for logging in. So in theory, if i'm logging in as a user with groupid of 4, then it should redirect me to the admin/index view. Code: <?php |