| Server IP : 127.0.0.1 / Your IP : 192.168.99.1 Web Server : Apache/2.4.35 (Win64) OpenSSL/1.1.1b mod_fcgid/2.3.9 System : Windows NT WIN-JEJMB9EN0L0 10.0 build 14393 (Windows Server 2016) AMD64 User : Administrator ( 0) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /laragon/www/perpus/application/models/ |
Upload File : |
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Perpus_model extends CI_Model {
//query login
public function getLoginData($usr,$psw)
{
//khusus PHP deprecated
$u = $usr;
$p = md5($psw);
$q_cek_login = $this->db->get_where('tb_login', array('username' => $u, 'password' => $p));
if(count($q_cek_login->result())>0)
{
foreach($q_cek_login->result() as $qck)
{
if($qck->stts=='petugas')
{
$sess_data['logged_in'] = 'yes';
$sess_data['stts'] = 'petugas';
$sess_data['username']=$u;
$this->session->set_userdata($sess_data);
header('location:'.base_url().'petugas/home');
}
else if($qck->stts=='admin')
{
$sess_data['logged_in'] = 'yes';
$sess_data['stts'] = 'admin';
$sess_data['username']=$u;
$this->session->set_userdata($sess_data);
header('location:'.base_url().'admin/home');
}
}
}
else
{
header('location:'.base_url().'web/log');
}
}
}
/* End of file Perpus_model.php */
/* Location: ./application/models/Perpus_model.php */