30 lines
1003 B
PHP
30 lines
1003 B
PHP
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
|
class M_login extends CI_Model{
|
|
function __construct(){
|
|
parent::__construct();
|
|
}
|
|
public function validate(){
|
|
$username = $this->security->xss_clean($this->input->post('username'));
|
|
$password = md5($this->security->xss_clean($this->input->post('password')));
|
|
$this->db->join('master_rolegroup', 'mr_id = mu_fk_rolegroup_id', 'LEFT');
|
|
$this->db->where('mu_username', $username);
|
|
$this->db->where('mu_password', $password);
|
|
$query = $this->db->get('master_user');
|
|
if($query->num_rows() == 1)
|
|
{
|
|
|
|
$row = $query->row();
|
|
$data = array(
|
|
's_IDUser' => $row->mu_id,
|
|
's_UserName' => $row->mu_username,
|
|
's_IDRoleGroup' => $row->mu_fk_rolegroup_id,
|
|
's_NamaRoleGroup' => $row->mr_name,
|
|
'validated' => true
|
|
);
|
|
$this->session->set_userdata($data);
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
}
|
|
?>
|