请帮我。我试图解决它,但我的代码有什么问题?这是我第一次遇到这个错误。我真的需要帮助,拜托。
这是我得到的错误:
消息:调用 C:\xampp\htdocs\perpustakaan\application\controllers\Login.php 中未定义的方法 M_data::cek_login() 行号:32
这是我的控制器:
<?php
defined('BASEPATH') or exit('No direct script access allowed');
class Login extends CI_Controller
{
function __construct()
{
parent::__construct();
}
public function index()
{
$this->load->view('v_login');
}
public function login_aksi()
{
$username = $this->input->post('username');
$password = $this->input->post('password');
$sebagai = $this->input->post('sebagai');
$this->form_validation->set_rules('username', 'Username', 'required');
$this->form_validation->set_rules('password', 'Password', 'required');
if ($this->form_validation->run() != false) {
$where = array(
'username' => $username,
'password' => md5($password)
);
if ($sebagai == "admin") {
$cek = $this->m_data->cek_login('admin', $where)->num_rows();
$data = $this->m_data->cek_login('admin', $where)->row();
if ($cek > 0) {
$data_session = array(
'id' => $data->id,
'username' => $data->username,
'status' => 'admin_login'
);
$this->session->set_userdata($data_session);
redirect(base_url() . 'admin');
} else {
redirect(base_url() . 'login?alert=gagal');
);
$this->session->set_userdata($data_session);
redirect(base_url() . 'petugas');
} else {
redirect(base_url() . 'login?alert=gagal');
}
}
} else {
$this->load->view('v_login');
}
}
}
翻翻过去那场雪