| Server IP : 103.48.194.25 / Your IP : 216.73.217.33 Web Server : Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.4.33 System : Linux VMHostDefault 3.10.0-1160.42.2.el7.x86_64 #1 SMP Tue Sep 7 14:49:57 UTC 2021 x86_64 User : sieuthimay ( 1016) PHP Version : 8.2.20 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/khonguyenlieu.vn/public_html/webadmin/controllers/ |
Upload File : |
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Login extends CI_Controller
{
protected $_templates;
public function __construct()
{
parent::__construct();
$this->load->model('login_model','login');
}
public function index()
{
$user_name = $this->input->post('user_login');
$password = md5($this->input->post('user_pass'));
if($this->session->userdata('admin_id')){
redirect('admincp');
}
$this->form_validation->set_rules('user_login',lang('login_name'),'trim|required|callback_check_login');
$this->form_validation->set_rules('user_pass',lang('login_password'),'trim|required');
if($this->form_validation->run())
{
if($this->login->get_admin($user_name,$password))
{
$this->session->set_flashdata('message',lang('login_success'));
redirect(base_url().'index.php/admincp');
}else{
$this->session->set_flashdata('error',lang('login_unsuccess_recheck'));
}
}
$this->load->view('login/index');
}
function check_login($user_login)
{
$password= md5($this->input->post('user_pass'));
if($user_login!=''&&$password!=''){
if($this->login->check_login($user_login,$password)){
return true;
}else{
$this->form_validation->set_message('check_login',lang('login_fail_info'));
return false;
}
}
else
{
$this->form_validation->set_message('check_login',lang('login_name_pass_not_empty'));
return false;
}
}
function logout()
{
$this->session->sess_destroy();
redirect(base_url());
}
}
?>