| 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 Dangnhap extends MX_Controller
{
function __construct()
{
parent::__construct();
$this->load->model('dangnhap_model','dangnhap');
$ses_login = get_ses_login();
if($ses_login) redirect('tong-quan');
}
function index()
{
if(isset($_POST['bt_submit']))
{
$csrf = $this->input->post('csrf');
$ses_csrf = isset($_SESSION['ses_csrf']) ? $_SESSION['ses_csrf'] : '';
if($ses_csrf == $csrf)
{
$user = $this->input->post('u_mail');
$pass = $this->input->post('u_pass');
$remenber = $this->input->post('u_remenber');
$user_ip = $this->input->ip_address();
$rs = $this->dangnhap->user_login($user);
if(!empty($rs) && ($rs->password==md5($pass)))
{
$_SESSION['ses_login'] = $this->dangnhap->mapinfo($rs);
$user_ip = $rs->user_ip .','.$user_ip ;
$user_ip = rm_duplicate($user_ip,",");
$this->dangnhap->last_login($rs->member_id,$user_ip) ;
redirect("thong-tin-thanh-vien"); exit;
}
else
{
$this->session->set_flashdata('message','Mật khẩu không đúng. Vui lòng thử lại.');
redirect("dang-nhap"); exit;
}
}
else
{
$this->session->set_flashdata('message','Vui lòng nhập mật khẩu và mã bảo vệ.');
redirect("dang-nhap"); exit;
}
}
$data['title'] = "Đăng nhập đăng tin mua bán rao vặt - Zoraovat.com" ;
$data['csrf'] = $_SESSION['ses_csrf'] = create_csrf();
$data['page'] = 'dangnhap';
$this->load->view('skin',$data) ;
}
public function captcha()
{
$md5_hash = md5(rand(0,999));
$security_code = substr($md5_hash, 15, 5);
$_SESSION["security_code"] = $security_code;
//$this->session->set_userdata(array('security_code'=>$security_code)) ;
$width = 100;
$height = 28;
$image = imagecreate($width, $height) or die("Cannot Initialize new GD image stream");
$white = imagecolorallocate($image, 255, 255, 255);
$black = imagecolorallocate($image, 0, 0, 0);
imagefill($image, 0, 0, $black);
imagestring($image, 10, 28, 6, $security_code, $white);
header('Content-Type: image/jpeg');
imagejpeg($image);
imagedestroy($image);
}
function action()
{
$this->index();
}
//xử lý thông tin từ ajax =>popup
function login()
{
$this->index();
}
function mapinfo($rs)
{
$user = new stdClass();
$user->mid = $rs->member_id;
$user->username = $rs->username;
$user->fullname = $rs->fullname;
$user->address = $rs->address;
$user->phone = $rs->nb_phone;
$user->image = $rs->lb_image;
$user->yahoo = $rs->lb_yahoo;
$user->skype = $rs->lb_skype;
$user->msn = $rs->lb_msn;
$user->facebook = $rs->lb_fbook;
$user->email = $rs->lb_email;
$user->website = $rs->lb_website;
$user->gender = $rs->gender;
$user->last_login = date('Y-m-d');
$user->ip = $rs->user_ip;
$user->level = $rs->nb_level;
$user->nb_news = $rs->nb_news;
$user->town = $rs->town_id;
return $user;
}
/*function facebook_login()
{
$id = $this->input->post('id');
$name = $this->input->post('name');
$email = $this->input->post('email');
$link = $this->input->post('link');
$gender = $this->input->post('gender');
$birthday = $this->input->post('birthday');
//validate
$email = $email? $email : $id."@facebook.com";
$name = $name? $name : $id ;
$link = $link? $link : "https://www.facebook.com/".$id ;
$gender = $gender? $gender : "";
$birthday = $birthday? $birthday : "";
if($id)
{
$rs = $this->dangnhap->add_fb_user($id,$email,$name,$link,$gender,$birthday);
//set login
$_SESSION['ses_login'] = $this->dangnhap->mapinfo($rs);
$user_ip = $this->input->ip_address();
$user_ip = $rs->user_ip .','.$user_ip ;
$user_ip = rm_duplicate($user_ip,",");
$this->dangnhap->last_login($rs->member_id,$user_ip) ;
$res['code'] = 1 ;
$res['msg'] = 'Login successful' ;
echo json_encode($res) ;
}
else
{
$res['code'] = 0 ;
$res['msg'] = 'Login false' ;
echo json_encode($res) ;
}
}
function get_login()
{
$ses_login = get_ses_login();
if($ses_login){
$data['username'] = $ses_login->username ;
$this->load->view('user_info',$data);
}else{
$this->load->view('user_login');
}
}*/
function logout()
{
$_SESSION['ses_login'] = "" ;
redirect('home');
}
/*function chk_username()
{
}*/
}
?>