Welcome Guest, Not a member yet? Register   Sign In
CMS Login Help

[eluser]Drew Barontini[/eluser]
Alright, please go easy on me because of my newbie status with CI. I am creating a user login using just a name and password field. The username and password to login has been inserted manually into the database. I have created the controller, but I need some direction in creating the model to query the database, find out if the username and password are correct, and allow me to proceed to login to the admin_home view that I have yet to create, but we'll call it that for now.

Here is the controller thus far. It just has a success page if you satisfy the requirements, and the model I am trying to figure out how to create it.


class Login extends Controller {
    function index()
        $this->load->helper(array('form', 'url'));
        $rules['username']    = "trim|required|min_length[5]|max_length[12]|xss_clean";
        $rules['password']    = "trim|required|min_length[6]|md5";
        $fields['username'] = 'Username';
        $fields['password'] = 'Password';

        if ($this->validation->run() == FALSE)

This may very well all be wrong. Will I create the model to query the database and check to see if the username and password match, and then replace the login_success view call in the else statement with a $this->load->model('admin/home/home_view');?

If anyone could help me out and give me some direction that would be tremendous. Also, are sessions a must even if it's just a login for myself on my own site? If so, where would I incorporate the sessions. If this is too much, just giving some general direction would be great. I should be able to figure it out. My issue is knowing where to put everything.

Thanks in advance and I apologize for the pathetic code Confusedhut:

Messages In This Thread
CMS Login Help - by El Forum - 05-19-2008, 09:59 PM
CMS Login Help - by El Forum - 05-20-2008, 12:55 AM
CMS Login Help - by El Forum - 05-20-2008, 08:02 AM

Theme © iAndrew 2016 - Forum software by © MyBB