| Server IP : 103.48.194.25 / Your IP : 216.73.216.74 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 : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/hocthongminh.net-bk/public_html/site/components/profile/controllers/ |
Upload File : |
<?php if (! defined('BASEPATH')) exit('No direct script access allowed');
class Dangky extends MX_Controller
{
function __construct()
{
parent::__construct();
$this->load->helper('mail') ;
$this->load->model('dangky_model','dangky');
$ses_login = get_ses_login();
if($ses_login) redirect('tong-quan');
}
function index()
{
$data['title'] = "Đăng ký thành viên - Mua bán rao vặt" ;
if(isset($_POST['bt_submit']))
{
$csrf = $this->input->post('csrf');
$ses_csrf = isset($_SESSION['ses_csrf']) ? $_SESSION['ses_csrf'] : '';
if($ses_csrf == $csrf)
{
$this->form_validation->set_rules('email','email','trim|required');
$this->form_validation->set_rules('password','Mật khẩu','trim|required');
$this->form_validation->set_rules('cfpass','Xác nhận','trim|required');
if($this->form_validation->run() == FALSE)
{
$this->session->set_flashdata('message','Vui lòng kiểm tra các thông tin được yêu cầu khi đăng ký.');
$this->pre_message = validation_errors();
}
else
{
$email = $this->input->post('email');
$rs = $this->dangky->chk_mail_exist($email);
if(empty($rs))
{
$req = $this->_build_data(1);
if($this->dangky->save("member",$req))
{
//mail to member
$link = site."kich-hoat/".$req["code"];
$cusmail = $req['lb_email'];
$cusname = $req['fullname'];
$password = $this->input->post('password');
mail_to_new_member($link,$cusmail,$cusname,$password);
$this->session->set_flashdata('message','Vui lòng kiểm tra email để kích hoạt tài khoản.');
redirect('dang-ky-thanh-cong'); exit;
}else{
$this->session->set_flashdata('message','Đăng ký không thành công. Vui lòng thử lại hoặc dùng chức năng liên hệ BQT.');
redirect('dang-ky'); exit;
}
}
else
{
$this->session->set_flashdata('message','Email đã có trong tài khoản. Nếu là email của bạn vui lòng dùng chức năng lấy lại mật khẩu.');
redirect('dang-ky'); exit;
}
}
}
}
$data['csrf'] = $_SESSION['ses_csrf'] = create_csrf();
$data['page'] = 'dangky';
$this->load->view('skin_home',$data) ;
}
private function _build_data($flag=0)
{
$req["lb_email"] = $this->input->post("email");
$req["username"] = get_username($req["lb_email"]) ;
$password = $this->input->post('password') ;
$req["password"] = md5($password) ;
$req["fullname"] = $this->input->post("fullname");
$req["address"] = $this->input->post("address");
$req["nb_phone"] = $this->input->post("nb_phone");
$req["code"] = md5($req['lb_email'].time());
$req["user_ip"] = $this->input->ip_address();
$req["nb_level"] = 1;
$req["nb_news"] = 0;
$req["is_company"] = 0;
$req["dt_modify"] = date('Y-m-d H:i:s');
if($flag) $req["dt_create"] = date('Y-m-d H:i:s');
$req["bl_active"] = 1;
return $req;
}
function action()
{
$this->index();
}
function thanhcong()
{
$data['page'] = 'thanhcong' ;
$this->load->view('layout/skin', $data);
}
public function active($key)
{
if($key) $rs = $this->dangky->mkactive($key);
if($rs)
{
//$req['code'] = '';
$req['bl_active'] = 1;
$req['is_active'] = 1;
$this->dangky->save('member',$req,'code',$key);
redirect('thanh-cong');
}
else
{
}
}
}
?>