Initial commit with updated Auth and media ignored

This commit is contained in:
Hamza-Ayed
2026-04-28 13:04:27 +03:00
commit 67af97474c
477 changed files with 66444 additions and 0 deletions

41
ride/mishwari/cancel.php Executable file
View File

@@ -0,0 +1,41 @@
<?php
require_once __DIR__ . '/../../connect.php';
// Fetch the input data
$id = filterRequest("id"); // Trip ID to identify the trip
$status = "cancelled"; // New status
// Check if the trip ID is provided
if (empty($id)) {
jsonError("Trip ID is missing.");
exit;
}
// Update the status of the trip to "cancelled"
$sql = "
UPDATE `mishwaritrips`
SET `status` = :status
WHERE `id` = :id AND `status` != 'cancelled'
";
$stmt = $con->prepare($sql);
$stmt->bindParam(':status', $status, PDO::PARAM_STR);
$stmt->bindParam(':id', $id, PDO::PARAM_INT); // Bind the ID parameter
// Execute the update
if ($stmt->execute()) {
// Check if the update was successful
if ($stmt->rowCount() > 0) {
// Trip status updated successfully
jsonSuccess(null, "Trip cancelled successfully.");
} else {
// No rows updated, meaning the trip might not have been found or was already cancelled
jsonError("No trip found to cancel.");
}
} else {
// Print failure if the update query failed
$errorInfo = $stmt->errorInfo();
error_log('SQL Error: ' . implode(", ", $errorInfo));
jsonError("Failed to cancel the trip.");
}
?>