| 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/nguyenlieumyphamgiasi.vn/public_html/site/controllers/ |
Upload File : |
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class dangnhap extends CI_Controller
{
protected $_templates;
function __construct()
{
parent::__construct();
$this->load->model('dangnhap_model','dangnhap');
}
function index()
{
$ses_login = get_ses_login() ; //trit($ses_login);
if(!empty($ses_login)) redirect('profile/shopping') ;
$data['title'] = 'Đăng nhập thành viên' ;
//$this->site->load('dangnhap/form_login', $data, 'login');
$data['page'] = "dangky/form_dangky" ;
$this->load->view('html/skin_login', $data);
}
function login()
{
if(isset($_POST['bt_submit']))
{
$email = $this->input->post('cusmail');
$pass = $this->input->post('cuspass');
$rs = $this->dangnhap->member_info($email); //trit($rs->cuspass.' - '.md5($pass)) ;//trit($rs) ;
if(count($rs)==1 && ($rs->cuspass==md5($pass)))
{
$_SESSION['ses_login'] = $rs;
redirect('profile/shopping');
}
else
{
redirect('dangnhap');
}
}
redirect('dangnhap');
}
function register()
{
$data['title'] = 'Đăng nhập - Đăng ký thành viên' ;
if(isset($_POST['bt_submit']))
{
$this->form_validation->set_rules('fullname','Họ tên','trim|required');
$this->form_validation->set_rules('pass','mật khẩu','trim|required');
$this->form_validation->set_rules('email','Email','trim|required');
if($this->form_validation->run() == FALSE)
{
$this->pre_message = validation_errors();
}
else
{
$req = $this->_frm_register() ;
if($this->dangnhap->register($req))
{
/*$this->load->helper('email');
$FullName = $this->input->post('fullname');
$Email = (string) $this->input->post('email') ;
$subject = 'ĐĂNG KÝ QUÀ GIÁ RẺ' ;
$message ='Chào mừng bạn <b>'.$FullName.'</b> đã đăng kí thành công .
<br/><br/>';*/
//send_email($Email, $subject, $message);
$rs=$this->dangnhap->member_info($req['cusmail']);
$_SESSION['ses_login'] = $rs;
redirect('profile');//dangnhap/thanhcong/register
}else{
redirect('dangnhap/login') ;
}
}
}
redirect('dangnhap/login') ;
}
function _frm_register()
{
$req['cusmail'] = (string) $this->input->post('email') ;
$req['cuspass'] = md5($this->input->post('pass')) ;
$req['cusname'] = (string) $this->input->post('fullname') ;
$req['address'] = (string) $this->input->post('address') ;
$req['cusphone'] = (string) $this->input->post('phone') ;
$req['dt_create'] = date('Y-m-d H:i:s');
$req['dt_create'] = 1 ;
return $req ;
}
function thanhcong()
{
$data['title'] = 'Đăng ký thành công' ;
$data['cont'] = 'Đăng ký thành công';
$this->site->load('dangnhap/thanhcong', $data,'login') ;
}
function account()
{
$ses_login = get_ses_login() ;
if(empty($ses_login)) redirect('dangnhap') ;
$data['title'] = 'Thông tin thành viên' ;
$this->site->load('dangnhap/account', $data,'login');
}
function lostpass()
{
$data['title'] = 'Quên mật khẩu' ;
if(isset($_POST['btnlienhe'])=='Gửi mật khẩu')
{
$this->form_validation->set_rules('cusmail','Địa chỉ email','trim|required');
if($this->form_validation->run() == FALSE)
{
$this->pre_message = validation_errors();
}
else
{
$user = $this->input->post('cusmail');
$rs = $this->dangnhap->member_info($user); //trit($rs->cuspass.' - '.md5($pass)) ;
if(count($rs)==1)
{
sendmail($name,$from,$to,$subject,$message) ;
$this->session->set_flashdata('message','Send mail successful. Please check your email and login again.');
//redirect('dangnhap/success');
}
else
{
$this->pre_message = 'Your email is not found.';
//redirect('dangnhap/lostpass');
}
}
}
$this->site->load_login('dangnhap/lostpass', $data);
}
}
?>