제 첫 CodeIgniter 스크립트를 작성 중이며 누군가 다음 스크립트를로드 할 수 없습니다. 그러나 $ 결과 = $ 결과 아래에 간다 코드를로드CodeIgniter 모델이 올바르게로드되지 않습니다.
<?php if (! defined('BASEPATH')) exit('No direct script access allowed');
class Login_Model extends CI_Model{
function __construct()
{
// Call the Model constructor
parent::__construct();
}
public function validate(){
// grab user input
$username = $this->security->xss_clean($this->input->post('username'));
$password = $this->security->xss_clean($this->input->post('password'));
// Prep the query
$this->db->where('username', $username);
$this->db->where('password', $password);
// Run the query
$query = $this->db->get('users');
// Let's check if there are any results
if($query->num_rows == 1)
{
// If there is a user, then create session data
$row = $query->row();
$data = array(
'userid' => $row->userid,
'fname' => $row->fname,
'lname' => $row->lname,
'username' => $row->username,
'validated' => true
);
$this->session->set_userdata($data);
return true;
}
// If the previous process did not validate
// then return false.
return false;
}
}
?>
내가 프로세스 기능을 확인할 수 있습니다 내 모델
public function process(){
// Load the model
$this->load->model('users/login', 'users');
// Validate the user can login
$result = $this->users->validate();
// Now we verify the result
if(!$result){
// If user did not validate, then show them login page again
$this->index();
}else{
// If user did validate,
// Send them to members area
redirect('home');
}
}
그리고 여기에 있습니다 : 여기
내 컨트롤러 파일입니다 = $ this-> users-> validate(); 나타나지 않습니다. 모델도로드 중입니다. 함수 호출을 시도하자마자 스크립트가 자체를 종료합니다.죄송합니다.이 질문에 약간의 혼란이 있으시면 죄송합니다.
감사 피터
아마 모델에서 사용하고있는 보안 라이브러리의 bcs가 발생하지만로드 할 코드가 없습니다. – tijs
이 코드를 사용하여 모델을로드합니다. $ this-> load-> model ('users/login', 'users'); 컨트롤러 섹션의 상단에 게시됩니다. 모델이로드 중일 것 같습니다. 스크립트는 $ result = $ this-> users-> validate();에 도달하면 스크립트 자체가 종료됩니다. –
'$ this-> input-> post ('some_data', TRUE);'// 두 번째 선택 매개 변수를 사용하면 XSS 필터를 통해 데이터를 실행할 수 있습니다. 두 번째 매개 변수를 부울 TRUE로 설정하면 활성화됩니다. – TigerTiger