39 lines
1.4 KiB
PHP
39 lines
1.4 KiB
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->where('mu_nama_user', $username);
|
|
$this->db->where('mu_password', $password);
|
|
$query = $this->db->get('master_user');
|
|
if($query->num_rows() == 1)
|
|
{
|
|
if (date('H') < 7) {
|
|
//-----------------start untuk cek jam shift, jam shift, dan aktif klinik------------------//
|
|
$this->load->model('m_anjungan');
|
|
$info_pengunjung = $this->m_anjungan->cek_shift_jam();
|
|
|
|
$this->load->model('m_anjungan');
|
|
$cekanjungan = $this->m_anjungan->cekanjungan();
|
|
//-----------------end untuk cek jam shift, jam shift, dan aktif klinik------------------//
|
|
}
|
|
|
|
$row = $query->row();
|
|
$data = array(
|
|
's_ID_User' => $row->mu_id,
|
|
's_NamaUser_User' => $row->mu_nama_user,
|
|
's_FK_TipeUser' => $row->mu_tipeuser_id,
|
|
's_loket' => $row->mu_loket_id,
|
|
's_klinik' => $row->mu_klinik_id,
|
|
'validated' => true
|
|
);
|
|
$this->session->set_userdata($data);
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
}
|
|
?>
|