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