| Server IP : 210.245.233.93 / Your IP : 216.73.216.226 Web Server : Apache/2.2.15 (CentOS) System : Linux webserver2.onesolution.com.hk 2.6.32-754.35.1.el6.x86_64 #1 SMP Sat Nov 7 12:42:14 UTC 2020 x86_64 User : apache ( 48) PHP Version : 5.3.3 Disable Function : exec, shell_exec, system, passthru, popen, proc_open, pcntl_exec MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/hkosl.com/survey_demo/ |
Upload File : |
<?php
require_once('webadmin/basic_info.php');
$id = (int)$_SESSION["id"];
$campaign = get_campaign($id);
check_campaign_date($campaign);
$message = "";
$gender = $_POST["gender"];
$_SESSION["gender"] = $gender;
$firstname = $_POST["firstname"];
$_SESSION["firstname"] = $firstname;
$lastname = $_POST["lastname"];
$_SESSION["lastname"] = $lastname;
if (isset($_POST["yyyy"])) {
$_SESSION["yyyy"] = $_POST["yyyy"];
}
if (isset($_POST["mm"])) {
$_SESSION["mm"] = $_POST["mm"];
}
if (isset($_POST["dd"])) {
$_SESSION["dd"] = $_POST["dd"];
}
if (!empty($_POST["yyyy"]) && !empty($_POST["mm"]) && !empty($_POST["dd"])) {
$dob = $_POST["yyyy"] . "-" . $_POST["mm"] . "-" . $_POST["dd"];
} else {
$dob = "";
}
$email = $_POST["email"];
$_SESSION["email"] = $email;
$telephone = $_SESSION["telephone"];
//$_SESSION["telephone"] = $telephone;
if (isset($_POST["address"])) {
$address = $_POST["address"];
$_SESSION["address"] = $_POST["address"];
} else {
$address = "";
$_SESSION["address"] = "";
}
$district = $_POST["district"];
$district_name = $_POST["district_name"];
$_SESSION["district"] = $district;
$_SESSION["district_name"] = $district_name;
$password = $_POST["password"];
$confirm_password = $_POST["confirm_password"];
$_SESSION['vCode'] = "";
if (empty($_POST["gender"]) || empty($_POST["firstname"]) || empty($_POST["lastname"]) || empty($_POST["dd"]) || empty($_POST["mm"]) || empty($_POST["yyyy"]) || empty($_POST["email"]) || empty($_SESSION["telephone"]) || empty($_SESSION["address"]) || empty($_POST["district"]) || empty($_POST["password"]) || empty($_POST["confirm_password"])) {
$message .= "Missing required data. Please try again.\\n缺少必要的資料,請重新再嘗試。\\n\\n";
}
if (!filter_var($_POST["email"], FILTER_VALIDATE_EMAIL)) {
$message .= "Email format is wrong.\\n電郵格式錯誤。\\n\\n";
}
if (!is_numeric($_SESSION["telephone"])) {
$message .= "Mobile Phone should be digital number.\\n流動電話號碼應是數字。\\n\\n";
}
/*if(!empty($_POST["referencer_telephone"]) && !is_numeric($_POST["referencer_telephone"])){
$message .= "Referencer Telephone should be digital number.\\n\\n";
}*/
if ($_POST["password"] != $_POST["confirm_password"]) {
$message .= "Password and confirm password should be same.\\n密碼和確認密碼必須相同。\\n\\n";
}
if (!isset($_POST["tnc"])) {
$message .= "Please read and agree the terms & conditions. \\n請細閱及同意條款及細則。\\n\\n";
}
if (!checkdate($_POST["mm"], $_POST["dd"], $_POST["yyyy"])) {
$message .= "Please choose correct date format.\\n";
}
/*if(!empty($_POST["referral_code"])){
if(!is_numeric($_POST["referral_code"])) {
$message .= $_profile_post[4][$langcode];
}else {
if($_POST["referral_code"] == $member_info["VIP_TEL"]){
$message .= $_profile_post[6][$langcode];
}else{
$sql = "select * from VIP where VIP_TEL = ? and VIP_TEL != ?";
$parameters = array($_POST["referral_code"], $member_info["VIP_TEL"]);
$result = bind_pdo($sql, $parameters, "selectone");
if(empty($result)){
$message .= $_profile_post[5][$langcode];
}
}
}
}*/
if (!empty($message)) {
echo "<script>alert('" . $message . "'); history.back();</script>";
exit;
}
//call api to check member info
$url = $site_info["api_url"] . "check_vip_exist";
$postData = array("telephone" => $_SESSION["telephone"], "email" => $email);
$post = 1;
$check_member = call_curl($url, $postData, $post);
if ($check_member == 1) { //exist record
$message = "Email or Telephone has been registered by others users.\\n電郵或流動電話已被登記。\\n\\n";
echo "<script>alert('" . $message . "'); history.back();</script>";
exit;
} else { //valid user
//insert new member data to VIP
//$url = 'http://sinomaxecomm.skytree.com.hk/api/vip/register';
$url = $site_info["skytree_api_hostname"] . 'api/vip/eShopRegister';
$postData = array('tel' => $telephone, 'lastname' => $lastname, 'firstname' => $firstname, 'birthday' => $dob, 'email' => $email, 'address' => $address, 'password' => $password, 'gender' => $gender, 'district_id' => $district);
$result = call_curl($url, $postData, 1);
$result_array = json_decode($result, true);
if ($result_array["error"] == "0" && !empty($result_array["vip_code"])) {
//has referral
/*if(!empty($_POST["referral_code"])){
$url = $site_info["skytree_api_hostname"].'api/vip/submitReferCode';
$postData = array('vip_code' => $result_array["vip_code"], 'refer_code' => $_POST["referral_code"]);
$result = call_API($url, $postData, 1);
}*/
//unset session
unset($_SESSION["account_verified"]);
unset($_SESSION["registration_step2"]);
unset($_SESSION["gender"]);
unset($_SESSION["firstname"]);
unset($_SESSION["lastname"]);
unset($_SESSION["yyyy"]);
unset($_SESSION["mm"]);
unset($_SESSION["dd"]);
unset($_SESSION["email"]);
unset($_SESSION["telephone"]);
unset($_SESSION["address"]);
unset($_SESSION["district"]);
unset($_SESSION["district_name"]);
echo "<script>alert('Registration Successfully. Please login to get rewards\\n註冊成功。登入後可以領取獎勵。\\n\\n'); window.location.href='user_info.php';</script>";
} else {
//call api to remove VIPVerifingTel data when error
$url = $site_info["api_url"] . "remove_verify_tel";
$postData = array("telephone" => $_POST["telephone"]);
$post = 1;
$result = call_curl($url, $postData, $post);
echo "<script>alert('Error Occur: " . $result_array["error"] . " (" . $result_array["err_msg"] . "), Please try again.'); history.back();</script>";
}
}