| 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-title"])) {
$message .= "請選擇單位尺碼。\\n\\n";
}
if (empty($_POST["billing-form-name"])) {
$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-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($message)) {
echo "<script>alert('" . $message . "'); history.back();</script>";
exit;
} else {
check_and_update_reserved_room();
$master_room_id = (int)$_POST["billing-form-title"];
$this_master_room_info = get_master_room($master_room_id);
$available_master_master_room_info = get_master_room_by_display_size($this_master_room_info["display_size"]);
if (empty($available_master_master_room_info)) {
$available_master_master_room_id = array($master_room_id);
} else {
foreach ($available_master_master_room_info as $available_master_room_info) {
$available_master_master_room_id[] = $available_master_room_info["id"];
}
}
foreach ($available_master_master_room_id as $this_master_room_id) {
//get room id
$sql = "select * from room where status = ? and deleted = ? and master_room_id = ?";
$parameters = array("OPEN", 0, $this_master_room_id);
$room_info = bind_pdo($sql, $parameters, "selectone");
$room_id = $room_info["id"];
break;
}
if (empty($room_id) || $room_id <= 0) {
echo "<script>alert('這個單位尺碼的迷你倉已租滿。'); history.back();</script>";
exit;
}
//update this room status to reserve, need to check how many room allow for online
$start_date = new DateTime();
$end_date = new DateTime();
$end_date->modify('+1 day');
$sql = "update room set status = ?, reserve_by_name = ?, reserve_by_tel = ?, reserve_by_email = ?, reservedate_from = ?, reservedate_to = ? where id = ? and status = ?";
$parameters = array("RESERVED", $_POST["billing-form-name"], $_POST["billing-form-phone"], $_POST["billing-form-email"], $start_date->format('Y-m-d H:i:s'), $end_date->format('Y-m-d H:i:s'), $room_id, "OPEN");
$update_room_result = bind_pdo($sql, $parameters);
if (empty($update_room_result)) {
echo "<script>alert('這個單位尺碼的迷你倉已租滿。'); history.back();</script>";
exit;
}else{
//reserve email
$email_subject = "網上預訂迷你倉";
//email content to customer
ob_start();
?>
<html>
<head>
<META name=GENERATOR content="MSHTML 8.00.6001.19394">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="font-family:arial,helvetica,sans-serif!important;color:#000;background:#fff;">
尊貴的客戶,<br><br>
我們己收到你的預訂迷你倉要求,請在二十四小時內到我們的辦公室完成租倉程序。
<br><br>
<table>
<tr>
<td valign="top">單位尺碼(長x闊x高):</td>
<td valign="top"><?= $this_master_room_info["display_size"] ?></td>
</tr>
<tr>
<td valign="top">姓名:</td>
<td valign="top"><?= ($_POST["billing-form-name"]); ?></td>
</tr>
<tr>
<td valign="top">聯絡電話:</td>
<td valign="top"><?= $_POST["billing-form-phone"] ?></td>
</tr>
<tr>
<td valign="top">電郵:</td>
<td valign="top"><?= $_POST["billing-form-email"] ?></td>
</tr>
</table>
<br><br><br><br>
<?= $site_info{"companyname_" . $langcode} ?><br>
<a href='<?= $site_info{"url"} ?>' target='_blank'><?= $site_info{"url"} ?></a>
</body>
</html>
<?php
$email_body = ob_get_contents();
ob_end_clean();
$enquiryemail = $site_info{"enquiryemail"};
$company_name = $site_info{"companyname_" . $langcode};
//for customer
$x_mail = new PHPMailer();
$x_mail->CharSet = "UTF-8";
$x_mail->Sender = $enquiryemail;
$x_mail->AddReplyTo($enquiryemail, $company_name);
$x_mail->From = $enquiryemail;
$x_mail->FromName = $company_name;
//send to user not send to client
if(PRODUCTION == 1){
$x_mail->AddAddress($_POST["billing-form-email"], $_POST["billing-form-name"]);
}else{
$x_mail->AddAddress($enquiryemail, $company_name);
$x_mail->AddBCC("skycheng@onesolution.com.hk", $company_name);
}
$x_mail->WordWrap = 50;
$x_mail->IsHTML(true);
$x_mail->Subject = $email_subject;
$x_mail->Body = $email_body;
if ($x_mail->Send()) {
} else {
}
header("Location: thankyou_reserve.php");
exit;
}
}