1
일부 파일을 사용하고이 파일을 알아 내려고 시도한 후에도 여전히 어딘가에 문제가 있습니다. 그 말은 내 로그인 시도가 지정된 모델을 찾을 수 없습니다. 나는 탱크 도서관에 대한 내 자신의 것을 모델링하고있다. 필자가 필요로하는 코딩 아이디어를 사용하고 있습니다.파일을 찾을 수 없습니다.
라이브러리/Kow_auth.php
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
/**
* KOW Auth Library
* Authentication Library for Code Igniter
* @author Jeffrey Davidson
* @version 1.0.0
* @copyright 2012
*/
class Kow_auth
{
protected $CI;
function __construct()
{
//assign the CI superglobal to $CI
$this->CI =& get_instance();
}
function is_max_login_attempts_exceeded($user_id)
{
$this->CI->load->model('kow_auth/login_attempts');
return $this->CI->login_attempts->get_attempts_num($user_id) >= 5;
}
}
?>
모델/Kow_auth가/login_attempts
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
/**
* Login_attempts
*
* This model serves to watch on all attempts to login on the site
* (to protect the site from brute-force attack to user database)
*
* @package Kow_auth
* @author Jeffrey Davidson
*/
class Login_attempts extends CI_Model
{
function __construct()
{
parent::__construct();
}
function get_attempts_num($user_id)
{
$this->db->select('failed_attempts');
$this->db->where('user_id', $user_id);
$query = $this->db->get('users_logins');
if ($query->num_rows() > 0)
{
$row = $query->row();
return $row->failed_attempts;
}
else
{
return false;
}
}
}