Currently Using CodeIgniter Framework i have an Error



PHP Snippet 1:

 <?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Login extends CI_Controller {
    public function __construct(){
        parent::__construct();
        //$this->load->model('User');
        $this->load->helper('form');
        $this->load->library('form_validation');
        $this->load->helper('url');
        $this->load->database();
        $this->load->model('U_Model');
    }
    public function index(){
        $this->load->view('header');
        $this->load->view('login');
        $this->load->view('footer');

    }

    /*added public before loginp*/

    public function loginp(){
        $username = $this->input->post('username');
        $password = md5($this->input->post('password'));
        /*md5 not recommended*/

        $data = $this->U_Model->loginf($username, $password);

        if( ! empty($data))
        {
            $this->session->set_userdata('sid',$data['id']);
            $this->session->set_userdata('sname',$data['name']);
            $this->session->set_userdata('username',$data['username']);
            redirect('login/home');
        }else{
            $this->session->set_flashdata('emsg','Please Enter Your Correct Name And Password');
            redirect('login/home');
        }
    }

    public function home(){
        $this->load->view('home');
    }
}?>

PHP Snippet 2:

<?php
class U_Model extends CI_Model
{
    public function loginf($username,$pass)
    {
        $this->db->where('username',$username);
        $this->db->where('password',$pass);
        $query = $this->db->get('users')
        if($query->num_rows() > 0){
            return $query->row_array();
        }else{
            return false;
        }
    }
}
?>

PHP Snippet 3:

<?php
class U_Model extends CI_Model
{
    public function loginf($username,$pass)
    {
        $this->db->where('username',$username);
        $this->db->where('password',$pass);
        $query = $this->db->get('users')
        if($query->num_rows() > 0){
            return $query->row_array();
        }else{
            return false;
        }
    }
}
?>