Welcome Guest, Not a member yet? Register   Sign In
Login
#8

[eluser]davy_yg[/eluser]
I place the form_submit() after the form_close() and change form_open('admin/clogin/process');

Now, after I login it starts to bring me to this url:

http://localhost/IndonusaCI/index.php?ad...in/process

Not the admin page.

I try typing this url: http://localhost/IndonusaCI/index.php/ad...in/process


A PHP Error was encountered

Severity: Notice

Message: Undefined property: Clogin::$db

Filename: core/Model.php

Line Number: 51

Fatal error: Call to a member function where() on a non-object in C:\xampp\htdocs\IndonusaCI\application\models\login_model.php on line 19

line 19: $this->db->where('username', $username);

models\login_model.php

Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/* Author: Jorge Torres
* Description: Login model class
*/
class Login_model extends CI_Model{
    function __construct(){
        parent::__construct();
    }
    
    public function validate(){
        // grab user input
  
  $username = $this->input->post('username', TRUE);  
  $password = $this->input->post('password', TRUE);  
    
        // Prep the query
        $this->db->get_where('username', $username);
        $this->db->get_where('password', $password);
        
        // Run the query
        $query = $this->db->get('username');
        // Let's check if there are any results
        if($query->num_rows() == 1)
        {
            // If there is a user, then create session data
            $row = $query->row();
            $data = array(
                    'username' => $row->username,
     'password' => $row->password,
                    'validated' => true
                    );
            $this->session->set_userdata($data);
            return true;
        }
        // If the previous process did not validate
        // then return false.
        return false;
    }
}
?>



Messages In This Thread
Login - by El Forum - 10-23-2013, 07:43 PM
Login - by El Forum - 10-23-2013, 09:55 PM
Login - by El Forum - 10-24-2013, 01:14 AM
Login - by El Forum - 10-24-2013, 01:21 AM
Login - by El Forum - 10-24-2013, 01:32 AM
Login - by El Forum - 10-24-2013, 02:02 AM
Login - by El Forum - 10-24-2013, 07:42 AM
Login - by El Forum - 10-25-2013, 12:36 AM



Theme © iAndrew 2016 - Forum software by © MyBB