Initial commit with updated Auth and media ignored
This commit is contained in:
31
serviceapp/addNotesPassenger.php
Normal file
31
serviceapp/addNotesPassenger.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?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");
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user