| 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/innoutstorage2019/tc/ |
Upload File : |
<?php
require_once('../webadmin/basic_info.php');
$message = "";
if (empty($_POST["billing-form-master-room-id"])) {
$message .= "請選擇單位尺碼。\\n\\n";
}
if (empty($_POST["billing-form-month"])) {
$message .= "請選擇租月期。\\n\\n";
}
if (empty($_POST["billing-form-title"])) {
$message .= "請選擇頭銜。\\n\\n";
}
if (empty($_POST["billing-form-firstname"])) {
$message .= "請輸入名字。\\n\\n";
}
if (empty($_POST["billing-form-lastname"])) {
$message .= "請輸入姓氏。\\n\\n";
}
if (empty($_POST["billing-form-phone"])) {
$message .= "請輸入聯絡電話。\\n\\n";
}
if (empty($_POST["billing-form-email"])) {
$message .= "請輸入電郵。\\n\\n";
} else {
if (!filter_var($_POST["billing-form-email"], FILTER_VALIDATE_EMAIL)) {
$message .= "請輸入正確的電郵格式。";
}
}
if (empty($_POST["billing-form-address"])) {
$message .= "請輸入帳單地址。\\n\\n";
}
if (isset($_POST["billing-form-transervice"])) {
if(empty($_POST["billing-form-service-date"])){
$message .= "請選擇運輸日期。\\n\\n";
}else{
if(!validateDate($_POST["billing-form-service-date"], $format = 'Y-m-d')){
$message .= "請選擇正確的運輸日期。\\n\\n";
}
}
if(empty($_POST["billing-form-delivery-to"])){
$message .= "請輸入運輸地址。\\n\\n";
}
if(empty($_POST["billing-form-delivery-from"])){
$message .= "請輸入運輸目的地。\\n\\n";
}
}
if (empty($_POST["billing-form-agree"])) {
$message .= "請細閱及同意條款及細則。\\n\\n";
}
if (empty($_POST["g-recaptcha-response"])) {
$message .= "請進行驗證。\\n\\n";
}else{
$url = "https://www.google.com/recaptcha/api/siteverify";
$post_data = array("secret" => $google_recaptcha_secret_key, "response" => $_POST["g-recaptcha-response"]);
$result = call_curl($url, $post_data, 1);
$result_array = json_decode($result, true);
if(!$result_array["success"]){
$message .= "驗證無效。\\n\\n";
}
}
if(empty($_SESSION["selected_room_size_info"])){
$message .= "這個單位尺碼的迷你倉已租滿。\\n\\n";
}
if (!empty($message)) {
echo "<script>alert('" . $message . "'); history.back();</script>";
exit;
} else {
//order product
$_SESSION["warehousing_web"]["order_product"] = array();
//$_SESSION["warehousing_web"]["order_product_total"] = 0;
foreach($_POST["quantity"] as $key => $quantity){
if($quantity > 0){
$_SESSION["warehousing_web"]["order_product"][$key]["product_id"] = $_POST["product_id"][$key];
$_SESSION["warehousing_web"]["order_product"][$key]["qty"] = $_POST["quantity"][$key];
$product_info = get_product((int)$key);
$_SESSION["warehousing_web"]["order_product"][$key]["price"] = $product_info["price"];
//$_SESSION["warehousing_web"]["order_product_total"] += $_POST["quantity"][$key]*$product_info["price"];
}
}
$_SESSION["warehousing_web"]["master_room_id"] = $_POST["billing-form-master-room-id"];
$master_room_info = get_master_room($_POST["billing-form-master-room-id"]);
$_SESSION["warehousing_web"]["location_id"] = $master_room_info["location_id"];
$_SESSION["warehousing_web"]["roughly_size"] = $master_room_info["length"]*$master_room_info["width"]*$master_room_info["height"];
$_SESSION["warehousing_web"]["rent_month"] = $_POST["billing-form-month"];
$_SESSION["warehousing_web"]["room_id"] = $_SESSION["selected_room_size_info"]["room_id"];
$_SESSION["warehousing_web"]["total_amount"] = $_SESSION["selected_room_size_info"]["total_amount"];
$_SESSION["warehousing_web"]["deposit"] = $_SESSION["selected_room_size_info"]["deposit"];
$_SESSION["warehousing_web"]["discounted_price"] = $_SESSION["selected_room_size_info"]["discounted_price"];
$_SESSION["warehousing_web"]["retail_price"] = $_SESSION["selected_room_size_info"]["retail_price"];
$_SESSION["warehousing_web"]["first_month_half_price"] = $_SESSION["selected_room_size_info"]["first_month_half_price"];
$_SESSION["warehousing_web"]["order_discount"] = $_SESSION["selected_room_size_info"]["order_discount"];
if(isset($_POST["billing-form-prepaid"])){
$_SESSION["warehousing_web"]["prepaid"] = 1;
$_SESSION["warehousing_web"]["prepaid_month"] = $_POST["billing-form-month"];
$_SESSION["warehousing_web"]["prepaid_amount"] = $_SESSION["selected_room_size_info"]["discounted_price"]*$_POST["billing-form-month"]+$_SESSION["selected_room_size_info"]["deposit"];
}else{
$_SESSION["warehousing_web"]["prepaid"] = 0;
$_SESSION["warehousing_web"]["prepaid_month"] = 0;
$_SESSION["warehousing_web"]["prepaid_amount"] = 0;
}
/*if(isset($_POST["billing-form-recurring-payment"])){
$_SESSION["warehousing_web"]["auto_paid"] = true;
}else{
$_SESSION["warehousing_web"]["auto_paid"] = false;
}*/
//default use recurring payment
if($_SESSION["warehousing_web"]["rent_month"] > 1 && $_SESSION["warehousing_web"]["prepaid"] == 0){
$_SESSION["warehousing_web"]["auto_paid"] = true;
$_SESSION["warehousing_web"]["recurring_payment"] = 1;
}else{
$_SESSION["warehousing_web"]["auto_paid"] = false;
$_SESSION["warehousing_web"]["recurring_payment"] = 0;
}
//billing info
$_SESSION["warehousing_web"]["title"] = $_POST["billing-form-title"];
$_SESSION["warehousing_web"]["firstname"] = $_POST["billing-form-firstname"];
$_SESSION["warehousing_web"]["lastname"] = $_POST["billing-form-lastname"];
$_SESSION["warehousing_web"]["customer_type"] = $_POST["billing-form-customer-type"];
if($_POST["billing-form-customer-type"] == "BUSINESS"){
$_SESSION["warehousing_web"]["companyname"] = $_POST["billing-form-companyname"];
}else{
$_SESSION["warehousing_web"]["companyname"] = "";
}
$_SESSION["warehousing_web"]["tel"] = $_POST["billing-form-phone"];
$_SESSION["warehousing_web"]["email"] = $_POST["billing-form-email"];
$_SESSION["warehousing_web"]["address"] = $_POST["billing-form-address"];
if($_SESSION["selected_room_size_info"]["first_month_half_price"] > 0){
$_SESSION["warehousing_web"]["warehousing_date"] = $_POST["billing-form-warehousing-date"];
}else{
$_SESSION["warehousing_web"]["warehousing_date"] = date("Y-m-d");
}
$_SESSION["warehousing_web"]["rent_from"] = $_SESSION["warehousing_web"]["warehousing_date"];
$rent_to = new DateTime($_SESSION["warehousing_web"]["warehousing_date"]);
$rent_to->modify("+".$_POST["billing-form-month"]." month -1 day");
$_SESSION["warehousing_web"]["rent_to"] = $rent_to->format("Y-m-d");
if (isset($_POST["billing-form-transervice"])) {
$_SESSION["warehousing_web"]["transervice"] = 1;
$_SESSION["warehousing_web"]["service_date"] = $_POST["billing-form-service-date"];
$_SESSION["warehousing_web"]["delivery_from"] = $_POST["billing-form-delivery-from"];
$_SESSION["warehousing_web"]["delivery_to"] = $_POST["billing-form-delivery-to"];
}else{
$_SESSION["warehousing_web"]["transervice"] = 0;
$_SESSION["warehousing_web"]["service_date"] = "";
$_SESSION["warehousing_web"]["delivery_from"] = "";
$_SESSION["warehousing_web"]["delivery_to"] = "";
}
header("Location: confirm_rent.php");
}