| 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_id"]) || empty($_POST["customer_type"]) || (int)$_POST["customer_id"] <= 0) {
$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_id"] != $customer["id"] && $_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_id"] != $customer["id"] && $_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;
}
$customer_info = get_customer($_POST["customer_id"]);
if ($_POST["customer_type"] == "BUSINESS") {
$hkbr = rsa_crypt($_POST["identity_id"], 1);
$sql = "update customer set typeid = ?, hkbr = ?, companyname = ?, lastupby = ?, lastupdate = ? where id=?";
$parameters = array($_POST["customer_type"], $hkbr, $_POST["companyname"], $_SESSION["cmsloginid"], $nowdate, (int)$_POST["customer_id"]);
bind_pdo($sql, $parameters);
$sql = "update `order` set customer_hkbr = ?, customer_companyname = ? where customer_code = ? and customer_hkbr IS NULL and status = ?";
$parameters = array($hkbr, $customer_info["code"], $_POST["companyname"], "NEW");
bind_pdo($sql, $parameters);
} else {
$hkid = rsa_crypt($_POST["identity_id"], 1);
$sql = "update customer set typeid = ?, hkid = ?, companyname = ?, lastupby = ?, lastupdate = ? where id=?";
$parameters = array($_POST["customer_type"], $hkid, "", $_SESSION["cmsloginid"], $nowdate, (int)$_POST["customer_id"]);
bind_pdo($sql, $parameters);
$sql = "update `order` set customer_hkid = ?, customer_companyname = ? where customer_code = ? and customer_hkid IS NULL and status = ?";
$parameters = array($hkid, "", $customer_info["code"], "NEW");
bind_pdo($sql, $parameters);
}
$sql = "update customer set title = ?, lastname = ?, firstname = ?, tel = ?, email = ?, address = ? where id=?";
$parameters = array($_POST["title"], rsa_crypt($_POST["lastname"], 1), rsa_crypt($_POST["firstname"], 1), rsa_crypt($_POST["tel"], 1), rsa_crypt($_POST["email"], 1), rsa_crypt($_POST["address"], 1), (int)$_POST["customer_id"]);
bind_pdo($sql, $parameters);
header("Location: customer_modifyform.php?id=" . (int)$_POST["customer_id"] . "&msg=修改成功");