ÿØÿà JFIF ÿÛ „ ( %"1"%)+...383,7(-.-
![]() Server : Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.4.20 System : Linux st2.domain.com 3.10.0-1127.10.1.el7.x86_64 #1 SMP Wed Jun 3 14:28:03 UTC 2020 x86_64 User : apache ( 48) PHP Version : 7.4.20 Disable Function : NONE Directory : /var/www/html/luckymerchan/code/ajax/ |
<?php $arr_return = array('error'=>'','content'=>'','txt_date'=>'','point'=>0); if(!isset($ob_user->user_id) or $ob_user->user_id==0){ echo 'need_login'; exit(); } $user_id = intval($ob_user->user_id); $r_user = $DB->fetch_row($DB->query("SELECT * FROM tb_user WHERE user_id='$user_id' ")); $r_guest = $DB->fetch_row($DB->query("SELECT * FROM tb_guest WHERE user_id='$user_id' ")); $date_now = date('Y-m-d'); $row_check_his = $DB->fetch_row($DB->query("SELECT * FROM tb_user_list_so_his WHERE user_id='$user_id' AND kqloc_date='$date_now' AND kqloc_type='1' LIMIT 1")); if($row_check_his){ $q_list_his = $DB->query("SELECT * FROM tb_user_list_so_his WHERE user_id='$user_id' AND kqloc_date='$date_now' AND kqloc_type='1' "); $txt_list = ''; while($r_list_his= $DB->fetch_row($q_list_his)){ $txt_list .= '<th class="text-center" style="background-color:'.$r_list_his['mau_bg'].'"><span style="color: '.$r_list_his['mau_text'].'">' . $r_list_his['kqloc_so'] . '</span></th>'; } $arr_return['txt_date'] = date('d-m-Y',strtotime($date_now)); $arr_return['content'] = $txt_list; $arr_return['point'] = 0; echo json_encode($arr_return); exit(); }else { $r_check_kq = $DB->fetch_row($DB->query("SELECT * FROM tb_kqloc WHERE kqloc_date='$date_now' AND kqloc_type='1' LIMIT 1 ")); if(!$r_check_kq){ $arr_return['txt_date'] = date('d-m-Y',strtotime($date_now)); $arr_return['error'] = 'so_chua_ra'; $arr_return['point'] = 0; echo json_encode($arr_return); exit(); } $guestpoint_id = intval($r_guest['guest_vip_level']); if ($guestpoint_id == 0) { $arr_return['txt_date'] = date('d-m-Y',strtotime($date_now)); $arr_return['error'] = 'no_vip_user'; $arr_return['point'] = 0; echo json_encode($arr_return); exit(); } $r_guestpoint = $DB->fetch_row($DB->query("SELECT * FROM tb_guestpoint WHERE guestpoint_id='$guestpoint_id'")); $arr_time = array( 'guestpoint_time1_point' => array('begin' => date('Y-m-d') . ' 15:00:00', 'end' => date('Y-m-d') . ' 18:30:00'), 'guestpoint_time2_point' => array('begin' => date('Y-m-d') . ' 14:00:00', 'end' => date('Y-m-d') . ' 14:59:59'), 'guestpoint_time3_point' => array('begin' => date('Y-m-d') . ' 13:00:00', 'end' => date('Y-m-d') . ' 13:59:59'), 'guestpoint_time4_point' => array('begin' => date('Y-m-d') . ' 12:00:00', 'end' => date('Y-m-d') . ' 12:59:59'), 'guestpoint_time5_point' => array('begin' => date('Y-m-d') . ' 00:00:00', 'end' => date('Y-m-d') . ' 11:59:59'), 'guestpoint_time6_point' => array('begin' => date('Y-m-d') . ' 18:30:01', 'end' => date('Y-m-d') . ' 23:59:59') ); $time_now = date('Y-m-d H:i:s'); $row_tinh_phi = ''; foreach ($arr_time as $key => $val) { if ($time_now >= $val['begin'] and $time_now <= $val['end']) { $row_tinh_phi = $key; break; } } $point_tru = $r_guestpoint[$row_tinh_phi]; //check tien con du khong $r_tongtien_check = $DB->fetch_row($DB->query("SELECT COALESCE(SUM(`so_diem`),0) as so_diem_con_lai FROM tb_guest_pay_his WHERE user_id='$user_id' ")); if ($point_tru > $r_tongtien_check['so_diem_con_lai']) { $arr_return['txt_date'] = date('d-m-Y',strtotime($date_now)); $arr_return['error'] = 'not_enought_point'; $arr_return['point'] = 0; echo json_encode($arr_return); exit(); } //tru tien,insert lich su tru tien,update level $ngay_phat_sinh = $time_now; $so_tien = 0; $so_diem = abs($point_tru) * (-1); $fee_type = 'Xem list số 1 ngà y'; $arr_insert = array('user_id' => $user_id, 'so_tien' => $so_tien, 'so_diem' => $so_diem, 'ngay_phat_sinh' => $ngay_phat_sinh, 'nap_type' => 'luckymerchan', 'fee_type' => $fee_type, 'time_post' => time(), 'user_post' => $ob_user->user_id); $DB->do_insert('tb_guest_pay_his', $arr_insert); update_fee_his($user_id); //show kq $q_kq = $DB->query("SELECT * FROM tb_kqloc WHERE kqloc_date='$date_now' AND kqloc_type='1'"); $txt_list = ''; while ($r_kq = $DB->fetch_row($q_kq)) { $arr_insert_his = array('user_id' => $user_id, 'kqloc_date' => $date_now, 'kqloc_so' => $r_kq['kqloc_so'], 'kqloc_type' => 1, 'time_post' => time(),'mau_text'=>$r_kq['mau_text'],'mau_bg'=>$r_kq['mau_bg']); //insert lich su so lo so huu $DB->do_insert('tb_user_list_so_his',$arr_insert_his); $txt_list .= '<th class="text-center" style="background-color:'.$r_kq['mau_bg'].'"><span style="color: '.$r_kq['mau_text'].'">' . $r_kq['kqloc_so'] . '</span></th>'; } $arr_return['txt_date'] = date('d-m-Y',strtotime($date_now)); $arr_return['content'] = $txt_list; $arr_return['point'] = $so_diem; echo json_encode($arr_return); exit(); } ?>