Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include('includes/tlca_world.php');
- $check = $tlca_do->load('class_check');
- $index = $tlca_do->load('class_index');
- $tlca_skin=$tlca_do->load('class_skin');
- $tlca_member=$tlca_do->load('class_member');
- $action=addslashes($_REQUEST['action']);
- $user_id=$class_member->check_login();
- $user_info=$class_member->user_info($user_id);
- if($action=='register'){
- $email=addslashes($_REQUEST['email']);
- $username=addslashes($_REQUEST['username']);
- $password=addslashes($_REQUEST['password']);
- $repassword=addslashes($_REQUEST['repassword']);
- $phong=addslashes($_REQUEST['phone']);
- if($check->check_username($username)==false){
- $info=array(
- 'thongbao'=>'Thất bại! Tài khoản phải viết liền không dấu,không chứa ký tự đặc biệt...',
- 'ok'=>0,
- 'link'=>'./register.html'
- );
- }elseif($check->check_email($email)==false){
- $info=array(
- 'thongbao'=>'Thất bại! Email không đúng định dạng...',
- 'ok'=>0,
- 'link'=>'./register.html'
- );
- }elseif(strlen($password)<6){
- $info=array(
- 'thongbao'=>'Thất bại! Mật khẩu phải dài từ 6 ký tự...',
- 'ok'=>0,
- );
- }elseif($password!==$repassword){
- $info=array(
- 'thongbao'=>'Thất bại! Xác nhận mật khẩu không khớp...',
- 'ok'=>0,
- 'link'=>'./register.html'
- );
- }else{
- $thongtin=mysql_query("SELECT * FROM user_info WHERE username='$username'");
- $total_user=mysql_num_rows($thongtin);
- if($total_user>0){
- $info=array(
- 'thongbao'=>'Thất bại! Tài khoản bạn nhập đã có trên hệ thống...',
- 'ok'=>0,
- 'link'=>'./register.html'
- );
- }else{
- $pass=md5($password);
- $date_reg=time();
- $thongtin_taikhoan=mysql_query("SELECT * FROM user_info WHERE email='$email'");
- $total_taikhoan=mysql_num_rows($thongtin_taikhoan);
- if($total_taikhoan==0){
- mysql_query("INSERT INTO user_info (username,password,email,kich_hoat,date_reg)VALUES('$username','$pass','$email','1','$date_reg')");
- $info=array(
- 'thongbao'=>'Đăng ký tài khoản thành công. Đang chuyển hướng...',
- 'ok'=>1,
- 'link'=>'./dang-nhap.html'
- );
- }else{
- $info=array(
- 'thongbao'=>'Thất bại. Email đã có trên hệ thống...',
- 'ok'=>0,
- 'link'=>'./register.html'
- );
- }
- }
- }
- echo '<!DOCTYPE html>
- <html lang="en">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
- <meta http-equiv="refresh" content="3;url='.$info['link'].'">
- <link href="./skin/css/style.css" rel="stylesheet"/>
- <title>Thông báo hệ thống</title>
- </head>
- <body class="loading">
- <center>'.$info['thongbao'].'</center>
- </body>
- </html>';
- }
- ////////////////////////////////////
- elseif($action=='myaccount'){
- $ho_ten=addslashes($_REQUEST['ho_ten']);
- $dien_thoai=addslashes($_REQUEST['dien_thoai']);
- $dia_chi=addslashes($_REQUEST['dia_chi']);
- if(strlen($ho_ten)<2){
- $info=array(
- 'thongbao'=>'Thất bại! Vui lòng nhập họ và tên của bạn...',
- 'ok'=>0,
- );
- }else{
- mysql_query("UPDATE user_info SET ho_ten='$ho_ten',dien_thoai='$dien_thoai',dia_chi='$dia_chi' WHERE user_id='$user_id'");
- $info=array(
- 'thongbao'=>'Lưu thay đổi thông tin thành công...',
- 'ok'=>1,
- );
- }
- echo '<!DOCTYPE html>
- <html lang="en">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
- <meta http-equiv="refresh" content="3;url=./my-account.html">
- <link href="./skin/css/style.css" rel="stylesheet"/>
- <title>Thông báo hệ thống</title>
- </head>
- <body class="loading">
- <center>'.$info['thongbao'].'</center>
- </body>
- </html>';
- }
- ////////////////////////////////////
- elseif($action=='del_chat'){
- $id=intval($_REQUEST['id']);
- $thongtin=mysql_query("SELECT * FROM chat WHERE id='$id'");
- $total=mysql_num_rows($thongtin);
- if($total==0){
- echo 0;
- }else{
- if($user_info['user_group']==1){
- echo 1;
- mysql_query("DELETE FROM chat WHERE id='$id'");
- }else{
- echo 0;
- }
- }
- }
- ////////////////////////////////////
- elseif($action=='cam_chat'){
- $id=intval($_REQUEST['id']);
- $thongtin=mysql_query("SELECT * FROM chat WHERE id='$id'");
- $total=mysql_num_rows($thongtin);
- if($total==0){
- echo 0;
- }else{
- $r_tt=mysql_fetch_assoc($thongtin);
- if($user_info['user_group']==1){
- echo 1;
- $list_ip=file_get_contents('./data/camchat.txt');
- if($list_ip==''){
- $list_ip=$r_tt['ip_address'];
- }else{
- $list_ip=$list_ip.','.$r_tt['ip_address'];
- }
- $myfile = fopen('./data/camchat.txt', "w");
- fwrite($myfile, $list_ip);
- fclose($myfile);
- mysql_query("DELETE FROM chat WHERE id='$id'");
- }else{
- echo 0;
- }
- }
- }
- ////////////////////////////////////
- elseif($action=='lienhe'){
- $ho_ten=addslashes($_REQUEST['ho_ten']);
- $email=addslashes($_REQUEST['email']);
- $tieu_de=addslashes($_REQUEST['tieu_de']);
- $dien_thoai=addslashes($_REQUEST['dien_thoai']);
- $noi_dung=addslashes($_REQUEST['noi_dung']);
- $captcha=addslashes($_REQUEST['captcha']);
- if(strlen($ho_ten)<2){
- $info=array(
- 'thongbao'=>'Thất bại! Vui lòng nhập họ và tên của bạn...',
- 'ok'=>0,
- );
- }elseif(strlen($dien_thoai)<8){
- $info=array(
- 'thongbao'=>'Thất bại! Vui lòng nhập số điện thoại liên hệ...',
- 'ok'=>0,
- );
- }elseif(strlen($tieu_de)<8){
- $info=array(
- 'thongbao'=>'Thất bại! Tiêu đề liên hệ không rõ ràng...',
- 'ok'=>0,
- );
- }elseif(strlen($noi_dung)<8){
- $info=array(
- 'thongbao'=>'Thất bại! Nội dung liên hệ quá ngắn...',
- 'ok'=>0,
- );
- }elseif($captcha!==$_SESSION['captcha']){
- $info=array(
- 'thongbao'=>'Thất bại! Nhập mã xác nhận không chính xác...',
- 'ok'=>0,
- );
- }else{
- mysql_query("INSERT INTO contact (ho_ten,dien_thoai,email,tieu_de,noi_dung,date_post)VALUES('$ho_ten','$dien_thoai','$email','$tieu_de','$noi_dung',".time().")");
- $info=array(
- 'thongbao'=>'Liên hệ đã được gửi thành công! Cảm ơn bạn đã liên hệ với chúng tôi...',
- 'ok'=>1,
- );
- }
- echo json_encode($info);
- }
- ////////////////////////////////////
- elseif($action=='avatar'){
- $duoi_file=$check->duoi_file($_FILES['avatar']['name']);
- $dungluong=$_FILES['avatar']['size'];
- if($dungluong>1024*1024){
- $info=array(
- 'thongbao'=>'Thất bại! Ảnh có dung lượng vượt quá 1MB...',
- 'ok'=>0,
- );
- }elseif(in_array($duoi_file, array('jpg','png','jpeg'))==false){
- $info=array(
- 'thongbao'=>'Thất bại! Vui lòng chọn ảnh có đuôi jpg,png hoặc jpeg...',
- 'ok'=>0,
- );
- }else{
- $folder_username='./data/'.$user_info['username'];
- if(is_dir($folder_username)=="1"){
- }else{
- mkdir($folder_username);
- }
- $avatar=$folder_username.'/'.$user_info['username'].'.'.$duoi_file;
- @unlink($user_info['avatar']);
- move_uploaded_file($_FILES["avatar"]["tmp_name"],$avatar);
- mysql_query("UPDATE user_info SET avatar='$avatar' WHERE username='{$user_info['username']}'");
- $info=array(
- 'thongbao'=>'Thành công! Hình đại diện của bạn đã được cập nhật...',
- 'ok'=>1,
- );
- }
- echo json_encode($info);
- }
- ////////////////////////////////////
- elseif($action=='xoso'){
- $so=addslashes($_REQUEST['so']);
- $diem=intval($_REQUEST['diem']);
- $ngay=date('d-m-Y',time());
- $hientai=time();
- $ngay_danh=date('d',time());
- $thang_danh=date('m',time());
- $nam_danh=date('Y',time());
- $gioihan=mktime(18,15,00,$thang_danh,$ngay_danh,$nam_danh);
- if($diem=='1'){
- $tru=24000;
- $diem=1;
- }else{
- $tru=12000;
- $diem=0.5;
- }
- if($tru>$user_info['user_money']){
- $info=array(
- 'thongbao'=>'Thất bại! Số tiền hiện tại của bạn không đủ...',
- 'ok'=>0,
- );
- }elseif($hientai>$gioihan){
- $info=array(
- 'thongbao'=>'Thất bại! Vui lòng ghi trước 18h15 phút...',
- 'ok'=>0,
- );
- }else{
- $conlai=$user_info['user_money']-$tru;
- mysql_query("UPDATE user_info SET user_money='$conlai' WHERE user_id='$user_id'");
- mysql_query("INSERT INTO xoso(username,so,diem,thanhtien,ngay,date_post)VALUES('{$user_info['username']}','$so','$diem','$tru','$ngay',".time().")");
- $info=array(
- 'thongbao'=>'Bạn đã ghi số '.$so.': '.$diem.' điểm thành công...',
- 'ok'=>1,
- );
- }
- echo json_encode($info);
- }
- ////////////////////////////////////////
- elseif($action=='doi_matkhau'){
- $password=addslashes($_REQUEST['password']);
- $passnew=addslashes($_REQUEST['passnew']);
- $re_passnew=addslashes($_REQUEST['repassnew']);
- if(strlen($passnew)<6){
- $info=array(
- 'thongbao'=>'Thất bại! Vui lòng nhập mật khẩu mới dài từ 6 ký tự...',
- 'ok'=>0,
- 'link'=>'./doi-matkhau.html'
- );
- }elseif($passnew!==$re_passnew){
- $info=array(
- 'thongbao'=>'Thất bại! Nhập lại mật khẩu mới không khớp...',
- 'ok'=>0,
- 'link'=>'./doi-matkhau.html'
- );
- }else{
- if(md5($password)!==$user_info['password']){
- $info=array(
- 'thongbao'=>'Thất bại! Mật khẩu hiện tại không chính xác...',
- 'ok'=>0,
- 'link'=>'./doi-matkhau.html'
- );
- }else{
- $pass=md5($passnew);
- mysql_query("UPDATE user_info SET password='$pass' WHERE username='{$user_info['username']}'");
- $class_member->logout($user_id);
- $info=array(
- 'thongbao'=>'Đổi mật khẩu thành công! Vui lòng đăng nhập lại...',
- 'ok'=>1,
- 'link'=>'./dang-nhap.html'
- );
- }
- }
- echo '<!DOCTYPE html>
- <html lang="en">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
- <meta http-equiv="refresh" content="3;url='.$info['link'].'">
- <link href="./skin/css/style.css" rel="stylesheet"/>
- <title>Thông báo hệ thống</title>
- </head>
- <body class="loading">
- <center>'.$info['thongbao'].'</center>
- </body>
- </html>';
- }
- ///////////////////////////////////////
- elseif($action=='naptien'){
- define('CORE_API_HTTP_USR', 'sublolcom'); // chưa có
- define('CORE_API_HTTP_PWD', '4bH8AUuqXVDCuK6AqSxY'); // chưa có
- include('../includes/tlca_world.php');
- $check = $tlca_do->load('class_check');
- $index = $tlca_do->load('class_index');
- $user_id=$class_member->check_login();
- $user_info=$class_member->user_info($user_id);
- $bk = 'https://www.baokim.vn/the-cao/restFul/send';
- $seri = isset($_POST['txtseri']) ? $_POST['txtseri'] : '';
- $sopin = isset($_POST['txtpin']) ? $_POST['txtpin'] : '';
- //Loai the cao (VINA, MOBI, VIETEL, VTC, GATE)
- $mang = isset($_POST['chonmang']) ? $_POST['chonmang'] : '';
- $user = $_POST['txtuser'];
- if($mang=='MOBI'){
- $ten = "Mobifone";
- }
- else if($mang=='VIETEL'){
- $ten = "Viettel";
- }
- else if($mang=='GATE'){
- $ten = "Gate";
- }
- else if($mang=='VTC'){
- $ten = "VTC";
- }
- else if($mang=='VNM'){
- $ten = "VNM";
- }
- else $ten ="Vinaphone";
- //Mã MerchantID dang kí trên Bảo Kim
- $merchant_id = '23765';
- //Api username
- $api_username = 'sublolcom';
- //Api Pwd d
- $api_password = '4bH8AUuqXVDCuK6AqSxY';
- //Mã TransactionId
- $transaction_id = time();
- //mat khau di kem ma website dang kí trên B?o Kim
- $secure_code = '4586f8e37597fa10';
- $arrayPost = array(
- 'merchant_id'=>$merchant_id,
- 'api_username'=>$api_username,
- 'api_password'=>$api_password,
- 'transaction_id'=>$transaction_id,
- 'card_id'=>$mang,
- 'pin_field'=>$sopin,
- 'seri_field'=>$seri,
- 'algo_mode'=>'hmac'
- );
- ksort($arrayPost);
- $data_sign = hash_hmac('SHA1',implode('',$arrayPost),$secure_code);
- $arrayPost['data_sign'] = $data_sign;
- $curl = curl_init($bk);
- curl_setopt_array($curl, array(
- CURLOPT_POST=>true,
- CURLOPT_HEADER=>false,
- CURLINFO_HEADER_OUT=>true,
- CURLOPT_TIMEOUT=>30,
- CURLOPT_RETURNTRANSFER=>true,
- CURLOPT_SSL_VERIFYPEER => false,
- CURLOPT_HTTPAUTH=>CURLAUTH_DIGEST|CURLAUTH_BASIC,
- CURLOPT_USERPWD=>CORE_API_HTTP_USR.':'.CORE_API_HTTP_PWD,
- CURLOPT_POSTFIELDS=>http_build_query($arrayPost)
- ));
- $data = curl_exec($curl);
- $status = curl_getinfo($curl, CURLINFO_HTTP_CODE);
- $result = json_decode($data,true);
- //var_dump($data);die;
- date_default_timezone_set('Asia/Ho_Chi_Minh');
- $time=@date('H:i:s d/m/Y',time());
- //$time = time();roi
- if($status==200){
- $amount = $result['amount'];
- switch($amount) {
- case 10000 :$xu = 10000;break;
- case 20000 :$xu = 20000;break;
- case 30000 :$xu = 30000;break;
- case 50000 :$xu = 50000;break;
- case 100000 :$xu = 100000;break;
- case 200000 :$xu = 200000;break;
- case 300000 :$xu = 300000;break;
- case 500000 :$xu = 500000;break;
- }
- $dau=$user_info['user_money'];
- $money=$user_info['user_money']+ $xu;
- $cuoi=$dau+$xu;
- $noi_dung="Nạp tiền vào tài khoản bằng thẻ cào ".$ten." mệnh giá ".$amount.', bạn nhận được '.$xu.' vào tài khoản chính';
- mysql_query("UPDATE user_info SET user_money ='$money' WHERE user_id='$user_id'");
- mysql_query("INSERT INTO giaodich_xu(user_id,xu,xu_truoc,phuongthuc,xu_sau,noi_dung,loai,ngay)VALUES('$user_id','$xu','$dau','$mang','$cuoi','$noi_dung','1','$time')");
- $file = "./napthe/carddung.log";
- $fh = fopen($file,'a');
- fwrite($fh,"Tai khoan: ".$user_info['username'].", Loai the: ".$ten.",Số seri ".$seri.",Mã thẻ: ".$sopin.", Menh gia: ".$amount.", Thoi gian: ".$time);
- fwrite($fh,"\r\n");
- fclose($fh);
- echo '<!DOCTYPE html>
- <html lang="en">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
- <meta http-equiv="refresh" content="3;url=./thue-sub.html">
- <link href="./skin/css/style.css" rel="stylesheet"/>
- <title>Thông báo hệ thống</title>
- </head>
- <body class="loading">
- <center>'.$noi_dung.'</center>
- </body>
- </html>';
- }
- else{
- $error = $result['errorMessage'];
- $file = "./napthe/cardsai.log";
- $fh = fopen($file,'a');
- fwrite($fh,"Tai khoan: ".$user_info['username'].", Ma the: ".$sopin.", Seri: ".$seri.", Loai The: ".$ten.", Noi dung loi: ".$error.", Thoi gian: ".$time);
- fwrite($fh,"\r\n");
- fclose($fh);
- echo '<!DOCTYPE html>
- <html lang="en">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
- <meta http-equiv="refresh" content="3;url=./nap-the.html">
- <link href="./skin/css/style.css" rel="stylesheet"/>
- <title>Thông báo hệ thống</title>
- </head>
- <body class="loading">
- <center>'.$error.'</center>
- </body>
- </html>';
- }
- }
- //////////////////////////////////////////
- elseif($action=='kichhoat_matkhau'){
- $email=addslashes($_REQUEST['email']);
- $token=addslashes($_REQUEST['token']);
- $gioi_han=time()-48*3600;
- $thongtin=mysql_query("SELECT * FROM quen_pass WHERE email='$email' AND code='$token' AND date_post>'$gioi_han'");
- $total=mysql_num_rows($thongtin);
- if($total==0){
- echo '<!DOCTYPE html>
- <html lang="en">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
- <meta http-equiv="refresh" content="3;url=./index.html">
- <link href="./skin/css/style.css" rel="stylesheet"/>
- <title>Thông báo hệ thống</title>
- </head>
- <body class="loading">
- <center>Kích hoạt thất bại!<br>Link đã hết hạn hoặc đã được sử dụng.</center>
- </body>
- </html>';
- }else{
- $r_tt=mysql_fetch_assoc($thongtin);
- $pass=md5($r_tt['password']);
- mysql_query("UPDATE user_info SET password='$pass' WHERE email='$email'");
- mysql_query("DELETE FROM quen_pass WHERE date_post<'$gioi_han'");
- echo '<!DOCTYPE html>
- <html lang="en">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
- <meta http-equiv="refresh" content="3;url=./dang-nhap.html">
- <link href="./skin/css/style.css" rel="stylesheet"/>
- <title>Thông báo hệ thống</title>
- </head>
- <body class="loading">
- <center>Kích hoạt thành cộng...</center>
- </body>
- </html>';
- }
- }
- ////////////////////////////////////////
- elseif($action=='login'){
- $username=addslashes($_REQUEST['username']);
- $password=addslashes($_REQUEST['password']);
- if($check->check_username($username)==false){
- $info=array(
- 'thongbao'=>'Thất bại! Tài khoản không đúng định dạng ...',
- 'ok'=>0,
- 'link'=>'./dang-nhap.html'
- );
- }elseif(strlen($password)<6){
- $info=array(
- 'thongbao'=>'Thất bại! Mật khẩu phải dài từ 6 ký tự...',
- 'ok'=>0,
- 'link'=>'./dang-nhap.html'
- );
- }else{
- $kq=$class_member->login($username,$password);
- if($kq==0){
- $info=array(
- 'thongbao'=>'Thất bại! Tài khoản không tồn tại trên hệ thống...',
- 'ok'=>0,
- 'link'=>'./dang-nhap.html'
- );
- }else if($kq==2){
- $info=array(
- 'thongbao'=>'Thất bại! Mật khẩu bạn nhập không chính xác...',
- 'ok'=>0,
- 'link'=>'./dang-nhap.html'
- );
- }else if($kq==3){
- $info=array(
- 'thongbao'=>'Thất bại! Tài khoản của bạn chưa được kích hoạt...',
- 'ok'=>0,
- 'link'=>'./dang-nhap.html'
- );
- }else if($kq==1){
- $info=array(
- 'thongbao'=>'Đăng nhập thành công! Bạn đang được chuyển tới tài khoản...',
- 'ok'=>1,
- 'link'=>'./my-account.html'
- );
- }else{
- $info=array(
- 'thongbao'=>'Đăng nhập thất bại! Gặp lỗi không xác định...',
- 'ok'=>0,
- 'link'=>'./dang-nhap.html'
- );
- }
- }
- echo '<!DOCTYPE html>
- <html lang="en">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
- <meta http-equiv="refresh" content="3;url='.$info['link'].'">
- <link href="./skin/css/style.css" rel="stylesheet"/>
- <title>Thông báo hệ thống</title>
- </head>
- <body class="loading">
- <center>'.$info['thongbao'].'</center>
- </body>
- </html>';
- }
- ////////////////////////////////////////
- elseif($action=='giahan'){
- $id=intval($_REQUEST['id']);
- $goi=intval($_REQUEST['goi']);
- $thongtin=mysql_query("SELECT * FROM don_hang WHERE id='$id'");
- $total=mysql_num_rows($thongtin);
- $thongtin_goi=mysql_query("SELECT * FROM goi_sanpham WHERE id='$goi'");
- $total_goi=mysql_num_rows($thongtin_goi);
- if($user_id==0){
- $info=array(
- 'thongbao'=>'Thất bại! Bạn chưa đăng nhập tài khoản ...',
- 'ok'=>0,
- 'chuyenhuong'=>'./dang-nhap.html'
- );
- }elseif($total==0){
- $info=array(
- 'thongbao'=>'Thất bại! Đơn hàng này không tồn tại...',
- 'ok'=>0,
- 'chuyenhuong'=>'./da-thue.html'
- );
- }elseif($total_goi==0){
- $info=array(
- 'thongbao'=>'Thất bại! Gói sản phẩm bạn chọn không tồn tại...',
- 'ok'=>0,
- 'chuyenhuong'=>'./da-thue.html'
- );
- }else{
- $r_tt=mysql_fetch_assoc($thongtin);
- $r_g=mysql_fetch_assoc($thongtin_goi);
- if($r_tt['date_end']<time()){
- $info=array(
- 'thongbao'=>'Thất bại! Bạn đã hết gian thuê tài khoản này...',
- 'ok'=>0,
- 'chuyenhuong'=>'./da-thue.html'
- );
- }else{
- $thongtin_damua=mysql_query("SELECT * FROM don_hang WHERE sanpham='{$r_tt['sanpham']}' AND tinh_trang='2'");
- $total_damua=mysql_num_rows($thongtin_damua);
- if($total_damua>0){
- $info=array(
- 'thongbao'=>'Thất bại! Tài khoản này đã có người đặt trước...',
- 'ok'=>0,
- 'chuyenhuong'=>'./da-thue.html'
- );
- }else{
- $ok_end=$r_tt['date_end']+3600*$r_g['start'];
- $tru=$r_g['gia'];
- if($tru>$user_info['user_money']){
- $info=array(
- 'thongbao'=>'Thất bại! Tiền trong tài khoản của bạn không đủ...',
- 'ok'=>0,
- 'chuyenhuong'=>'./nap-the.html'
- );
- }else{
- $conlai=$user_info['user_money']-$tru;
- $gia_moi=$r_tt['gia']+$tru;
- mysql_query("UPDATE user_info SET user_money='$conlai' WHERE user_id='$user_id'");
- mysql_query("UPDATE don_hang SET date_end='$ok_end',gia='$gia_moi' WHERE id='$id'");
- $info=array(
- 'thongbao'=>'Thành công! Đang chuyển hướng tới trang xem thông tin...',
- 'ok'=>0,
- 'chuyenhuong'=>'./da-thue.html'
- );
- }
- }
- }
- }
- echo '<!DOCTYPE html>
- <html lang="en">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
- <meta http-equiv="refresh" content="3;url='.$info['chuyenhuong'].'">
- <link href="./skin/css/style.css" rel="stylesheet"/>
- <title>Thông báo hệ thống</title>
- </head>
- <body class="loading">
- <center>'.$info['thongbao'].'</center>
- </body>
- </html>';
- }
- ////////////////////////////////////////
- elseif($action=='thue'){
- $id=intval($_REQUEST['id']);
- $goi=intval($_REQUEST['goi']);
- $thongtin=mysql_query("SELECT * FROM sanpham WHERE id='$id'");
- $total=mysql_num_rows($thongtin);
- $thongtin_goi=mysql_query("SELECT * FROM goi_sanpham WHERE id='$goi'");
- $total_goi=mysql_num_rows($thongtin_goi);
- if($user_id==0){
- $info=array(
- 'thongbao'=>'Thất bại! Bạn chưa đăng nhập tài khoản ...',
- 'ok'=>0,
- 'chuyenhuong'=>'./dang-nhap.html'
- );
- }elseif($total==0){
- $info=array(
- 'thongbao'=>'Thất bại! Sản phẩm không tồn tại...',
- 'ok'=>0,
- 'chuyenhuong'=>'./thue-sub.html'
- );
- }elseif($total_goi==0){
- $info=array(
- 'thongbao'=>'Thất bại! Gói sản phẩm bạn chọn không tồn tại...',
- 'ok'=>0,
- 'chuyenhuong'=>'./thue-sub.html'
- );
- }else{
- $r_tt=mysql_fetch_assoc($thongtin);
- $r_g=mysql_fetch_assoc($thongtin_goi);
- $ok_start=time();
- $ok_end=$ok_start+3600*$r_g['start'];
- $tru=$r_g['gia'];
- $thongtin_damua=mysql_query("SELECT * FROM don_hang WHERE sanpham='$id' AND date_end>'$ok_start' AND tinh_trang='1'");
- $total_damua=mysql_num_rows($thongtin_damua);
- if($tru>$user_info['user_money']){
- $info=array(
- 'thongbao'=>'Thất bại! Tiền trong tài khoản của bạn không đủ...',
- 'ok'=>0,
- 'chuyenhuong'=>'./nap-the.html'
- );
- }else if($total_damua>0){
- $info=array(
- 'thongbao'=>'Thất bại! Tài khoản này đang có người sử dụng...',
- 'ok'=>0,
- 'chuyenhuong'=>'./thue-sub.html'
- );
- }else{
- $ma_donhang=substr(md5($r_tt['tieu_de'].''.time()),0,8);
- $conlai=$user_info['user_money']-$tru;
- mysql_query("UPDATE user_info SET user_money='$conlai' WHERE user_id='$user_id'");
- mysql_query("INSERT INTO don_hang(ma_don,username,khung,tieu_de,account,sanpham,gia,tinh_trang,date_post,date_start,date_end)VALUES('$ma_donhang','{$user_info['username']}','$goi','{$r_tt['tieu_de']}','{$r_tt['account']}','$id','{$r_g['gia']}','1',".time().",'$ok_start','$ok_end')");
- $_SESSION['hoanthanh']=$id.'|'.$ma_donhang;
- $info=array(
- 'thongbao'=>'Thành công! Đang chuyển hướng tới trang xem thông tin...',
- 'ok'=>0,
- 'chuyenhuong'=>'./hoan-thanh.html'
- );
- }
- }
- echo '<!DOCTYPE html>
- <html lang="en">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
- <meta http-equiv="refresh" content="3;url='.$info['chuyenhuong'].'">
- <link href="./skin/css/style.css" rel="stylesheet"/>
- <title>Thông báo hệ thống</title>
- </head>
- <body class="loading">
- <center>'.$info['thongbao'].'</center>
- </body>
- </html>';
- }
- ////////////////////////////////////////
- elseif($action=='dattruoc'){
- $id=intval($_REQUEST['id']);
- $goi=intval($_REQUEST['goi']);
- $thongtin=mysql_query("SELECT * FROM sanpham WHERE id='$id'");
- $total=mysql_num_rows($thongtin);
- $thongtin_goi=mysql_query("SELECT * FROM goi_sanpham WHERE id='$goi'");
- $total_goi=mysql_num_rows($thongtin_goi);
- if($user_id==0){
- $info=array(
- 'thongbao'=>'Thất bại! Bạn chưa đăng nhập tài khoản ...',
- 'ok'=>0,
- 'chuyenhuong'=>'./dang-nhap.html'
- );
- }elseif($total==0){
- $info=array(
- 'thongbao'=>'Thất bại! Sản phẩm không tồn tại...',
- 'ok'=>0,
- 'chuyenhuong'=>'./thue-sub.html'
- );
- }elseif($total_goi==0){
- $info=array(
- 'thongbao'=>'Thất bại! Gói sản phẩm bạn chọn không tồn tại...',
- 'ok'=>0,
- 'chuyenhuong'=>'./thue-sub.html'
- );
- }else{
- $r_tt=mysql_fetch_assoc($thongtin);
- $r_g=mysql_fetch_assoc($thongtin_goi);
- $thongtin_dangdung=mysql_query("SELECT * FROM don_hang WHERE sanpham='$id' AND tinh_trang='1' ORDER BY date_end DESC LIMIT 1");
- $total_dangdung=mysql_num_rows($thongtin_dangdung);
- if($total_dangdung==0){
- $ok_start=time();
- $ok_end=$ok_start+3600*$r_g['start'];
- $tru=$r_g['gia'];
- if($tru>$user_info['user_money']){
- $info=array(
- 'thongbao'=>'Thất bại! Tiền trong tài khoản của bạn không đủ...',
- 'ok'=>0,
- 'chuyenhuong'=>'./nap-the.html'
- );
- }else{
- $ma_donhang=substr(md5($r_tt['tieu_de'].''.time()),0,8);
- $conlai=$user_info['user_money']-$tru;
- mysql_query("UPDATE user_info SET user_money='$conlai' WHERE user_id='$user_id'");
- mysql_query("INSERT INTO don_hang(ma_don,username,khung,tieu_de,account,sanpham,gia,tinh_trang,date_post,date_start,date_end)VALUES('$ma_donhang','{$user_info['username']}','$goi','{$r_tt['tieu_de']}','{$r_tt['account']}','$id','{$r_g['gia']}','1',".time().",'$ok_start','$ok_end')");
- $_SESSION['hoanthanh']=$id.'|'.$ma_donhang;
- $info=array(
- 'thongbao'=>'Thuê tài khoản thành công! Đang chuyển hướng tới xem thông tin...',
- 'ok'=>1,
- 'chuyenhuong'=>'./hoan-thanh.html'
- );
- }
- }else{
- $r_sd=mysql_fetch_assoc($thongtin_dangdung);
- $hientai=time();
- if($r_sd['date_end']>$hientai){
- $ok_start=$r_sd['date_end'];
- }else{
- $ok_start=$hientai;
- }
- $ok_end=$ok_start+3600*$r_g['start'];
- $tru=$r_g['gia'];
- $thongtin_damua=mysql_query("SELECT * FROM don_hang WHERE sanpham='$id' AND date_end>'$ok_start' AND tinh_trang='2'");
- $total_damua=mysql_num_rows($thongtin_damua);
- if($tru>$user_info['user_money']){
- $info=array(
- 'thongbao'=>'Thất bại! Tiền trong tài khoản của bạn không đủ...',
- 'ok'=>0,
- 'chuyenhuong'=>'./nap-the.html'
- );
- }else if($total_damua>0){
- $info=array(
- 'thongbao'=>'Thất bại! Đã có 1 người đặt trước tài khoản này...',
- 'ok'=>0,
- 'chuyenhuong'=>'./thue-sub.html'
- );
- }else{
- $ma_donhang=substr(md5($r_tt['tieu_de'].''.time()),0,8);
- $conlai=$user_info['user_money']-$tru;
- mysql_query("UPDATE user_info SET user_money='$conlai' WHERE user_id='$user_id'");
- mysql_query("INSERT INTO don_hang(ma_don,username,khung,tieu_de,account,sanpham,gia,tinh_trang,date_post,date_start,date_end)VALUES('$ma_donhang','{$user_info['username']}','$goi','{$r_tt['tieu_de']}','{$r_tt['account']}','$id','{$r_g['gia']}','2',".time().",'$ok_start','$ok_end')");
- $_SESSION['hoanthanh']=$id.'|'.$ma_donhang;
- $info=array(
- 'thongbao'=>'Đặt trước thành công! Đang chuyển hướng tới trang đã thuê ...',
- 'ok'=>1,
- 'chuyenhuong'=>'./da-thue.html'
- );
- }
- }
- }
- echo '<!DOCTYPE html>
- <html lang="en">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
- <meta http-equiv="refresh" content="3;url='.$info['chuyenhuong'].'">
- <link href="./skin/css/style.css" rel="stylesheet"/>
- <title>Thông báo hệ thống</title>
- </head>
- <body class="loading">
- <center>'.$info['thongbao'].'</center>
- </body>
- </html>';
- }
- ////////////////////////////////////////
- elseif($action=='logout'){
- if($user_id==0){
- $info=array(
- 'thongbao'=>'Thao tác không thành công! Bạn chưa đăng nhập...',
- 'ok'=>0,
- );
- }else{
- $class_member->logout($user_id);
- $info=array(
- 'thongbao'=>'Đăng xuất thành công! Hệ thống đang chuyển hướng...',
- 'ok'=>1,
- );
- }
- echo '<!DOCTYPE html>
- <html lang="en">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
- <meta http-equiv="refresh" content="3;url=./index.html">
- <link href="./skin/css/style.css" rel="stylesheet"/>
- <title>Thông báo hệ thống</title>
- </head>
- <body class="loading">
- <center>'.$info['thongbao'].'</center>
- </body>
- </html>';
- }
- ///////////////////////////////////
- elseif($action=='lost_password'){
- $email=addslashes($_REQUEST['email']);
- include_once("./class.phpmailer.php");
- $port=$check->index_setting('port');
- $pass_mail=$check->index_setting('pass_mail');
- $smtp=$check->index_setting('smtp');
- $mail_noreply=$check->index_setting('mail_noreply');
- if($check->check_email($email)==true){
- $thongtin_email=mysql_query("SELECT * FROM user_info WHERE email='$email'");
- $total_email=mysql_num_rows($thongtin_email);
- if($total_email==0){
- $info=array(
- 'thongbao'=>'Thất bại! Email bạn nhập không tồn tài trên hệ thống...',
- 'ok'=>0,
- );
- }else{
- $r_tt=mysql_fetch_assoc($thongtin_email);
- $token=md5(time());
- $hientai=time();
- $password=rand(123456,999999);
- $r_email['password']=$password;
- $r_email['username']=$r_tt['username'];
- $r_email['link_domain']=$check->index_setting('link_domain');
- $r_email['link_xacnhan']=$check->index_setting('link_domain').'process.php?action=kichhoat_matkhau&email='.$email.'&token='.$token;
- $noidung=$tlca_skin->skin_replace('noidung_email',$r_email);
- $mailer = new PHPMailer(); // khởi tạo đối tượng
- $mailer->IsSMTP(); // gọi class smtp để đăng nhập
- $mailer->CharSet="utf-8"; // bảng mã unicode
- $mailer->SMTPAuth = true; // gửi thông tin đăng nhập
- // Đăng nhập SMTP
- if($smtp=='smtp.gmail.com'){
- $mailer->SMTPSecure = "ssl"; // Giao thức SSL
- $mailer->Host = "smtp.gmail.com"; // SMTP của GMAIL
- $mailer->Port = 465; // cổng SMTP
- $mailer->Username = $mail_noreply; // GMAIL username
- $mailer->Password = $pass_mail; // GMAIL password
- }else{
- $mailer->Host =$smtp; // địa chỉ server smtp
- $mailer->Port = $port; // cổng SMTP
- $mailer->Username = $mail_noreply; // tên đăng nhập
- $mailer->Password = $pass_mail; // mật khẩu
- }
- $mailer->FromName = 'Admin '.$_SERVER['HTTP_HOST']; // tên người gửi
- $mailer->From = $mail_noreply; // mail người gửi
- $mailer->AddAddress($email,$r_tt['ho_ten']); //thêm mail người nhận
- $mailer->Subject = 'Lấy lại mật khẩu trên '.$_SERVER['HTTP_HOST'];
- $mailer->IsHTML(true); //Bật HTML không thích thì false
- $mailer->Body = $noidung;
- if($mailer->Send()){
- mysql_query("INSERT INTO quen_pass(email,password,code,date_post)VALUES('$email','$password','$token','$hientai')");
- $info=array(
- 'thongbao'=>'Thành công! Vui lòng truy cập email '.$email.' để kích hoạt mật khẩu...',
- 'ok'=>1,
- 'link'=>'./quen-matkhau.html'
- );
- }else{
- $info=array(
- 'thongbao'=>'Thất bại! Gặp lỗi trong quá trình gửi email...',
- 'ok'=>0,
- 'link'=>'./quen-matkhau.html'
- );
- }
- }
- }else{
- $info=array(
- 'thongbao'=>'Thất bại! Email bạn nhập không đúng định dạng...',
- 'ok'=>0,
- 'link'=>'./quen-matkhau.html'
- );
- }
- echo '<!DOCTYPE html>
- <html lang="en">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
- <meta http-equiv="refresh" content="3;url='.$info['link'].'">
- <link href="./skin/css/style.css" rel="stylesheet"/>
- <title>Thông báo hệ thống</title>
- </head>
- <body class="loading">
- <center>'.$info['thongbao'].'</center>
- </body>
- </html>';
- }
- ///////////////////////////////////////
- else{
- echo 'No Action';
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement