<?php
class User extends CI_Controller
{
public function __construct()
{
parent::__construct();
$this->load->database();
$this->load->helper('url');
}
public function login()
{
if($this->input->post('login'))
{
$email=$this->input->post('u_name');
$password=$this->input->post('u_pass');

$que=$this->db->query("select * from users where UserName='$email' and Password='$password'");
$row = $que->num_rows();
if(count($row)>0)
{
redirect('User/dashboard');
}
else
{
$data['error']="<h3 style='color:red'>Invalid userid or password !</h3>";
}
}
$this->load->view('login_page',@$data);
}
function dashboard()
{
$this->load->view('hello_world');
}
}
?>