php - codeigniter-unable to load view file -


i have created simple login application form using codeigniter. problem login_view file not loaded when access in browser.

login view: (application/views/login_view.php)

    <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml">  <head>    <title>simple login codeigniter</title>  </head>  <body>    <h1>simple login codeigniter</h1>    <?php echo validation_errors(); ?>    <?php echo form_open('verifylogin'); ?>      <label for="username">username:</label>      <input type="text" size="20" id="username" name="username"/>      <br/>      <label for="password">password:</label>      <input type="password" size="20" id="passowrd" name="password"/>      <br/>      <input type="submit" value="login"/>    </form>  </body> </html> 

login controller (application/controllers/login.php)

<?php if ( ! defined('basepath')) exit('no direct script access allowed');  class login extends ci_controller {   function __construct()  {    parent::__construct();  }   function index()  {    $this->load->helper(array('form'));    $this->load->view('login_view');  }  }  ?> 

verifylogin controller (application/controllers/verifylogin.php)

class verifylogin extends ci_controller {   function __construct()  {    parent::__construct();    $this->load->model('user','',true);  }   function index()  {    //this method have credentials validation    $this->load->library('form_validation');     $this->form_validation->set_rules('username', 'username', 'trim|required|xss_clean');    $this->form_validation->set_rules('password', 'password', 'trim|required|xss_clean|callback_check_database');     if($this->form_validation->run() == false)    {      //field validation failed.  user redirected login page      $this->load->view('login_view');    }    else    {      //go private area      redirect('home', 'refresh');    }   }   function check_database($password)  {    //field validation succeeded.  validate against database    $username = $this->input->post('username');     //query database    $result = $this->user->login($username, $password);     if($result)    {      $sess_array = array();      foreach($result $row)      {        $sess_array = array(          'id' => $row->id,          'username' => $row->username        );        $this->session->set_userdata('logged_in', $sess_array);      }      return true;    }    else    {      $this->form_validation->set_message('check_database', 'invalid username or password');      return false;    }  } } ?> 


Comments