aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--edit.php23
-rw-r--r--request-edit.js2
2 files changed, 22 insertions, 3 deletions
diff --git a/edit.php b/edit.php
index 5bc5b42..f272577 100644
--- a/edit.php
+++ b/edit.php
@@ -21,6 +21,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_SESSION['admin']) && $_SESSI
try {
$recvData = json_decode(file_get_contents("php://input"));
+
$recvData->id = clear_input($recvData->id);
$recvData->approved = filter_var($recvData->approved, FILTER_VALIDATE_BOOLEAN);
$recvData->specialCall = clear_input($recvData->specialCall);
@@ -34,10 +35,19 @@ if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_SESSION['admin']) && $_SESSI
$recvData->operatorPhone = clear_input($recvData->operatorPhone);
$recvData->qso = clear_input($recvData->qso);
+ //foreach ($recvData as $key => $value) {
+ //if ($key == "approved")
+ //$recvData->approved = filter_var($recvData->approved, FILTER_VALIDATE_BOOLEAN);
+ //else
+ //$recvData->$key = clear_input($recvData->$key);
+ //}
+
$recvData->$specialCall = strtoupper($recvData->$specialCall);
$recvData->$modes = strtoupper($recvData->$modes);
$recvData->$operatorCall = strtoupper($recvData->$operatorCall);
+ //print_r($recvData);
+
} catch (Exception $e) {
die("Can't decode JSON!");
}
@@ -61,6 +71,11 @@ if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_SESSION['admin']) && $_SESSI
$recvData->approved = $recvData->approved === true ? "1" : "0";
$stmt = $conn->prepare($sql);
+
+ //foreach ($recvData as $key => $value) {
+ //$stmt->bindParam(':'.$key, $recvData->$key);
+ //}
+
$stmt->bindParam(':id', $recvData->id);
$stmt->bindParam(':approved', $recvData->approved);
$stmt->bindParam(':specialCall', $recvData->specialCall);
@@ -73,6 +88,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_SESSION['admin']) && $_SESSI
$stmt->bindParam(':operatorEmail', $recvData->operatorEmail);
$stmt->bindParam(':operatorPhone', $recvData->operatorPhone);
$stmt->bindParam(':qso', $recvData->qso);
+
$stmt->execute();
$sendData->action=$recvData->action;
@@ -88,10 +104,13 @@ if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_SESSION['admin']) && $_SESSI
$sendData = null;
$sendData->action=$recvData->action;
- $sendData->id=$row["id"];
- $sendData->approved=$row["approved"];
+ //foreach ($row as $key => $value) {
+ //$sendData->$key = $value;
+ //}
+ $sendData->id=$row["id"];
+ $sendData->approved=$row["approved"];
$sendData->specialCall=$row["specialCall"];
$sendData->fromTime=$row["fromTime"];
$sendData->toTime=$row["toTime"];
diff --git a/request-edit.js b/request-edit.js
index f6d2c05..3a9e7ba 100644
--- a/request-edit.js
+++ b/request-edit.js
@@ -13,7 +13,7 @@ function btnAction(action, btn) {
frequencies: trData[6].firstElementChild.innerHTML,
modes: trData[7].firstElementChild.innerHTML,
specialCall: trData[8].firstElementChild.innerHTML,
- operatorName: trData[9].firstElementChild.innerHTML,
+ operatorName: trData[9].firstElementChild.innerText,
operatorEmail: trData[10].firstElementChild.innerHTML,
operatorPhone: trData[11].firstElementChild.innerHTML
}