Files
intaleq_v3_pure_php/serviceapp/addNotesPassenger.php
2026-04-28 13:04:27 +03:00

31 lines
804 B
PHP

<?php
require_once __DIR__ . '/../connect.php';
// Retrieve and sanitize input parameters
$phone = filterRequest("phone");
$note = filterRequest("note");
$editor = filterRequest("editor");
// Encrypt phone before storing
$encryptedPhone = $encryptionHelper->encryptData($phone);
// SQL query to insert into notesForPassengerService
$sql = "INSERT INTO `notesForPassengerService` (`phone`, `note`, `editor`)
VALUES (:phone, :note, :editor)";
// Prepare the statement
$stmt = $con->prepare($sql);
$stmt->bindParam(':phone', $encryptedPhone);
$stmt->bindParam(':note', $note);
$stmt->bindParam(':editor', $editor);
// Execute and respond
$stmt->execute();
if ($stmt->rowCount() > 0) {
jsonSuccess(null, "Note inserted successfully");
} else {
jsonError("Failed to insert note");
}
?>