Files
Siro/backend/ride/notificationPassenger/add.php
2026-06-09 08:40:31 +03:00

33 lines
627 B
PHP
Executable File

<?php
require_once __DIR__ . '/../../connect.php';
$title = filterRequest("title");
$body = filterRequest("body");
$passengerID = filterRequest("passenger_id");
// SQL الآمن باستخدام placeholders
$sql = "INSERT INTO `notifications` (
`title`,
`body`,
`passenger_id`
) VALUES (
:title,
:body,
:passengerID
)";
$stmt = $con->prepare($sql);
$stmt->execute([
':title' => $title,
':body' => $body,
':passengerID' => $passengerID
]);
if ($stmt->rowCount() > 0) {
jsonSuccess(null, "Notification data saved successfully");
} else {
jsonError("Failed to save notification data");
}
?>