| 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/innoutstorage/webadmin/ |
Upload File : |
<?php
require_once('check_login.php');
$customer_info = get_customer();
$message = "";
if (empty($_POST["customer_type"])) {
$message .= "找不到相關客戶。\\n\\n";
}
if (empty($_POST["identity_id"])) {
$message .= "請輸入證明文件號碼。\\n\\n";
}
if ($_POST["customer_type"] == "BUSINESS") {
if (empty($_POST["companyname"])) {
$message .= "請輸入公司名稱。\\n\\n";
}
}
if (empty($_POST["title"])) {
$message .= "請選擇頭銜。\\n\\n";
}
if (empty($_POST["firstname"])) {
$message .= "請輸入名字。\\n\\n";
}
if (empty($_POST["lastname"])) {
$message .= "請輸入姓氏。\\n\\n";
}
if (empty($_POST["tel"])) {
$message .= "請輸入電話號碼。\\n\\n";
} else {
if (!is_numeric($_POST["tel"])) {
$message .= "請輸入正確的電話號碼。\\n\\n";
} else {
foreach ($customer_info as $customer) {
if ($customer["deleted"] == 1)
continue;
$decrypt_tel = rsa_crypt($customer["tel"], 2);
if (!empty($decrypt_tel) && $decrypt_tel == $_POST["tel"] && $_POST["customer_type"] == $customer["typeid"]) {
$message .= "此電話已登記,請使用另一個電話。\\n\\n";
break;
}
}
}
}
if (empty($_POST["email"])) {
//$message .= "請輸入電郵地址。\\n\\n";
} else {
if (!filter_var($_POST["email"], FILTER_VALIDATE_EMAIL)) {
$message .= "請輸入正確的電郵。\\n\\n";
} else {
foreach ($customer_info as $customer) {
if ($customer["deleted"] == 1)
continue;
$decrypt_email = rsa_crypt($customer["email"], 2);
if (!empty($decrypt_email) && $decrypt_email == $_POST["email"] && $_POST["customer_type"] == $customer["typeid"]) {
$message .= "此電郵已登記,請使用另一個電郵。\\n\\n";
break;
}
}
}
}
if (empty($_POST["address"])) {
$message .= "請輸入聯絡地址。\\n\\n";
}
if (!empty($message)) {
echo "<script>alert('" . $message . "'); history.back(); </script>";
exit;
}
$hkid = "";
$hkbr = "";
$companyname = "";
if ($_POST["customer_type"] == "BUSINESS") {
$hkbr = rsa_crypt($_POST["identity_id"], 1);
$companyname = $_POST["companyname"];
} else {
$hkid = rsa_crypt($_POST["identity_id"], 1);
}
$total_num_of_customer = count($customer_info);
$new_code_id = $total_num_of_customer + 1;
$password = random_string(15);
$encrypt_password = rsa_crypt($password, 1);
$customer_code = "C" . date("y") . str_pad($new_code_id, 4, "0", STR_PAD_LEFT);
$data = array(
"code" => $customer_code,
"typeid" => $_POST["customer_type"],
"title" => $_POST["title"],
"firstname" => rsa_crypt($_POST["firstname"], 1),
"lastname" => rsa_crypt($_POST["lastname"], 1),
"companyname" => $companyname,
"tel" => rsa_crypt($_POST["tel"], 1),
"email" => rsa_crypt($_POST["email"], 1),
"address" => rsa_crypt($_POST["address"], 1),
"hkid" => $hkid,
"hkbr" => $hkbr,
"loginid" => rsa_crypt($_POST["email"], 1),
"password" => $encrypt_password,
"createby" => $_SESSION['cmsloginid'],
"createdate" => $nowdate,
"lastupby" => $_SESSION['cmsloginid'],
"lastupdate" => $nowdate
);
$result = insert_record("customer", $data);
header("Location: customer_index.php?msg=新增成功");