Получение фатальной ошибки: вызов неопределенного метода

Я использую CMS скрипт. Когда я пытаюсь войти в админку, я получаю сообщение об ошибке:

Неустранимая ошибка: вызов неопределенного метода Users_model :: get_user_function () в C: \ xampp \ htdocs \ app \ controllers \ administrator \ auth.php в строке 105

Строка 105 auth.php:

$query = $this->Users_model->get_user_function($login);

публичная функция login из auth.php (где ошибка, вызывающая 105 строчку):

public function login()
{
$val = $this->form_validation;
if ($this->input->post()) {
$val->set_rules("usernameli", "Username", "trim|required|xss_clean");
$val->set_rules("passwordli", "Password", "trim|required|xss_clean");
$val->set_rules("remember", "Remember me", "integer");
if ($this->form_validation->run()) {
if ($this->config->item("DX_login_using_username") && $this->config->item("DX_login_using_email")) {
$get_user_function = "get_login";
} else {
if ($this->config->item("DX_login_using_email")) {
$get_user_function = "get_user_by_email";
} else {
$get_user_function = "get_user_by_username";
}
}
$query = $this->Users_model->get_user_function($login);
if ($query && $query->num_rows() == 1) {
$row = $val;
if ($row->banned > 0) {
$this->session->set_flashdata("flash_message", $this->Common_model->admin_flash_message("error", "Login failed! you are banned"));
redirect_admin("login", "refresh");
} else {
$password    = $this->dx_auth->_encode($password);
$stored_hash = $row->password;
if (crypt($password, $stored_hash) === $stored_hash) {
$this->dx_auth->_set_session($row, "ALLOW");
if ($row->newpass) {
$this->users->clear_newpass($row->id);
}
if ($remember) {
$this->dx_auth->_create_autologin($row->id);
}
$this->dx_auth->_set_last_ip_and_last_login($row->id);
$this->dx_auth->_clear_login_attempts();
$this->dx_auth_event->user_logged_in($row->id);
$this->session->set_flashdata("flash_message", $this->Common_model->admin_flash_message("success", "Logged in successfully."));
redirect_admin("", "refresh");
} else {
$this->session->set_flashdata("flash_message", $this->Common_model->admin_flash_message("error", "Login failed! Incorrect username or password"));
redirect_admin("login", "refresh");
}
}
} else {
$this->session->set_flashdata("flash_message", $this->Common_model->admin_flash_message("error", "Login failed! Incorrect username or password"));
redirect_admin("login", "refresh");
}
}
}
$data['message_element'] = "administrator/view_login";
$data['auth_message']    = "You are already logged in.";
$this->load->view("administrator/admin_template", $data);
}

Часть users_model.php:

/*function get_user_by_username($username)
{
$this->db->where('username', $username);
return $this->db->get($this->_table);
}*/
function get_user_by_username($username)
{
$this->db->where('username', $username);
return $this->db->get($this->_table);
}
function get_user_by_email($email)
{
$this->db->where('email', $email);
return $this->db->get($this->_table);
}

function get_login($login)
{
$this->db->where('username', $login);
$this->db->or_where('email', $login);
return $this->db->get($this->_table);
}

function check_ban($user_id)
{
$this->db->select('1', FALSE);
$this->db->where('id', $user_id);
$this->db->where('banned', '1');
return $this->db->get($this->_table);
}

function check_username($username)
{
$this->db->select('1', FALSE);
$this->db->where('LOWER(username)=', strtolower($username));
return $this->db->get($this->_table);
}

-3

Решение

Вы выполняете функцию get_user_function вместо использования переменной $get_user_function,

Изменить:

$query = $this->Users_model->get_user_function($login);

В:

$query = $this->Users_model->$get_user_function($login);

0

Другие решения

Других решений пока нет …

По вопросам рекламы [email protected]