aboutsummaryrefslogtreecommitdiff
path: root/edit.php
diff options
context:
space:
mode:
authorMateja <mail@matejamaric.com>2020-10-04 17:40:30 +0200
committerMateja <mail@matejamaric.com>2020-10-04 17:40:30 +0200
commite853c2949930fdbf64639893a30565531bf5be9d (patch)
tree6e69ed60e886aa73733c3f955ee3decc3c43d601 /edit.php
parentfccd2808992596aed2f5252ba033b958c8e096fc (diff)
downloadold-php-yota-e853c2949930fdbf64639893a30565531bf5be9d.tar.gz
old-php-yota-e853c2949930fdbf64639893a30565531bf5be9d.zip
found a bug when sending td content
Diffstat (limited to 'edit.php')
-rw-r--r--edit.php23
1 files changed, 21 insertions, 2 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"];