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.
45 lines
1.5 KiB
45 lines
1.5 KiB
<?php
|
|
require_once "database.php";
|
|
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
|
$input = &$_POST;
|
|
$data = array_reduce(array(
|
|
"responder", "progress", "replyinput"
|
|
), function ($acc, $key) use ($input) {
|
|
switch ($key) {
|
|
default:
|
|
$acc[$key] = htmlspecialchars(stripslashes(trim($input[$key]))) ?: null;
|
|
}
|
|
return $acc;
|
|
}, array());
|
|
|
|
$db_query = "UPDATE ngfeedback as ng
|
|
INNER JOIN (
|
|
SELECT
|
|
? as id,
|
|
? as responder,
|
|
? as progress,
|
|
CONCAT(f_return_account_name(?), '(', ?, ') ', ?) as replyinput,
|
|
CURRENT_TIMESTAMP as reply_at
|
|
) as reply ON reply.id = ng.id
|
|
SET
|
|
ng.responder = reply.responder,
|
|
ng.replyhistory = CONCAT(IFNULL(ng.replyhistory, ''), IF(ng.replyhistory IS NULL, '', CHAR(10)), '[', reply.reply_at, '] ', reply.replyinput),
|
|
ng.reply_at = reply.reply_at,
|
|
ng.progress = reply.progress";
|
|
$stmt = $link->prepare($db_query);
|
|
$stmt->bind_param("isisss", $_POST["no"], $data["responder"], $data["progress"], $_POST["user_id"], $_POST["user_id"], $data["replyinput"]);
|
|
$stmt->execute();
|
|
|
|
if (mysqli_affected_rows($link) > 0) {
|
|
echo "<script type ='text/JavaScript'>";
|
|
echo "alert('更新成功');";
|
|
echo "window.location.href='/wms/ngfeedback-index.php?function_name=ngfeedback&token=".$_POST["token"]."';";
|
|
echo "</script>";
|
|
//header("Location: pricereview-index.php");
|
|
} else {
|
|
echo "<script type ='text/JavaScript'>";
|
|
echo "alert('更新失敗,請重新操作[I]')";
|
|
echo "</script>";
|
|
}
|
|
}
|
|
?>
|