Welcome Guest, Not a member yet? Register   Sign In
Can't Process Login?
#1

[eluser]Unknown[/eluser]
Hi everyOne,


i am new in the codeigniter and having difficulties in login. please help and guide me to out of this situation.

the problem is requested URL /igniter/login/process was not found on this server. even to show up the message is not working.

login.php
Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Login extends CI_Controller
{
function __construct()
  {
   parent:: __construct();

  }
public function index($msg = null)
{
  $data['msg'] = $msg;
  $this->load->view('login_view', $data);
}
public function process()
  {
   $this->load->model('login_model');
   $result = $this->login_model->validate();
    if($result)
     {
      $msg = '<font color=red>Invalid username and/or password.</font><br />';
      $this->index($msg);
     }
    else
     {
      redirect('home');
     }
  }

}




login_view
Code:
<!DOCTYPE html>
&lt;html lang="en"&gt;
&lt;head&gt;
&lt;meta charset="utf-8"&gt;
&lt;title&gt;Welcome to CodeIgniter&lt;/title&gt;

&lt;/head&gt;
&lt;body&gt;

    <div id='login_form'>
        &lt;form acti echo base_url();?&gt;login/process' method='post' name='process'&gt;
            <h2>User Login</h2>
            <br />            
   &lt;?php if(! is_null($msg)) echo $msg;?&gt;
  
            <label for='username'>Username</label>
            &lt;input type='text' name='username' id='username' size='25' /&gt;&lt;br />
        
            <label for='password'>Password</label>
            &lt;input type='password' name='password' id='password' size='25' /&gt;&lt;br />                            
        
            &lt;input type='Submit' value='Login' /&gt;            
        &lt;/form&gt;
    </div>
&lt;/body&gt;


&lt;/html&gt;




login_model.php
Code:
&lt;?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Login_model extends CI_Model
  {
   function __construct()
    {
     parent::__construct();
    }
   public function validate()
    {
     $username = $this->security->xss_clean($this->input->post('username'));
     $password = $this->security->xss_clean($this->input->post('password'));
    
     $this->db->where('username',$username);
     $this->db->where('password',$password);
      
      $query = $this->db->get('employee');
     if($query->num_rows == 1)
      {
       $row = $query->row();
       $data = array('id' => $row->id,
            'username' => $row->username,
            'validated' => true);
        $this->session->set_userdata($data);
        return true;
      }
      
    }
  }






Theme © iAndrew 2016 - Forum software by © MyBB