Update: 2026-06-11 18:22:57
This commit is contained in:
36
walletintaleq.intaleq.xyz/v2/main/ride/tips/add.php
Executable file
36
walletintaleq.intaleq.xyz/v2/main/ride/tips/add.php
Executable 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");
|
||||
}
|
||||
?>
|
||||
32
walletintaleq.intaleq.xyz/v2/main/ride/tips/get.php
Normal file
32
walletintaleq.intaleq.xyz/v2/main/ride/tips/get.php
Normal 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");
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user