You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

147 lines
9.3 KiB

<?php
require_once "database.php";
if (isset($_POST['update'])) {
foreach ($_POST as $k => $v) {
$$k = htmlspecialchars(stripslashes(trim($v)));
}
$updater = substr($_COOKIE["token"], 0, strpos($_COOKIE["token"],"."));
$pr_item_id = explode("", $pritem)[0];
$pr_item_id = (!$pr_item_id) ? 0 : $pr_item_id;
$top_height = str_replace(",", "", $top_height);
$bottom_height = str_replace(",", "", $bottom_height);
$vdist = str_replace(",", "", $vdist);
$tunnel_width = str_replace(",", "", $tunnel_width);
$tunnel_depth = str_replace(",", "", $tunnel_depth);
$theight = str_replace(",", "", $theight);
$car_width = str_replace(",", "", $car_width);
$car_depth = str_replace(",", "", $car_depth);
$car_height = str_replace(",", "", $car_height);
$pre_weight = str_replace(",", "", $pre_weight);
$lop_info = json_encode([$lop_info1, $lop_info2, $lop_info3, $lop_info4], JSON_UNESCAPED_UNICODE);
$opb1_info = json_encode([$opb1_info1, $opb1_info2, $opb1_info3], JSON_UNESCAPED_UNICODE);
$opb2_info = json_encode([$opb2_info1, $opb2_info2, $opb2_info3], JSON_UNESCAPED_UNICODE);
$handicap_opb1 = json_encode([$handicap_opb1_1, $handicap_opb1_2, $handicap_opb1_3], JSON_UNESCAPED_UNICODE);
$handicap_opb2 = json_encode([$handicap_opb2_1, $handicap_opb2_2, $handicap_opb2_3], JSON_UNESCAPED_UNICODE);
$side_info[0] = [$side_type_f, $side_thick_f, $side_color_f, $side_memo_f];
$side_info[1] = [$side_type_b, $side_thick_b, $side_color_b, $side_memo_b];
$side_info[2] = [$side_type_bm, $side_thick_bm, $side_color_bm, $side_memo_bm];
$side_info[3] = [$side_type_r, $side_thick_r, $side_color_r, $side_memo_r];
$side_info[4] = [$side_type_rm, $side_thick_rm, $side_color_rm, $side_memo_rm];
$side_info = json_encode($side_info, JSON_UNESCAPED_UNICODE);
$equip_info_door = json_encode([$equip_info_door1, $equip_info_door2, $equip_info_door3, $equip_info_door4], JSON_UNESCAPED_UNICODE);
$equip_info_layer[0] = [$equip_info_layer11, $equip_info_layer12, $equip_info_layer13, $equip_info_layer14];
$equip_info_layer[1] = [$equip_info_layer21, $equip_info_layer22, $equip_info_layer23, $equip_info_layer24];
$equip_info_layer = json_encode($equip_info_layer, JSON_UNESCAPED_UNICODE);
$equip_info_sfram[0] = [$equip_info_sfram11, $equip_info_sfram12, $equip_info_sfram13, $equip_info_sfram14];
$equip_info_sfram[1] = [$equip_info_sfram21, $equip_info_sfram22, $equip_info_sfram23, $equip_info_sfram24];
$equip_info_sfram = json_encode($equip_info_sfram, JSON_UNESCAPED_UNICODE);
$equip_info_bfram[0] = [$equip_info_bfram11, $equip_info_bfram12, $equip_info_bfram13, $equip_info_bfram14];
$equip_info_bfram[1] = [$equip_info_bfram21, $equip_info_bfram22, $equip_info_bfram23, $equip_info_bfram24];
$equip_info_bfram[2] = [$equip_info_bfram3];
$equip_info_bfram = json_encode($equip_info_bfram, JSON_UNESCAPED_UNICODE);
$foreign_three = ($foreign_three) ? "Y" : "N";
$gate_corbel = ($gate_corbel) ? "Y" : "N";
$safety_gear = ($safety_gear) ? "Y" : "N";
$air_kolin = ($air_kolin) ? "Y" : "N";
$purifier = ($purifier) ? "Y" : "N";
$crt = ($crt) ? "Y" : "N";
$gong = ($gong) ? "Y" : "N";
$eq_control = ($eq_control) ? "Y" : "N";
$voice = ($voice) ? "Y" : "N";
$ard = ($ard) ? "Y" : "N";
$energy_feedback = ($energy_feedback) ? "Y" : "N";
$rs485 = ($rs485) ? "Y" : "N";
$ins = ($ins) ? "Y" : "N";
$ibd = ($ibd) ? "Y" : "N";
$fire_alarm = ($fire_alarm) ? "Y" : "N";
$uv = ($uv) ? "Y" : "N";
$voice_control = ($voice_control) ? "Y" : "N";
$opec_spec = ($opec_spec) ? "Y" : "N";
$opec_spec_driver = ($opec_spec_driver) ? "Y" : "N";
$is_units_y = ($is_units_y) ? "Y" : "N";
if ($is_units_y=="N") $is_units = 0;
$is_units = json_encode([$is_units_y, $is_units], JSON_UNESCAPED_UNICODE);
$face_rec_y = ($face_rec_y) ? "Y" : "N";
if ($face_rec_y=="N") $face_rec = "";
$face_rec = json_encode([$face_rec_y, $face_rec], JSON_UNESCAPED_UNICODE);
$car_cam_y = ($car_cam_y) ? "Y" : "N";
if ($car_cam_y=="N") $car_cam = "";
$car_cam = json_encode([$car_cam_y, $car_cam], JSON_UNESCAPED_UNICODE);
$painting_y = ($painting_y) ? "Y" : "N";
if ($painting_y=="N") $painting_m = $painting_c = "";
$painting = json_encode([$painting_y, $painting_m, $painting_c], JSON_UNESCAPED_UNICODE);
$ib_y = ($ib_y) ? "Y" : "N";
if ($ib_y=="N") { $ib1 = 0; $ib2 = ""; };
$ib = json_encode([$ib_y, $ib1, $ib2], JSON_UNESCAPED_UNICODE);
$kanban_y = ($kanban_y) ? "Y" : "N";
if ($kanban_y=="N") $kanban = "";
$kanban = json_encode([$kanban_y, $kanban], JSON_UNESCAPED_UNICODE);
$lamp_y = ($lamp_y) ? "Y" : "N";
if ($lamp_y=="N") { $lamp2 = 0; $lamp1 = $lamp3 = ""; };
$lamp = json_encode([$lamp_y, $lamp1, $lamp2, $lamp3], JSON_UNESCAPED_UNICODE);
$smart_call_y = ($smart_call_y) ? "Y" : "N";
if ($smart_call_y=="N") $smart_call = "";
$smart_call = json_encode([$smart_call_y, $smart_call], JSON_UNESCAPED_UNICODE);
$access_car_y = ($access_car_y) ? "Y" : "N";
if ($access_car_y=="N") $access_car = "";
$access_car = json_encode([$access_car_y, $access_car], JSON_UNESCAPED_UNICODE);
$access_hall_y = ($access_hall_y) ? "Y" : "N";
if ($access_hall_y=="N") $access_hall = "";
$access_hall = json_encode([$access_hall_y, $access_hall], JSON_UNESCAPED_UNICODE);
$db_query = "update specsurvey_main set pr_item_id = '$pr_item_id', version = '$version', contractno = '$contractno', company = '$company', facilitok_date = '$facilitok_date', ";
$db_query .= "tai_count = '$tai_count', serial = '$serial', rtype = '$rtype', weight = '$weight', speed = '$speed', numberoffloor = '$numberoffloor', ";
$db_query .= "numberofstop = '$numberofstop', numberofdoor = '$numberofdoor', door_type = '$door_type', usefor = '$usefor', class = '$class', ";
$db_query .= "oper_method = '$oper_method', serial_duplex_group = '$serial_duplex_group', area = '$area', address = '$address', use_situ = '$use_situ', ";
$db_query .= "mpower = '$mpower', lpower = '$lpower', top_height = '$top_height', bottom_height = '$bottom_height', vdist = '$vdist', ";
$db_query .= "tunnel_width = '$tunnel_width', tunnel_depth = '$tunnel_depth', theight = '$theight', tunnel = '$tunnel', ";
$db_query .= "updater = '$updater', update_dt = NOW() ";
$db_query .= "where id = '$id'";
if ($rs = mysqli_query($link, $db_query)) {
$db_query = "update specsurvey_car set car_width = '$car_width', car_depth = '$car_depth', car_height = '$car_height', well = '$well', ";
$db_query .= "material = '$material', floor = '$floor', floor_type = '$floor_type', floor_prethick = '$floor_prethick', car_handrail = '$car_handrail', ";
$db_query .= "car_handrail_loc = '$car_handrail_loc', mirror = '$mirror', pre_weight = '$pre_weight', pre_thick = '$pre_thick', ";
$db_query .= "lop_info = '$lop_info', opb_wall = '$opb_wall', opb1_info = '$opb1_info', rf_wall = '$rf_wall', side_opb2 = '$side_opb2', ";
$db_query .= "opb2_info = '$opb2_info', handicap_opb1 = '$handicap_opb1', handicap_opb2 = '$handicap_opb2', side_info = '$side_info' ";
$db_query .= "where mid = '$id'";
if ($rs = mysqli_query($link, $db_query)) {
$db_query = "update specsurvey_door set door_f_floor = '$door_f_floor', door_r_floor = '$door_r_floor', dooropen_type = '$dooropen_type', ";
$db_query .= "firedoor = '$firedoor', dooropen_width = '$dooropen_width', dooropen_height = '$dooropen_height', door_safety = '$door_safety', ";
$db_query .= "equip_info_door = '$equip_info_door', equip_info_layer = '$equip_info_layer', equip_info_sfram = '$equip_info_sfram', ";
$db_query .= "equip_info_bfram = '$equip_info_bfram' ";
$db_query .= "where mid = '$id'";
if ($rs = mysqli_query($link, $db_query)) {
$db_query = "update specsurvey_function set foreign_three = '$foreign_three', gate_corbel = '$gate_corbel', safety_gear = '$safety_gear', ";
$db_query .= "air_kolin = '$air_kolin', purifier = '$purifier', is_units = '$is_units', crt = '$crt', face_rec = '$face_rec', gong = '$gong', ";
$db_query .= "eq_control = '$eq_control', voice = '$voice', ard = '$ard', energy_feedback = '$energy_feedback', rs485 = '$rs485', ";
$db_query .= "car_cam = '$car_cam', painting = '$painting', ins = '$ins', ib = '$ib', ibd = '$ibd', fire_alarm = '$fire_alarm', ";
$db_query .="kanban = '$kanban', uv = '$uv', voice_control = '$voice_control', lamp = '$lamp', smart_call = '$smart_call', access_car = '$access_car', ";
$db_query .= "access_hall = '$access_hall', opec_spec = '$opec_spec', opec_spec_driver = '$opec_spec_driver', note = '$note', prddetail = '$prddetail' ";
$db_query .= "where mid = '$id'";
mysqli_query($link, $db_query);
$ok_flag = 1;
}
}
}
mysqli_close($link);
if ($ok_flag) {
echo "<script type ='text/JavaScript'>";
echo "alert('update成功');";
echo "location.href = 'specsurvey-index.php';";
echo "</script>";
}
else {
echo "<script type ='text/JavaScript'>";
echo "alert('無新增資料');";
echo "location.href = 'specsurvey-index.php';";
echo "</script>";
}
}
?>