Update: 2026-06-11 18:22:57

This commit is contained in:
Hamza-Ayed
2026-06-11 18:22:59 +03:00
parent c5170a88d2
commit 727068b668
629 changed files with 46050 additions and 46109 deletions

View File

@@ -0,0 +1,36 @@
<?php
include "../../connect.php";
$passengerID = filterRequest("passengerID");
$driverID = filterRequest("driverID");
$rideID = filterRequest("rideID");
$tipAmount = filterRequest("tipAmount");
// Validate tipAmount to ensure it fits within the column's allowed range
if (!is_numeric($tipAmount) || $tipAmount < 0 || $tipAmount > 99999999.99) {
printFailure("Invalid tip amount.");
exit();
}
// Assuming your `created_at` column is of type TIMESTAMP and has the default value CURRENT_TIMESTAMP
$sql = "INSERT INTO `tips`(`id`, `driverID`, `passengerID`, `rideID`, `tipAmount`) VALUES (null, :driverID, :passengerID, :rideID, :tipAmount)";
$stmt = $con->prepare($sql);
// Bind parameters to prevent SQL injection
$stmt->bindParam(':driverID', $driverID);
$stmt->bindParam(':passengerID', $passengerID);
$stmt->bindParam(':rideID', $rideID);
$stmt->bindParam(':tipAmount', $tipAmount);
$stmt->execute();
if ($stmt->rowCount() > 0) {
// Print a success message
printSuccess($message = 'Tip inserted successfully');
} else {
// Print a failure message
printFailure($message = "Failed to save tip information");
}
?>

View File

@@ -0,0 +1,32 @@
<?php
include "../../connect.php";
$driverID = filterRequest("driverID");
$passendgerID = filterRequest("passendgerID");
$sql = "SELECT
`id`,
`driverID`,
`passendgerID`,
`rideID`,
`tipAmount`
FROM
`tips`
WHERE
`driverID`='$driverID'OR`passendgerID`='$passendgerID'";
$stmt = $con->prepare($sql);
$stmt->execute();
if ($stmt->rowCount() > 0) {
// Fetch the record
$row = $stmt->fetchAll(PDO::FETCH_ASSOC);
$count = $stmt->rowCount();
printSuccess( $row);
}
else{
// Print a failure message
printFailure($message = "No wallet record found");
}
?>