| 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');
//checking
$message = "";
if(!isset($_POST["is_onlinesales"])){
$message .= "請選擇可否在網上預訂此尺寸的倉。\\n\\n";
}else{
if($_POST["is_onlinesales"] == 1){
if(!is_numeric($_POST["remain_room"]) || $_POST["remain_room"] < 0){
$message .= "保留單位須為數字。\\n\\n";
}else{
if($_POST["remain_room"] > $_POST["total_room"]){
$message .= "保留單位不能大於單位總數。\\n\\n";
}else{
$remain_room = $_POST["remain_room"];
}
}
}else{
$remain_room = 0;
}
}
if(empty($_POST["retail_price"])){
$message .= "請輸入原價。\\n\\n";
}else{
if(!empty($_POST["retail_price"]) && !is_numeric($_POST["retail_price"])){
$message .= "原價必須為正數數字。\\n\\n";
}
}
if($_POST["has_discounted_price"] == 1){
if(!empty($_POST["discounted_price"]) && !is_numeric($_POST["discounted_price"])){
$message .= "優惠價必須為正數數字。\\n\\n";
}
if(!empty($_POST["retail_price"]) && !empty($_POST["discounted_price"]) && $_POST["discounted_price"] > $_POST["retail_price"]){
$message .= "優惠價不能大於原價。\\n\\n";
}
if(!empty($_POST["effectivedate_from"]) && !validateDate($_POST["effectivedate_from"], "Y-m-d")){
$message .= "請輸入正確的開始日期。\\n\\n";
}
if(!empty($_POST["effectivedate_to"]) && !validateDate($_POST["effectivedate_to"], "Y-m-d")){
$message .= "請輸入正確的完結日期。\\n\\n";
}
if(!empty($_POST["effectivedate_from"]) && !empty($_POST["effectivedate_to"]) && $_POST["effectivedate_from"] > $_POST["effectivedate_to"]){
$message .= "開始日期不能大於完結日期。\\n\\n";
}
}
if(!empty($message)){
echo "<script>alert('".$message."'); history.back();</script>";
exit;
}
$master_room_id = (int)$_POST["master_room_id"];
$discounted_price = $_POST["discounted_price"];
$effectivedate_from = $_POST["effectivedate_from"];
$effectivedate_to = $_POST["effectivedate_to"];
$master_room_info = get_master_room($master_room_id);
//update master_room
/*$sql = "update master_room set has_discounted_price=?, length=?, width=?, height=?, is_onlinesales=?, remain_room=?, lastupdate=?, lastupby=? where id = ?";
$parameters = array($_POST["has_discounted_price"], $_POST["length"], $_POST["width"], $_POST["height"], $_POST["is_onlinesales"], $remain_room, $nowdate, $_SESSION['cmsloginid'], $master_room_id);*/
$sql = "update master_room set has_discounted_price=?, is_onlinesales=?, remain_room=?, lastupdate=?, lastupby=? where id = ?";
$parameters = array($_POST["has_discounted_price"], $_POST["is_onlinesales"], $remain_room, $nowdate, $_SESSION['cmsloginid'], $master_room_id);
bind_pdo($sql, $parameters);
//new add for same display size
$sql = "update master_room set has_discounted_price=?, lastupdate=?, lastupby=? where length = ? and width = ? and height = ? and type = ?";
$parameters = array($_POST["has_discounted_price"], $nowdate, $_SESSION['cmsloginid'], $master_room_info["length"], $master_room_info["width"], $master_room_info["height"], $master_room_info["type"]);
bind_pdo($sql, $parameters);
//update and pricelist table
/*$result = same_size_master_room($master_room_id);
if(!empty($result)){
foreach ($result as $row){*/
//$master_room_id = $master_room_id;
if($_POST["has_discounted_price"] == 1){
$sql = "update master_room_price set retail_price=?, discounted_price=?, effectivedate_from=?, effectivedate_to=?, lastupdate=?, lastupby=? where master_room_id = ?";
$parameters = array(round($_POST["retail_price"], 1), round($_POST["discounted_price"], 1), $_POST["effectivedate_from"], $_POST["effectivedate_to"], $nowdate, $_SESSION['cmsloginid'], $master_room_id);
}else{
$sql = "update master_room_price set retail_price=?, discounted_price=?, effectivedate_from=?, effectivedate_to=?, lastupdate=?, lastupby=? where master_room_id = ?";
$parameters = array(round($_POST["retail_price"], 1), round($_POST["retail_price"]), NULL, NULL, $nowdate, $_SESSION['cmsloginid'], $master_room_id);
}
bind_pdo($sql, $parameters);
/*}
}*/
$dbh = null;
header("Location: master_room_index.php?msg=修改成功&location_id=".(int)$_POST["location_id"]);