Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function __construct(){
- parent::__construct();
- $this->load->model('m_login');
- }
- function index(){
- $this->load->view('v_login');
- }
- function aksi_login(){
- $username = $this->input->post('username');
- $password = $this->input->post('password');
- $where = array(
- 'username' => $username,
- 'password' => md5($password)
- );
- $cek = $this->m_login->cek_login("admin",$where)->num_rows();
- if($cek > 0){
- $data_session = array(
- 'username' => $cek['username'],
- 'nama' => $cek['nama']
- 'status' => "login"
- );
- $this->session->set_userdata($data_session);
- redirect(base_url("admin"));
- }else{
- echo "Username dan password salah !";
- }
- }
- }
- <?php
- class M_login extends CI_Model{
- function cek_login($table,$where){
- return $this->db->get_where($table,$where);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement