Update: 2026-06-11 19:26:42

This commit is contained in:
Hamza-Ayed
2026-06-11 19:26:42 +03:00
parent 727068b668
commit b87477bec4
371 changed files with 67 additions and 14257 deletions

View File

@@ -9,7 +9,7 @@ $tipAmount = filterRequest("tipAmount");
$countryCode = filterRequest("country_code"); // sent from flutter
// تحقق من صحة قيمة البقشيش
if (!is_numeric($tipAmount) || $tipAmount <= 0 || $tipAmount > 99999999.99) {
if (!is_numeric($tipAmount) || $tipAmount <= 0 || $tipAmount > 599.99) {
echo json_encode(["status" => "failure", "message" => "Invalid tip amount."]);
exit();
}

Binary file not shown.

View File

@@ -1,17 +0,0 @@
PASS=@:1F62hwYsdmju^1RpXrXlBl
USER=seferli1_spd563608XrXlBl
USERNAME=hamzaphFlut@g.cXrXlBl
PASSWORD=malFlu@2101Ham
SECRET_KEY=seferegypt
CLAUDAISEFER=zg-qbc-qvo39-n4VdMQ5nuJeIYhMN4PDYr7qox3-t2i1Lh7aNTDfYF-Gf8whUJZCs47EeelKn8_UcmUMmiSLaf0UJg0DvUlQrDt-76CRrkQQXrXlBl
PASSWORDPAYMOB=g@nkD2#99!hD_.wXrXlBl
PAYMOBOUTCLIENTSECRET=xyjjRlahJM0Xc38WjApCOh8bvgL9slFpNdM9YeCu9AhLqboKMPtmSvc2N9O4tXxFLV2JAV6stBSTAGFGCVubGe6MNpc7MzJnZ3SiT6GpavBoCLWkUvVbdSDaM0zHvuBOXrXlBl
PAYMOBOUTCLIENT_ID=Z05ut48dVkS2gI2zenFFcKsfDKfHAU0WELqKyJ0LXrXlBl
PayPalClientIdLive=QZFjAoZfGtngNserll6r3cC56Xl1sVLQkn5dMbyebhzJY59EQ3hz7YxaEqEDYPTUFcQWqvePaQ5UJJVRXrXlBl
SMSPASSWORDEGYPT=J)Vh=qb/@MXrXlBl
OCP-APIM-SUBSCRIPTION-KEY=3u5yqfffyxfj0797x7q5u851882931j9XrXlBl
visionApi=3pALsqSSYTvzp69Q5FMIgbzjG6Z1zktJXrXlBl
payPalSecretLive=JQDATqnDfiFpEAN60KB4pGpDaJjyqBAd9jxMBPpzWU1P1k3H1jZhQjn73EHsKQna74P8p98hgOnMaWPWXrXlBl
publishableKeyStripe=vg_ropj_57Iiv6MFCBFq3C2n6kNJnZByV6nuDtXe9IjEPOfhmpDtWmt3MLR0gQpiHcQmAFMUPrZc3QiCDjxBZLbxDC3efxWxz33bWH1ZgrsXrXlBl
secretKeyStripe=zg_ropj_57Iiv6MFCBFq3C2n6IXlmjykpxDmW93SW3vvXh68UA9T5FORTWgWsT37StKsOPdwDdsy8qR9srMUluahs3nPHvgBa33tGk90vV5XrXlBl
passwordnewpassenger=unknown

View File

@@ -1,6 +0,0 @@
# DO NOT REMOVE OR MODIFY. CLOUDLINUX ENV VARS CONFIGURATION BEGIN
<IfModule Litespeed>
SetEnv appId 12994c6e707543e68d5638894d04f989
SetEnv appCertificate e21a388f83034a159f2783889a6d7bcf
</IfModule>
# DO NOT REMOVE OR MODIFY. CLOUDLINUX ENV VARS CONFIGURATION END

Binary file not shown.

View File

@@ -1,103 +0,0 @@
<?php
include "../../connect.php";
$sql = "SELECT
`driver`.`id`,
`driver`.`phone`,
`driver`.`email`,
`driver`.`gender`,
`driver`.`status`,
`driver`.`birthdate`,
`driver`.`site`,
`driver`.`first_name`,
`driver`.`last_name`,
`driver`.`education`,
`driver`.`employmentType`,
`driver`.`maritalStatus`,
`driver`.`created_at`,
`driver`.`updated_at`,
(
SELECT
COUNT(`driver`.`id`)
FROM
`driver`
) AS countPassenger,
(
SELECT
CAST(AVG(`rating`) AS DECIMAL(10, 2))
FROM
`ratingPassenger`
WHERE
`ratingPassenger`.`driverID` = `driver`.`id`
) AS ratingPassenger,
(
SELECT
COUNT(`ratingPassenger`.`driverID`)
FROM
`ratingPassenger`
WHERE
`ratingPassenger`.`driverID` = `driver`.`id`
) AS countDriverRate,
(
SELECT
COUNT(`canecl`.`driverID`)
FROM
`canecl`
WHERE
`canecl`.`driverID` = `driver`.`id`
) AS countPassengerCancel,
(
SELECT
CAST(
AVG(`ratingDriver`.`rating`) AS DECIMAL(10, 2)
)
FROM
`ratingDriver`
WHERE
`ratingDriver`.`driver_id` = `driver`.`id`
) AS passengerAverageRating,
(
SELECT
COUNT(`ratingDriver`.`driver_id`)
FROM
`ratingDriver`
WHERE
`ratingDriver`.`driver_id` = `driver`.`id`
) AS countPassengerRate,
(
SELECT
COUNT(`ride`.`driver_id`)
FROM
`ride`
WHERE
`ride`.`driver_id` = `driver`.`id`
) AS countPassengerRide,
(
SELECT
`token`
FROM
`driverToken`
WHERE
`driverToken`.`captain_id` = `driver`.`id`
) AS passengerToken
FROM
`driver`
ORDER BY
passengerAverageRating
DESC
LIMIT 10";
$stmt = $con->prepare($sql);
$stmt->execute();
$result = $stmt->fetchAll(PDO::FETCH_ASSOC);
if ($stmt->rowCount() > 0) {
// Print all the records
// printData($result);
printSuccess($data = $result);
} else {
// Print a failure message
printFailure($message = "No records found");
}
?>

View File

@@ -1,109 +0,0 @@
<?php
include "../../connect.php";
$driver_id = filterRequest("driver_id");
$driverEmail = filterRequest("driverEmail");
$driverPhone = filterRequest("driverPhone");
$sql = "SELECT
`driver`.`id`,
`driver`.`phone`,
`driver`.`email`,
`driver`.`gender`,
`driver`.`status`,
`driver`.`birthdate`,
`driver`.`site`,
`driver`.`first_name`,
`driver`.`last_name`,
`driver`.`education`,
`driver`.`employmentType`,
`driver`.`maritalStatus`,
`driver`.`created_at`,
`driver`.`updated_at`,
(
SELECT
COUNT(`driver`.`id`)
FROM
`driver`
) AS countPassenger,
(
SELECT
CAST(AVG(`rating`) AS DECIMAL(10, 2))
FROM
`ratingPassenger`
WHERE
`ratingPassenger`.`driverID` = `driver`.`id`
) AS ratingPassenger,
(
SELECT
COUNT(`ratingPassenger`.`driverID`)
FROM
`ratingPassenger`
WHERE
`ratingPassenger`.`driverID` = `driver`.`id`
) AS countDriverRate,
(
SELECT
COUNT(`canecl`.`driverID`)
FROM
`canecl`
WHERE
`canecl`.`driverID` = `driver`.`id`
) AS countPassengerCancel,
(
SELECT
CAST(
AVG(`ratingDriver`.`rating`) AS DECIMAL(10, 2)
)
FROM
`ratingDriver`
WHERE
`ratingDriver`.`driver_id` = `driver`.`id`
) AS passengerAverageRating,
(
SELECT
COUNT(`ratingDriver`.`driver_id`)
FROM
`ratingDriver`
WHERE
`ratingDriver`.`driver_id` = `driver`.`id`
) AS countPassengerRate,
(
SELECT
COUNT(`ride`.`driver_id`)
FROM
`ride`
WHERE
`ride`.`driver_id` = `driver`.`id`
) AS countPassengerRide,
(
SELECT
`token`
FROM
`driverToken`
WHERE
`driverToken`.`captain_id` = `driver`.`id`
) AS passengerToken
FROM
`driver`
WHERE driver.email = '$driverEmail' OR driver.phone = '$driverPhone' OR driver.id = '$driver_id'
ORDER BY
passengerAverageRating
DESC
LIMIT 10
";
$stmt = $con->prepare($sql);
$stmt->execute();
$result = $stmt->fetchAll(PDO::FETCH_ASSOC);
if ($stmt->rowCount() > 0) {
// Print all the records
// printData($result);
printSuccess($data = $result);
} else {
// Print a failure message
printFailure($message = "No records found");
}
?>

View File

@@ -1,107 +0,0 @@
<?php
include "../../connect.php";
$driver_id = filterRequest("driver_id");
$sql = "SELECT
`driver`.`id`,
`driver`.`phone`,
`driver`.`email`,
`driver`.`gender`,
`driver`.`status`,
`driver`.`birthdate`,
`driver`.`site`,
`driver`.`first_name`,
`driver`.`last_name`,
`driver`.`education`,
`driver`.`employmentType`,
`driver`.`maritalStatus`,
`driver`.`created_at`,
`driver`.`updated_at`,
(
SELECT
COUNT(`driver`.`id`)
FROM
`driver`
) AS countPassenger,
(
SELECT
CAST(AVG(`rating`) AS DECIMAL(10, 2))
FROM
`ratingPassenger`
WHERE
`ratingPassenger`.`driverID` = `driver`.`id`
) AS ratingPassenger,
(
SELECT
COUNT(`ratingPassenger`.`driverID`)
FROM
`ratingPassenger`
WHERE
`ratingPassenger`.`driverID` = `driver`.`id`
) AS countDriverRate,
(
SELECT
COUNT(`canecl`.`driverID`)
FROM
`canecl`
WHERE
`canecl`.`driverID` = `driver`.`id`
) AS countPassengerCancel,
(
SELECT
CAST(
AVG(`ratingDriver`.`rating`) AS DECIMAL(10, 2)
)
FROM
`ratingDriver`
WHERE
`ratingDriver`.`driver_id` = `driver`.`id`
) AS passengerAverageRating,
(
SELECT
COUNT(`ratingDriver`.`driver_id`)
FROM
`ratingDriver`
WHERE
`ratingDriver`.`driver_id` = `driver`.`id`
) AS countPassengerRate,
(
SELECT
COUNT(`ride`.`driver_id`)
FROM
`ride`
WHERE
`ride`.`driver_id` = `driver`.`id`
) AS countPassengerRide,
(
SELECT
`token`
FROM
`driverToken`
WHERE
`driverToken`.`captain_id` = `driver`.`id`
) AS passengerToken
FROM
`driver`
WHERE
driver.id = '$driver_id'
ORDER BY
passengerAverageRating
DESC
LIMIT 10
";
$stmt = $con->prepare($sql);
$stmt->execute();
$result = $stmt->fetchAll(PDO::FETCH_ASSOC);
if ($stmt->rowCount() > 0) {
// Print all the records
// printData($result);
printSuccess($data = $result);
} else {
// Print a failure message
printFailure($message = "No records found");
}
?>

View File

@@ -1,145 +0,0 @@
<?php
include "../../connect.php";
$sql = "SELECT
(
SELECT
TIME_FORMAT(
AVG(
TIMESTAMPDIFF(
SECOND,
rideTimeStart,
rideTimeFinish
)
),
'%Hh %im'
) AS avg_duration
FROM
ride
) AS driver_avg_duration,(
SELECT
COUNT(*) AS total_rows
FROM
(
SELECT
COUNT(driver_id)
FROM
ride
GROUP BY
driver_id
) sub
) AS num_Driver,
(
SELECT
COUNT(*)
FROM
ride
) AS total_rides,
(
SELECT
COUNT(*)
FROM
ride
WHERE
STATUS
= 'waiting'
) AS ongoing_rides,
(
SELECT
COUNT(*)
FROM
ride
WHERE
STATUS
= 'Finished'
) AS completed_rides,
(
SELECT
COUNT(*)
FROM
ride
WHERE
STATUS
= 'cancelled'
) AS cancelled_rides,
(
SELECT
MAX(
TIME_FORMAT(
TIMESTAMPDIFF(
SECOND,
rideTimeStart,
rideTimeFinish
),
'%Hh %im'
)
) AS duration
FROM
ride
) AS longest_duration,
(
SELECT
ROUND(SUM(DISTANCE),
2)
FROM
ride
) AS total_distance,
(
SELECT
ROUND(AVG(DISTANCE),
2)
FROM
ride
) AS average_distance,
(
SELECT
ROUND(MAX(DISTANCE),
2)
FROM
ride
) AS longest_distance,
(
SELECT
SUM(price_for_driver)
FROM
ride
) AS total_driver_earnings,
(
SELECT
SUM(`price_for_passenger`)
FROM
ride
) AS total_company_earnings,
(
ROUND(
(
SELECT
SUM(`price_for_passenger`)
FROM
ride
) /(
SELECT
SUM(price_for_driver)
FROM
ride
),
2
)
) AS companyPercent
FROM
ride
LIMIT 1";
$stmt = $con->prepare($sql);
$stmt->execute();
$result = $stmt->fetchAll(PDO::FETCH_ASSOC);
if ($stmt->rowCount() > 0) {
// Print all the records
// printData($result);
printSuccess($data = $result);
} else {
// Print a failure message
printFailure($message = "No records found");
}
?>

View File

@@ -1,35 +0,0 @@
<?php
include "../../connect.php";
$currentYear = date('Y');
$sql = "SELECT
YEAR(date) AS year,
MONTH(date) AS month,
DAY(date) AS day,
COUNT(*) AS rides_count,
(SELECT COUNT(*) FROM ride WHERE MONTH(date) = MONTH(CURRENT_DATE) AND YEAR(date) = YEAR(CURRENT_DATE)) AS current_month_rides_count
FROM
ride
GROUP BY
YEAR(date),
MONTH(date),
DAY(date)
ORDER BY
YEAR(date),
MONTH(date),
DAY(date)";
$stmt = $con->prepare($sql);
$stmt->execute();
$result = $stmt->fetchAll(PDO::FETCH_ASSOC);
if ($stmt->rowCount() > 0) {
// Print all the records
// printData($result);
printSuccess($data = $result);
} else {
// Print a failure message
printFailure($message = "No records found");
}
?>

View File

@@ -1,25 +0,0 @@
<?php
include "../../connect.php";
$deviceNumber = filterRequest("deviceNumber"); // Assuming you'll get deviceNumber as input
$name = filterRequest("name");
$sql = "INSERT INTO `adminUser`(`id`, `device_number`, `name`) VALUES (
UUID(),
:deviceNumber,
:name
)";
$stmt = $con->prepare($sql);
$stmt->bindParam(':deviceNumber', $deviceNumber);
$stmt->bindParam(':name', $name);
$stmt->execute();
if ($stmt->rowCount() > 0) {
// Print a success message
printSuccess($message = "Admin user data saved successfully");
} else {
// Print a failure message
printFailure($message = "Failed to save admin user data");
}
?>

View File

@@ -1,24 +0,0 @@
<?php
include "../../connect.php";
$device_number = filterRequest("device_number");
$sql = "SELECT
*
FROM
`adminUser`
WHERE
`device_number` = '$device_number'";
$stmt = $con->prepare($sql);
$stmt->execute();
$result = $stmt->fetchAll(PDO::FETCH_ASSOC);
if (count($result) === 1) {
// Print the first record as a success message
printSuccess( $result[0]);
} else {
// Print a failure message
printFailure($message = "Failed to retrieve Password or user name incorrect");
}
?>

View File

@@ -1,404 +0,0 @@
<?php
//dashbord.php
include "../connect.php";
// $passengerID = filterRequest("passengerID");
$sql = "SELECT
COALESCE(
(
SELECT
COUNT(`email`)
FROM
`passengers`
),
0
) AS countPassengers,
COALESCE(
(
SELECT
COUNT(`email`)
FROM
`driver`
),
0
) AS countDriver,
COALESCE(
(
SELECT
COUNT(`id`)
FROM
`ride`
),
0
) AS countRide,
COALESCE(
(
SELECT
COUNT(`id`)
FROM
`passengers`
WHERE
`passengers`.`created_at` BETWEEN DATE_FORMAT(CURRENT_DATE, '%Y-%m-01') AND LAST_DAY(CURRENT_DATE)
),
0
) AS countPassengersThisMonth,
COALESCE(
(
SELECT
COUNT(`id`)
FROM
`ride`
WHERE
`ride`.`created_at` BETWEEN DATE_FORMAT(CURRENT_DATE, '%Y-%m-01') AND LAST_DAY(CURRENT_DATE)
),
0
) AS countRideThisMonth,
COALESCE(
(
SELECT
COUNT(`id`)
FROM
`driver`
WHERE
`driver`.`created_at` BETWEEN DATE_FORMAT(CURRENT_DATE, '%Y-%m-01') AND LAST_DAY(CURRENT_DATE)
),
0
) AS countDriverThisMonth,
COALESCE(
(
SELECT
COUNT(`id`)
FROM
`CarRegistration`
WHERE
`CarRegistration`.`created_at` BETWEEN DATE_FORMAT(CURRENT_DATE, '%Y-%m-01') AND LAST_DAY(CURRENT_DATE)
),
0
) AS countCarRegistrationThisMonth,
COALESCE(
(
SELECT
COUNT(`id`)
FROM
`complaint`
WHERE
`complaint`.`date_filed` BETWEEN DATE_FORMAT(CURRENT_DATE, '%Y-%m-01') AND LAST_DAY(CURRENT_DATE)
),
0
) AS countComplaintThisMonth,
COALESCE(
(
SELECT
COUNT(`id`)
FROM
`complaint`
WHERE
`complaint`.`date_filed` BETWEEN DATE_FORMAT(
DATE_SUB(
CURRENT_DATE,
INTERVAL WEEKDAY(CURRENT_DATE) DAY
),
'%Y-%m-%d'
) AND DATE_FORMAT(
DATE_ADD(
DATE_SUB(
CURRENT_DATE,
INTERVAL WEEKDAY(CURRENT_DATE) DAY
),
INTERVAL 6 DAY
),
'%Y-%m-%d'
)
),
0
) AS countComplaintThisWeek,
COALESCE(
(
SELECT
COUNT(`id`)
FROM
`complaint`
WHERE
`complaint`.`date_filed` BETWEEN DATE_FORMAT(CURRENT_DATE, '%Y-%m-%d') AND DATE_FORMAT(CURRENT_DATE, '%Y-%m-%d')
),
0
) AS countComplaintToday,
COALESCE(
(
SELECT
SUM(`payments`.`amount`)
FROM
`payments`
WHERE
`payments`.`created_at` BETWEEN DATE_FORMAT(CURRENT_DATE, '%Y-%m-01') AND LAST_DAY(CURRENT_DATE) AND `payments`.`payment_method` IN(
'visa-in',
'visa',
'visaRide',
'TransferFrom',
'payout',
'TransferTo'
)
),
0
) AS payments,
COALESCE(
(
SELECT
SUM(`driverWallet`.`amount`)
FROM
`driverWallet`
WHERE
`driverWallet`.`dateCreated` BETWEEN DATE_FORMAT(CURRENT_DATE, '%Y-%m-01') AND LAST_DAY(CURRENT_DATE) AND `driverWallet`.`paymentMethod` IN('visa', '')
),
0
) AS driverWallet,
COALESCE(
(
SELECT
SUM(`passengerWallet`.`balance`)
FROM
`passengerWallet`
WHERE
`passengerWallet`.`created_at` BETWEEN DATE_FORMAT(CURRENT_DATE, '%Y-%m-01') AND LAST_DAY(CURRENT_DATE)
),
0
) AS passengerWallet,
COALESCE(
(
SELECT
SUM(`seferWallet`.`amount`)
FROM
`seferWallet`
WHERE
`seferWallet`.`createdAt` BETWEEN DATE_FORMAT(CURRENT_DATE, '%Y-%m-01') AND LAST_DAY(CURRENT_DATE)
),
0
) AS seferWallet,
COALESCE(
(
SELECT
TIME_FORMAT(
AVG(
TIMESTAMPDIFF(
SECOND,
rideTimeStart,
rideTimeFinish
)
),
'%Hh %im'
) AS avg_duration
FROM
ride
),
'0:00'
) AS driver_avg_duration,
COALESCE(
(
SELECT
COUNT(*) AS total_rows
FROM
(
SELECT
COUNT(driver_id)
FROM
ride
GROUP BY
driver_id
) sub
),
0
) AS num_Driver,
COALESCE(
(
SELECT
COUNT(*)
FROM
ride
),
0
) AS total_rides,
COALESCE(
(
SELECT
COUNT(*)
FROM
ride
WHERE
STATUS
= 'waiting'
),
0
) AS ongoing_rides,
COALESCE(
(
SELECT
COUNT(*)
FROM
ride
WHERE
STATUS
= 'Finished'
),
0
) AS completed_rides,
COALESCE(
(
SELECT
COUNT(*)
FROM
ride
WHERE
STATUS
= 'cancelled'
),
0
) AS cancelled_rides,
COALESCE(
(
SELECT
MAX(
TIME_FORMAT(
TIMESTAMPDIFF(
SECOND,
rideTimeStart,
rideTimeFinish
),
'%Hh %im'
)
) AS duration
FROM
ride
),
'0:00'
) AS longest_duration,
COALESCE(
(
SELECT
ROUND(SUM(DISTANCE),
2)
FROM
ride
),
0
) AS total_distance,
COALESCE(
(
SELECT
ROUND(AVG(DISTANCE),
2)
FROM
ride
),
0
) AS average_distance,
COALESCE(
(
SELECT
ROUND(MAX(DISTANCE),
2)
FROM
ride
),
0
) AS longest_distance,
COALESCE(
(
SELECT
SUM(price_for_driver)
FROM
ride
WHERE
STATUS
= 'Finished'
),
0
) AS total_driver_earnings,
COALESCE(
ROUND(
(
SELECT
AVG(`ride`.`price_for_passenger`)
FROM
`ride`
)
),
0
) AS avg_passenger_price,
COUNT(
CASE WHEN HOUR(created_at) BETWEEN 6 AND 11 THEN id
END
) AS morning_ride_count,
COUNT(
CASE WHEN HOUR(created_at) BETWEEN 12 AND 17 THEN id
END
) AS evening_ride_count,
COUNT(
CASE WHEN(
HOUR(created_at) BETWEEN 18 AND 23 OR HOUR(created_at) BETWEEN 0 AND 5
) THEN id
END
) AS night_ride_count,
(
SELECT
COUNT(*) AS ride_count
FROM
ride
WHERE
`ride`.`carType` = 'Comfort'
) AS comfort,
(
SELECT
COUNT(*) AS ride_count
FROM
ride
WHERE
`ride`.`carType` = 'Speed'
) AS speed,
(
SELECT
COUNT(*) AS ride_count
FROM
ride
WHERE
`ride`.`carType` = 'Lady'
) AS lady,
COUNT(
CASE WHEN HOUR(created_at) BETWEEN 6 AND 11 THEN id
END
) AS morning_ride_count,
COUNT(
CASE WHEN HOUR(created_at) BETWEEN 12 AND 17 THEN id
END
) AS evening_ride_count,
COUNT(
CASE WHEN(
HOUR(created_at) BETWEEN 18 AND 23 OR HOUR(created_at) BETWEEN 0 AND 5
) THEN id
END
) AS night_ride_count
,
(SELECT
COUNT(*)
FROM
payments
WHERE
payment_method = 'TransferFrom'
)AS transfer_from_count
FROM
`passengers`
LIMIT 1;";
$stmt = $con->prepare($sql);
$stmt->execute();
if ($stmt->rowCount() > 0) {
$result = $stmt->fetchAll(PDO::FETCH_ASSOC);
// Print all the records
// printData($result);
printSuccess($data = $result);
} else {
// Print a failure message
printFailure($message = "No records found");
}
?>

View File

@@ -1,110 +0,0 @@
<?php
include "../connect.php";
$sql = "SELECT
`passengers`.`id`,
`passengers`.`phone`,
`passengers`.`email`,
`passengers`.`gender`,
`passengers`.`status`,
`passengers`.`birthdate`,
`passengers`.`site`,
`passengers`.`first_name`,
`passengers`.`last_name`,
`passengers`.`sosPhone`,
`passengers`.`education`,
`passengers`.`employmentType`,
`passengers`.`maritalStatus`,
`passengers`.`created_at`,
`passengers`.`updated_at`,
(
SELECT
COUNT(`passengers`.`id`)
FROM
`passengers`
) AS countPassenger,
(
SELECT
COUNT(`feedBack`.id)
FROM
`feedBack`
) AS countFeedback,
(
SELECT
CAST(AVG(`rating`) as DECIMAL(10,2))
FROM
`ratingPassenger`
WHERE
`ratingPassenger`.`passenger_id` = `passengers`.`id`
) AS ratingPassenger,
(
SELECT
COUNT(`ratingPassenger`.`driverID`)
FROM
`ratingPassenger`
WHERE
`ratingPassenger`.`passenger_id` = `passengers`.`id`
) AS countDriverRate,
(
SELECT
COUNT(`canecl`.`passengerID`)
FROM
`canecl`
WHERE
`canecl`.`passengerID` = `passengers`.`id`
) AS countPassengerCancel,
(
SELECT
CAST(AVG(`ratingDriver`.`rating`) as DECIMAL(10,2))
FROM
`ratingDriver`
WHERE
`ratingDriver`.`passenger_iD` = `passengers`.`id`
) AS passengerAverageRating,
(
SELECT
COUNT(`ratingDriver`.`driver_id`)
FROM
`ratingDriver`
WHERE
`ratingDriver`.`passenger_id` = `passengers`.`id`
) AS countPassengerRate,
(
SELECT
COUNT(`ride`.`passenger_id`)
FROM
`ride`
WHERE
`ride`.`passenger_id` = `passengers`.`id`
) AS countPassengerRide
,
(
SELECT
`tokens`.`token`
FROM
`tokens`
WHERE
`tokens`.`passengerID` = `passengers`.`id`
) AS passengerToken
FROM
`passengers`
GROUP BY
`passengers`.`id`
ORDER BY
countPassengerRide
DESC
LIMIT 10";
$stmt = $con->prepare($sql);
$stmt->execute();
$result = $stmt->fetchAll(PDO::FETCH_ASSOC);
if ($stmt->rowCount() > 0) {
// Print all the records
// printData($result);
printSuccess($data = $result);
} else {
// Print a failure message
printFailure($message = "No records found");
}
?>

View File

@@ -1,111 +0,0 @@
<?php
include "../connect.php";
$passengerID = filterRequest("passengerID");
$sql = "SELECT
`passengers`.`id`,
`passengers`.`phone`,
`passengers`.`email`,
`passengers`.`gender`,
`passengers`.`status`,
`passengers`.`birthdate`,
`passengers`.`site`,
`passengers`.`first_name`,
`passengers`.`last_name`,
`passengers`.`sosPhone`,
`passengers`.`education`,
`passengers`.`employmentType`,
`passengers`.`maritalStatus`,
`passengers`.`created_at`,
`passengers`.`updated_at`,
(
SELECT
COUNT(`passengers`.`id`)
FROM
`passengers`
) AS countPassenger,
(
SELECT
COUNT(`feedBack`.id)
FROM
`feedBack`
) AS countFeedback,
(
SELECT
CAST(AVG(`rating`) as DECIMAL(10,2))
FROM
`ratingPassenger`
WHERE
`ratingPassenger`.`passenger_id` = `passengers`.`id`
) AS ratingPassenger,
(
SELECT
COUNT(`ratingPassenger`.`driverID`)
FROM
`ratingPassenger`
WHERE
`ratingPassenger`.`passenger_id` = `passengers`.`id`
) AS countDriverRate,
(
SELECT
COUNT(`canecl`.`passengerID`)
FROM
`canecl`
WHERE
`canecl`.`passengerID` = `passengers`.`id`
) AS countPassengerCancel,
(
SELECT
CAST(AVG(`ratingDriver`.`rating`) as DECIMAL(10,2))
FROM
`ratingDriver`
WHERE
`ratingDriver`.`passenger_iD` = `passengers`.`id`
) AS passengerAverageRating,
(
SELECT
COUNT(`ratingDriver`.`driver_id`)
FROM
`ratingDriver`
WHERE
`ratingDriver`.`passenger_id` = `passengers`.`id`
) AS countPassengerRate,
(
SELECT
COUNT(`ride`.`passenger_id`)
FROM
`ride`
WHERE
`ride`.`passenger_id` = `passengers`.`id`
) AS countPassengerRide,
(
SELECT
`tokens`.`token`
FROM
`tokens`
WHERE
`tokens`.`passengerID` = `passengers`.`id`
) AS passengerToken
FROM
`passengers` WHERE passengers.id='$passengerID'
GROUP BY
`passengers`.`id`
ORDER BY
countPassengerRide
DESC
";
$stmt = $con->prepare($sql);
$stmt->execute();
$result = $stmt->fetchAll(PDO::FETCH_ASSOC);
if ($stmt->rowCount() > 0) {
// Print all the records
// printData($result);
printSuccess($data = $result);
} else {
// Print a failure message
printFailure($message = "No records found");
}
?>

View File

@@ -1,112 +0,0 @@
<?php
include "../connect.php";
$passengerEmail = filterRequest("passengerEmail");
$passengerId = filterRequest("passengerId");
$passengerphone = filterRequest("passengerphone");
$sql = "SELECT
`passengers`.`id`,
`passengers`.`phone`,
`passengers`.`email`,
`passengers`.`gender`,
`passengers`.`status`,
`passengers`.`birthdate`,
`passengers`.`site`,
`passengers`.`first_name`,
`passengers`.`last_name`,
`passengers`.`sosPhone`,
`passengers`.`education`,
`passengers`.`employmentType`,
`passengers`.`maritalStatus`,
`passengers`.`created_at`,
`passengers`.`updated_at`,
(
SELECT
COUNT(`passengers`.`id`)
FROM
`passengers`
) AS countPassenger,
(
SELECT
COUNT(`feedBack`.id)
FROM
`feedBack`
) AS countFeedback,
(
SELECT
CAST(AVG(`rating`) AS DECIMAL(10, 2))
FROM
`ratingPassenger`
WHERE
`ratingPassenger`.`passenger_id` = `passengers`.`id`
) AS ratingPassenger,
(
SELECT
COUNT(`ratingPassenger`.`driverID`)
FROM
`ratingPassenger`
WHERE
`ratingPassenger`.`passenger_id` = `passengers`.`id`
) AS countDriverRate,
(
SELECT
COUNT(`canecl`.`passengerID`)
FROM
`canecl`
WHERE
`canecl`.`passengerID` = `passengers`.`id`
) AS countPassengerCancel,
(
SELECT
CAST(
AVG(`ratingDriver`.`rating`) AS DECIMAL(10, 2)
)
FROM
`ratingDriver`
WHERE
`ratingDriver`.`passenger_iD` = `passengers`.`id`
) AS passengerAverageRating,
(
SELECT
COUNT(`ratingDriver`.`driver_id`)
FROM
`ratingDriver`
WHERE
`ratingDriver`.`passenger_id` = `passengers`.`id`
) AS countPassengerRate,
(
SELECT
COUNT(`ride`.`passenger_id`)
FROM
`ride`
WHERE
`ride`.`passenger_id` = `passengers`.`id`
) AS countPassengerRide,
(
SELECT
`tokens`.`token`
FROM
`tokens`
WHERE
`tokens`.`passengerID` = `passengers`.`id`
) AS passengerToken
FROM
`passengers`
WHERE
passengers.email = '$passengerEmail' OR passengers.phone = '$passengerphone' OR passengers.id = '$passengerId'
";
$stmt = $con->prepare($sql);
$stmt->execute();
$result = $stmt->fetchAll(PDO::FETCH_ASSOC);
if ($stmt->rowCount() > 0) {
// Print all the records
// printData($result);
printSuccess($data = $result);
} else {
// Print a failure message
printFailure($message = "No records found");
}
?>

View File

@@ -1,47 +0,0 @@
<?php
include "../connect.php";
$sql = "
SELECT
COALESCE(
(SELECT SUM(amount) FROM payments
WHERE created_at BETWEEN DATE_FORMAT(CURDATE(), '%Y-%m-01') AND LAST_DAY(CURDATE())
AND payment_method IN ('visa', 'visa-in', 'visaRide', 'TransferFrom', 'payout', 'TransferTo')),
0
) AS payments,
COALESCE(
(SELECT SUM(amount) FROM driverWallet
WHERE dateCreated BETWEEN DATE_FORMAT(CURDATE(), '%Y-%m-01') AND LAST_DAY(CURDATE())
AND paymentMethod IN ('visa', '')),
0
) AS driverWallet,
COALESCE(
(SELECT SUM(balance) FROM passengerWallet
WHERE created_at BETWEEN DATE_FORMAT(CURDATE(), '%Y-%m-01') AND LAST_DAY(CURDATE())),
0
) AS passengerWallet,
COALESCE(
(SELECT SUM(amount) FROM seferWallet
WHERE createdAt BETWEEN DATE_FORMAT(CURDATE(), '%Y-%m-01') AND LAST_DAY(CURDATE())),
0
) AS seferWallet;
";
$stmt = $con->prepare($sql);
$stmt->execute();
if ($stmt->rowCount() > 0) {
$result = $stmt->fetchAll(PDO::FETCH_ASSOC);
// ✅ Always log what were sending back
error_log('📊 Dashboard Result: ' . json_encode($result, JSON_PRETTY_PRINT));
printSuccess($result);
} else {
error_log('⚠️ Dashboard: No records found');
printFailure("No records found");
}
?>

View File

@@ -1,51 +0,0 @@
<?php
include "../connect.php";
// $driverID = filterRequest("driverID");
$sql = "SELECT
COUNT(DISTINCT driverID) AS driver_count,
`payments`.driverID,
COALESCE(SUM(amount),
0) AS total_amount,
`driver`.`phone`,
`driver`.`name_arabic`,
`driver`.`accountBank`,
`driver`.`bankCode`,
`driver`.`email`
FROM
payments
LEFT JOIN `driver` ON `driver`.`id` = payments.driverID
WHERE
isGiven = 'waiting' AND payment_method IN(
'visa-in',
'visa',
'visaRide',
'TransferFrom',
'payout',
'TransferTo',
'payFromSeferToDriver'
) AND WEEK(`payments`.created_at) = WEEK(CURRENT_DATE)
GROUP BY
driverID
HAVING
COALESCE(SUM(amount),
0) > 0
AND total_amount > 100
LIMIT 0, 25;
";
$stmt = $con->prepare($sql);
$stmt->execute();
if ($stmt->rowCount() > 0) {
// Fetch the record
$row = $stmt->fetchAll(PDO::FETCH_ASSOC);
printSuccess( $row);
}
else{
// Print a failure message
printFailure($message = "No wallet record found");
}
?>

View File

@@ -1,79 +0,0 @@
<?php
// File: send_payment_received_email.php
// Connect to the database
include '../connect.php';
// Get trip details from the database or API
$driverID = filterRequest('driverID');
$totalAmount = filterRequest('total_amount');
$driverPhone = filterRequest('phone');
$driverArabicName = filterRequest('name_arabic');
$accountBank = filterRequest('accountBank');
$driverEmail = filterRequest('email');
// Determine the language preference
$language = 'en'; // Default to English
// Email content
$bodyEmail = "<html>
<head>
<style>
/* Email styling here */
</style>
</head>
<body>
<div class='container'>
<img src='https://lh3.googleusercontent.com/a/ACg8ocLe5TgvmTjoFx7KjIoWGxX0G2ryKBTzUZi2-mBYb9DI1dsKQ0WEYh5ZPdnA3WeFbp9VnaTNzJuA0w8S4RiQ7042AKrOwXo3=s576-c-no' style='width: 150px; margin: 20px auto; display: block;'>
<h1>Payment Sent - SEFER</h1>
<p>Thank you for being a valued driver on the SEFER platform.</p>
<p>SEFER has sent a payment of $totalAmount to your account. Please note that it may take a few days for the bank to process this transaction.</p>
<p>We appreciate your service and hope to continue our partnership.</p>
<p>Regards,<br> SEFER Team</p>
</div>
</body>
</html>";
// Arabic email content
$bodyEmailAr = "<html>
<head>
<style>
/* Arabic email styling here */
</style>
</head>
<body dir='rtl'>
<div class='container'>
<img src='YOUR_SEFER_LOGO_URL_HERE' alt='SEFER' style='width: 150px; margin: 20px auto; display: block;'>
<h1>تم إرسال الدفع - سفر</h1>
<p>شكراً لك على كونك سائقًا متميزًا على منصة سفر.</p>
<p>لقد أرسلت سفر دفعة قدرها $totalAmount إلى حسابك. يرجى ملاحظة أنه قد يستغرق البنك عدة أيام لمعالجة هذه المعاملة.</p>
<p>نحن نقدر خدمتك ونأمل أن نستمر في شراكتنا.</p>
<p>مع خالص التحية،<br> فريق سفر</p>
</div>
</body>
</html>";
// Set the email headers
$supportEmail = 'seferteam@sefer.live';
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=UTF-8\r\n";
$headers .= "From: $supportEmail\r\n";
// Send email to the driver
if (!empty($driverEmail)) {
if (mail($driverEmail, "Payment Sent - SEFER", $bodyEmail, $headers)) {
// echo "Email sent successfully to $driverEmail";
printSuccess($message = "'Email sent successfully to ' . $driverEmail");
} else {
printFailure($message = "Failed to send email to ' . $driverEmail");
}
} else {
printFailure($message = "Invalid email address: ' . $driverEmail");
}
?>

View File

@@ -1,28 +0,0 @@
<?php
// Admin/v2/financial/dashboard_wallet.php
// هذا الملف يجب أن يرفع على سيرفر المحفظة فقط!
require_once __DIR__ . '/../../../connect.php'; // مسار الاتصال الخاص بسيرفر المحفظة
if ($role !== 'admin' && $role !== 'super_admin') {
jsonError("Unauthorized", 403);
}
try {
$stmt = $con->prepare("
SELECT
(SELECT IFNULL(SUM(amount), 0) FROM payments WHERE status = 'completed') as payments,
(SELECT IFNULL(SUM(balance), 0) FROM driverWallet) as driverWallet,
(SELECT IFNULL(SUM(balance), 0) FROM passengerWallet) as passengerWallet,
(SELECT IFNULL(SUM(balance), 0) FROM seferWallet) as seferWallet
");
$stmt->execute();
$stats = $stmt->fetch(PDO::FETCH_ASSOC);
// نعيد البيانات داخل رسالة (Array) لتطابق توقعات الفلاتر
jsonSuccess([$stats]);
} catch (Exception $e) {
jsonError('Wallet Query failed: ' . $e->getMessage(), 500);
}
?>

View File

@@ -1,40 +0,0 @@
<?php
// Admin/v2/financial/settlements.php
require_once __DIR__ . '/../../../connect.php';
try {
// جلب السائقين الذين لديهم مستحقات أو مديونية
// الحسبة: إجمالي (price_for_driver) من الرحلات المكتملة
$stmt = $con->prepare("
SELECT
d.id, d.first_name, d.last_name, d.phone,
SUM(r.price_for_driver) as total_earned,
COUNT(r.id) as total_rides
FROM driver d
LEFT JOIN ride r ON d.id = r.driver_id AND r.status = 'Finished'
GROUP BY d.id
HAVING total_earned > 0
ORDER BY total_earned DESC
LIMIT 50
");
$stmt->execute();
$drivers = $stmt->fetchAll(PDO::FETCH_ASSOC);
// فك تشفير البيانات
foreach ($drivers as &$driver) {
$driver['first_name'] = $encryptionHelper->decryptData($driver['first_name']);
$driver['last_name'] = $encryptionHelper->decryptData($driver['last_name']);
$driver['phone'] = $encryptionHelper->decryptData($driver['phone']);
}
echo json_encode([
'status' => 'success',
'data' => $drivers
]);
} catch (Exception $e) {
http_response_code(500);
echo json_encode(['status' => 'error', 'message' => $e->getMessage()]);
}
?>

View File

@@ -1,30 +0,0 @@
<?php
// Admin/v2/financial/stats.php
require_once __DIR__ . '/../../../connect.php';
try {
// إحصائيات مالية عامة
$stmt = $con->prepare("
SELECT
SUM(price_for_passenger) as total_revenue,
SUM(price_for_driver) as total_driver_pay,
SUM(price_for_passenger - price_for_driver) as total_platform_commission,
(SELECT SUM(amount) FROM payments WHERE payment_method = 'Cash') as cash_payments,
(SELECT SUM(amount) FROM payments WHERE payment_method != 'Cash') as digital_payments
FROM ride
WHERE status = 'Finished'
");
$stmt->execute();
$stats = $stmt->fetch(PDO::FETCH_ASSOC);
echo json_encode([
'status' => 'success',
'data' => $stats
]);
} catch (Exception $e) {
http_response_code(500);
echo json_encode(['status' => 'error', 'message' => $e->getMessage()]);
}
?>

Binary file not shown.

View File

@@ -1,52 +0,0 @@
<?php
require_once __DIR__ . '/vendor/autoload.php';
// Replace with your actual credentials
$appId = '12994c6e707543e68d5638894d04f989';
$appCertificate = 'e21a388f83034a159f2783889a6d7bcf';
// Set server port
$port = 8080;
// Function to generate Agora token
function generateToken($channelName, $uid = 0, $role = RtcRole::SUBSCRIBER, $expireTime = 360) {
// Check mandatory parameter
if (!$channelName) {
throw new Exception('Channel name is required');
}
// Calculate privilege expiration time
$currentTime = time();
$privilegeExpireTime = $currentTime + $expireTime;
// Build and return token
return RtcTokenBuilder::buildTokenWithUid($appId, $appCertificate, $channelName, $uid, $role, $privilegeExpireTime);
}
// Create server using Slim Framework
$app = new Slim\App();
// Token generation endpoint
$app->get('/token', function ($request, $response) use ($app, $appId, $appCertificate) {
// Get parameters
$channelName = $request->getQueryParam('channelName');
$uid = $request->getQueryParam('uid', 0);
$role = $request->getQueryParam('role', RtcRole::SUBSCRIBER);
$expireTime = $request->getQueryParam('expireTime', 3600);
try {
// Generate token
$token = generateToken($channelName, $uid, $role, $expireTime);
// Respond with JSON
$response->withJson(['token' => $token]);
} catch (Exception $e) {
// Handle error
$response->withStatus(500)->withJson(['error' => $e->getMessage()]);
}
});
// Start server
$app->run($port);

View File

@@ -1,9 +0,0 @@
var http = require('http');
var server = http.createServer(function(req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
var message = 'It works!\n',
version = 'NodeJS ' + process.versions.node + '\n',
response = [message, version].join('\n');
res.end(response);
});
server.listen();

View File

@@ -1,60 +0,0 @@
<?php
include "../connect.php";
// Get the image file from the request.
$image_file = $_FILES['image'];
$driverID = filterRequest("driverID");
// Define allowed extensions
$allowed_extensions = ['jpg', 'jpeg', 'png'];
// Get the image file from the request.
$image_file = $_FILES['image'];
// Check if the image file was uploaded successfully.
if ($image_file['error'] !== UPLOAD_ERR_OK) {
echo "Image upload failed";
exit;
}
// Get file information
$image_name = $image_file['name'];
$image_size = $image_file['size'];
$image_extension = strtolower(pathinfo($image_name, PATHINFO_EXTENSION));
// Validate file extension
if (!in_array($image_extension, $allowed_extensions)) {
echo "Invalid image format";
exit;
}
// Generate a unique filename using timestamp and random string
$new_filename = $driverID . '.' . $image_extension;
// Set target directory for uploads
$target_dir = "card_image/";
// Construct target file path
$target_file = $target_dir . $new_filename;
// Move the image file to the target location
if (!move_uploaded_file($image_file['tmp_name'], $target_file)) {
echo json_encode(array('status' => "Failed to save image")); ;
exit;
}
// Store additional information (modify based on your needs)
$image_url = $target_dir . $new_filename; // Update if needed
$image_details = [
"name" => $image_name,
"size" => $image_size,
"extension" => $image_extension,
"url" => $image_url,
];
// Use the image details for further processing (e.g., display, store in database)
// ...
echo json_encode(array('status' => 'Image uploaded successfully!'));
?>

View File

@@ -1,60 +0,0 @@
<?php
include "../connect.php";
// Get the image file from the request.
$image_file = $_FILES['image'];
$driverID = filterRequest("driverID");
// Define allowed extensions
$allowed_extensions = ['jpg', 'jpeg', 'png'];
// Get the image file from the request.
$image_file = $_FILES['image'];
// Check if the image file was uploaded successfully.
if ($image_file['error'] !== UPLOAD_ERR_OK) {
echo "Image upload failed";
exit;
}
// Get file information
$image_name = $image_file['name'];
$image_size = $image_file['size'];
$image_extension = strtolower(pathinfo($image_name, PATHINFO_EXTENSION));
// Validate file extension
if (!in_array($image_extension, $allowed_extensions)) {
echo "Invalid image format";
exit;
}
// Generate a unique filename using timestamp and random string
$new_filename = $driverID . '.' . $image_extension;
// Set target directory for uploads
$target_dir = "egypt/idFront/";
// Construct target file path
$target_file = $target_dir . $new_filename;
// Move the image file to the target location
if (!move_uploaded_file($image_file['tmp_name'], $target_file)) {
echo json_encode(array('status' => "Failed to save image")); ;
exit;
}
// Store additional information (modify based on your needs)
$image_url = $target_dir . $new_filename; // Update if needed
$image_details = [
"name" => $image_name,
"size" => $image_size,
"extension" => $image_extension,
"url" => $image_url,
];
// Use the image details for further processing (e.g., display, store in database)
// ...
echo json_encode(array('status' => 'Image uploaded successfully!'));
?>

Binary file not shown.

View File

@@ -1,29 +0,0 @@
<?php
include "../../connect.php";
$appPlatform = filterRequest("appPlatform");
$sql = "SELECT
*
FROM
`testApp`
WHERE
appPlatform = '$appPlatform' AND isTest = 0;";
$stmt = $con->prepare($sql);
$stmt->execute();
$result = $stmt->fetchAll(PDO::FETCH_ASSOC);
if ($stmt->rowCount() > 0) {
// Print the retrieved data
// echo json_encode($result);
printSuccess($data = $result);
} else {
// Print a failure message
printFailure($message = "No driver order data found");
}
?>

View File

@@ -1,23 +0,0 @@
<?php
include "../../connect.php";
$appPlatform = filterRequest("appPlatform");
$sql = "UPDATE
`testApp`
SET
`isTest` = '1'
WHERE
`testApp`.appPlatform = '$appPlatform';";
$stmt = $con->prepare($sql);
$stmt->execute();
if ($stmt->rowCount() > 0) {
// Print a success message
printSuccess($message = "Test data updated successfully");
} else {
// Print a failure message
printFailure($message = "Failed to update driver order data");
}
?>

View File

@@ -1,35 +0,0 @@
<?php
include "../../connect.php";
// Sanitize and validate input
$driverId = filterRequest("driverId");
$issueDate = filterRequest("IssueDate");
$inspectionResult = filterRequest("InspectionResult");
// Prepare SQL statement
$sql = "INSERT INTO criminalDocuments (driverId, IssueDate, InspectionResult)
VALUES (:driverId, :issueDate, :inspectionResult)";
try {
$stmt = $con->prepare($sql);
// Bind parameters
$stmt->bindParam(':driverId', $driverId, PDO::PARAM_INT);
$stmt->bindParam(':issueDate', $issueDate, PDO::PARAM_STR);
$stmt->bindParam(':inspectionResult', $inspectionResult, PDO::PARAM_STR);
// Execute the statement
$stmt->execute();
// Check if the insertion was successful
if ($stmt->rowCount() > 0) {
printSuccess("Criminal document data saved successfully");
} else {
printFailure("Failed to save criminal document data");
}
} catch (PDOException $e) {
// Log the error and print a generic failure message
error_log("Database Error: " . $e->getMessage());
printFailure("An error occurred while saving the data");
}
?>

View File

@@ -1,19 +0,0 @@
<?php
include "../../connect.php";
$id = filterRequest("id");
$sql = "UPDATE `driver` SET `status`='deleteFromHimself' WHERE `id`=$id'";
$stmt = $con->prepare($sql);
$stmt->execute();
if ($stmt->rowCount() > 0) {
// Print a success message
printSuccess($message = "Record deleted successfully");
} else {
// Print a failure message
printFailure($message = "Failed to delete record");
}
?>

View File

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

View File

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

View File

@@ -1,67 +0,0 @@
<?php
include "../../connect.php";
$email = filterRequest('email');
$phone = filterRequest('phone');
$password = filterRequest('password');
// Hash the password
$hashed_password = password_hash($password, PASSWORD_DEFAULT);
$sql = "SELECT
driver.id,
driver.phone,
driver.email,
driver.password,
driver.gender,
driver.birthdate,
driver.site,
driver.first_name,
driver.last_name,
driver.education,
driver.employmentType,
driver.maritalStatus,
driver.created_at,
driver.updated_at,
email_verifications.verified
FROM
driver
LEFT JOIN email_verifications ON email_verifications.email = driver.email
WHERE
driver.phone = :phone AND driver.email = :email ";
$stmt = $con->prepare($sql);
$stmt->bindParam(':email', $email);
$stmt->bindParam(':phone', $phone);
$stmt->execute();
$data = $stmt->fetchAll(PDO::FETCH_ASSOC);
$count = $stmt->rowCount();
if ($count > 0) {
$stored_password = $data[0]['password'];
if (password_verify($password, $stored_password)) {
unset($data[0]['password']);
echo json_encode([
"status" => "success",
"count" => $count,
"data" => $data
]);
} else {
// The password is incorrect
echo json_encode([
"status" => "Failure",
"data" => "Incorrect password."
]);
// printFailure("Incorrect password.");
}
} else {
// The user does not exist
echo json_encode([
"status" => "Failure",
"data" => "User does not exist."
]);
// printFailure("User does not exist.");
}
$conn->close();
?>

View File

@@ -1,56 +0,0 @@
<?php
include "../../connect.php";
$email = filterRequest('email');
$driverID = filterRequest('id');
$sql = "SELECT
driver.id,
driver.phone,
driver.email,
driver.gender,
driver.birthdate,
driver.site,
driver.first_name,
driver.last_name,
driver.bankCode,
driver.accountBank,
driver.education,
driver.employmentType,
driver.maritalStatus,
driver.created_at,
driver.updated_at,
phone_verification.is_verified
FROM
driver
LEFT JOIN phone_verification ON phone_verification.phone_number = driver.phone
WHERE
driver.email = :email AND driver.id = :id AND `phone_verification`.`is_verified`='1' ";
$stmt = $con->prepare($sql);
$stmt->bindParam(':email', $email);
$stmt->bindParam(':id', $driverID);
$stmt->execute();
$data = $stmt->fetchAll(PDO::FETCH_ASSOC);
$count = $stmt->rowCount();
if ($count > 0) {
echo json_encode([
"status" => "success",
"count" => $count,
"data" => $data
]);
} else {
// The user does not exist
// echo json_encode([
// "status" => "Failure",
// "data" => "User does not exist."
// ]);
printFailure("User does not exist.");
}
$stmt = null; // Close the statement
$con = null; // Close the connection
exit();

View File

@@ -1,110 +0,0 @@
<?php
include "../../connect.php";
try {
// Collect and validate input data
$requiredFields = ["phone", "email", "password", "gender", "birthdate", "first_name", "last_name"];
$inputData = [];
foreach ($requiredFields as $field) {
$inputData[$field] = filterRequest($field);
if (empty($inputData[$field])) {
printFailure("Missing required field: $field");
}
}
// Collect optional fields
$optionalFields = [
"id", "license_type", "national_number", "name_arabic", "name_english",
"issue_date", "expiry_date", "license_categories", "address", "card_id",
"occupation", "licenseIssueDate", "religion", "status", "site",
"education", "employmentType", "maritalStatus"
];
foreach ($optionalFields as $field) {
$inputData[$field] = filterRequest($field);
}
// Generate driver ID if not provided
// $inputData['id'] = empty($inputData['id']) ? sha1(uniqid()) : $inputData['id'];
// Hash password
$inputData['hashedPassword'] = password_hash($inputData['password'], PASSWORD_DEFAULT);
// Set default site if not specified
$inputData['site'] = ($inputData['site'] === null || $inputData['site'] === "") ? "Not specified" : $inputData['site'];
// Check if the phone number or email address already exists
$stmt = $con->prepare("SELECT * FROM driver WHERE phone = :phone OR email = :email");
$stmt->bindParam(':phone', $inputData['phone'], PDO::PARAM_STR);
$stmt->bindParam(':email', $inputData['email'], PDO::PARAM_STR);
$stmt->execute();
if ($stmt->rowCount() > 0) {
printFailure("The email or phone number is already registered.");
}
// Prepare SQL for inserting new driver
$sql = "
INSERT INTO `driver` (
`id`, `phone`, `email`, `password`, `gender`, `license_type`, `national_number`,
`name_arabic`, `name_english`, `issue_date`, `expiry_date`, `license_categories`,
`address`, `card_id`, `occupation`, `licenseIssueDate`, `religion`, `status`,
`birthdate`, `site`, `first_name`, `last_name`, `education`,
`employmentType`, `maritalStatus`, `created_at`, `updated_at`
) VALUES (
:id, :phone, :email, :hashedPassword, :gender, :license_type, :national_number,
:name_arabic, :name_english, :issue_date, :expiry_date, :license_categories,
:address, :card_id, :occupation, :licenseIssueDate, :religion, :status,
:birthdate, :site, :first_name, :last_name, :education,
:employmentType, :maritalStatus, NOW(), NOW()
)
";
$stmt = $con->prepare($sql);
if (!$stmt) {
throw new Exception("Failed to prepare statement: " . $con->error);
}
// Bind parameters
$paramsToBind = [
'id', 'phone', 'email', 'hashedPassword', 'gender', 'license_type', 'national_number',
'name_arabic', 'name_english', 'issue_date', 'expiry_date', 'license_categories',
'address', 'card_id', 'occupation', 'licenseIssueDate', 'religion', 'status',
'birthdate', 'site', 'first_name', 'last_name', 'education',
'employmentType', 'maritalStatus'
];
foreach ($paramsToBind as $param) {
if (isset($inputData[$param])) {
$stmt->bindValue(":$param", $inputData[$param], PDO::PARAM_STR);
} else {
$stmt->bindValue(":$param", null, PDO::PARAM_STR);
}
}
// Log SQL and parameters for debugging
error_log("SQL: " . $sql);
error_log("Params: " . print_r($inputData, true));
// Execute the statement
if (!$stmt->execute()) {
throw new Exception("Failed to execute statement: " . $stmt->errorInfo()[2]);
}
// Check if the record was successfully saved
if ($stmt->rowCount() > 0) {
printSuccess($inputData['id']);
} else {
printFailure("Failed to save driver data");
}
} catch (PDOException $e) {
error_log("Database error: " . $e->getMessage());
printFailure("A database error occurred: " . $e->getMessage());
} catch (Exception $e) {
error_log("An error occurred: " . $e->getMessage());
printFailure("An error occurred: " . $e->getMessage());
}

View File

@@ -1,19 +0,0 @@
<?php
include "../../connect.php";
$id = filterRequest("id");
$sql = "DELETE FROM `passengers` WHERE `id`='$id'";
$stmt = $con->prepare($sql);
$stmt->execute();
if ($stmt->rowCount() > 0) {
// Print a success message
printSuccess($message = "Record deleted successfully");
} else {
// Print a failure message
printFailure($message = "Failed to delete record");
}
?>

View File

@@ -1,44 +0,0 @@
<?php
include "../../connect.php";
$phone_number = filterRequest("phone_number");
$driverId = filterRequest("driverId");
$email = filterRequest("email");
$token_code = filterRequest("token_code");
$expiration_time = filterRequest("expiration_time"); // Assuming this is a timestamp
// Check if the phone number already exists
$sql = "SELECT * FROM `phone_verification` WHERE `phone_number` = '$phone_number'";
$stmt = $con->prepare($sql);
$stmt->execute();
$rowCount = $stmt->rowCount();
if ($rowCount > 0) {
// The phone number already exists, so update the data
$sql = "UPDATE `phone_verification` SET `token_code` = '$token_code', `expiration_time` = DATE_ADD(NOW(), INTERVAL 5 MINUTE) WHERE `phone_number` = '$phone_number'";
$stmt = $con->prepare($sql);
$stmt->execute();
if ($stmt->rowCount() > 0) {
// The update was successful
printSuccess($message = "Phone verification data updated successfully");
} else {
// The update was unsuccessful
printFailure($message = "Failed to update phone verification data");
}
} else {
// The phone number does not exist, so insert the data
$sql = "INSERT INTO `phone_verification` (`phone_number`, `driverId` ,`email`,`token_code`, `expiration_time`, `is_verified`, `created_at`) VALUES ('$phone_number','$driverId','$email', '$token_code', DATE_ADD(NOW(), INTERVAL 5 MINUTE), 0, NOW())";
$stmt = $con->prepare($sql);
$stmt->execute();
if ($stmt->rowCount() > 0) {
// The insertion was successful
printSuccess($message = "Phone verification data saved successfully");
} else {
// The insertion was unsuccessful
printFailure($message = "Failed to save phone verification data");
}
}
?>

View File

@@ -1,111 +0,0 @@
<?php
include "../../connect.php";
$id = filterRequest("id");
// Check if any columns are set in the request
// if (!isset($_POST["phone"]) && !isset($_POST["email"]) && !isset($_POST["password"]) &&
// !isset($_POST["gender"]) && !isset($_POST["status"]) && !isset($_POST["birthdate"]) &&
// !isset($_POST["site"]) && !isset($_POST["first_name"]) && !isset($_POST["last_name"]) &&
// !isset($_POST["accountBank"]) && !isset($_POST["education"]) && !isset($_POST["employmentType"]) &&
// !isset($_POST["maritalStatus"]) && !isset($_POST["created_at"]) && !isset($_POST["updated_at"])) {
// // No data to update
// printFailure($message = "No driver data provided for update.");
// exit;
// }
// Create an empty array to store the column-value pairs
$columnValues = array();
// Add column-value pairs based on received data
if (isset($_POST["phone"])) {
$phone = filterRequest("phone");
$columnValues[] = "`phone` = '$phone'";
}
if (isset($_POST["email"])) {
$email = filterRequest("email");
$columnValues[] = "`email` = '$email'";
}
if (isset($_POST["password"])) {
$password = filterRequest("password");
$columnValues[] = "`password` = '$password'"; // Hash password before storing
}
if (isset($_POST["gender"])) {
$gender = filterRequest("gender");
$columnValues[] = "`gender` = '$gender'";
}
if (isset($_POST["status"])) {
$status = filterRequest("status");
$columnValues[] = "`status` = '$status'";
}
if (isset($_POST["birthdate"])) {
$birthdate = filterRequest("birthdate");
$columnValues[] = "`birthdate` = '$birthdate'";
}
if (isset($_POST["site"])) {
$site = filterRequest("site");
$columnValues[] = "`site` = '$site'";
}
if (isset($_POST["first_name"])) {
$first_name = filterRequest("first_name");
$columnValues[] = "`first_name` = '$first_name'";
}
if (isset($_POST["last_name"])) {
$last_name = filterRequest("last_name");
$columnValues[] = "`last_name` = '$last_name'";
}
if (isset($_POST["accountBank"])) {
$accountBank = filterRequest("accountBank");
$columnValues[] = "`accountBank` = '$accountBank'";
}
if (isset($_POST["education"])) {
$education = filterRequest("education");
$columnValues[] = "`education` = '$education'";
}
if (isset($_POST["employmentType"])) {
$employmentType = filterRequest("employmentType");
$columnValues[] = "`employmentType` = '$employmentType'";
}
if (isset($_POST["maritalStatus"])) {
$maritalStatus = filterRequest("maritalStatus");
$columnValues[] = "`maritalStatus` = '$maritalStatus'";
}
if (isset($_POST["bankCode"])) {
$bankCode = filterRequest("bankCode");
$columnValues[] = "`bankCode` = '$bankCode'";
}
if (isset($_POST["updated_at"])) {
$updatedAt = filterRequest("updated_at");
$columnValues[] = "`updated_at` = '$updatedAt'";
}
// Construct the SET clause of the update query
$setClause = implode(", ", $columnValues);
$sql = "UPDATE `driver` SET $setClause WHERE `id` = '$id'";
$stmt = $con->prepare($sql);
$stmt->execute();
if ($stmt->rowCount() > 0) {
// Print success message
printSuccess($message = "Driver data updated successfully");
} else {
// Print failure message
printFailure($message = "Failed to update driver data");
}
?>

View File

@@ -1,33 +0,0 @@
<?php
include "../../connect.php";
$phone_number = filterRequest("phone_number");
$token_code = filterRequest("token_code");
// Check if the phone number and token code match
$sql = "SELECT
`id`,
`phone_number`,
`token_code`,
`expiration_time`,
`is_verified`,
`created_at`
FROM
`phone_verification`
WHERE
`phone_number` = '$phone_number' AND `token_code` = '$token_code' AND `expiration_time` > NOW()";
$stmt = $con->prepare($sql);
$stmt->execute();
$result = $stmt->fetch();
if ($result) {
// $id = $result["id"];
$sql = "UPDATE `phone_verification` SET `is_verified` = 1 WHERE `phone_number` = $phone_number";
$stmt = $con->prepare($sql);
$stmt->execute();
printSuccess($message = "Your phone number has been verified.");
} else {
printFailure($message = "Your phone number could not be verified. Please try again.");
}
?>

View File

@@ -1,27 +0,0 @@
<?php
include "../connect.php";
$phoneNumber = filterRequest("phone_number");
$sql = "SELECT
*
FROM
`phone_verification`
WHERE
`phone_verification`.`phone_number` = '$phoneNumber'
";
$stmt = $con->prepare($sql);
$stmt->execute();
if ($stmt->rowCount() > 0) {
// Fetch the records
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
printSuccess($rows);
} else {
// Print a failure message
printFailure($message = "No Phone verified yet found");
}
?>

View File

@@ -1,27 +0,0 @@
<?php
include "../connect.php";
$phoneNumber = filterRequest("phone_number");
$sql = "SELECT
*
FROM
`phone_verification_passenger`
WHERE
`phone_verification_passenger`.`phone_number` = '$phoneNumber'
";
$stmt = $con->prepare($sql);
$stmt->execute();
if ($stmt->rowCount() > 0) {
// Fetch the records
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
printSuccess($rows);
} else {
// Print a failure message
printFailure($message = "No Phone verified yet found");
}
?>

View File

@@ -1,23 +0,0 @@
<?php
include "../connect.php";
// Import the map
$cn = array(
"0" => "3",
"1" => "7",
"2" => "1",
"3" => "9",
"4" => "0",
"5" => "5",
"6" => "2",
"7" => "6",
"8" => "4",
"9" => "8"
);
// Convert the map to a JSON string with JSON_FORCE_OBJECT option
$jsonString = json_encode($cn, JSON_FORCE_OBJECT);
// Send the JSON string to the Flutter app
echo $jsonString;
?>

View File

@@ -1 +0,0 @@
["3","7","1","9","0","5","2","6","4","8"]

View File

@@ -1,67 +0,0 @@
<?php
include "../connect.php";
$email = filterRequest('email');
$phone = filterRequest('phone');
$password = filterRequest('password');
// Hash the password
$hashed_password = password_hash($password, PASSWORD_DEFAULT);
$sql = "SELECT
passengers.`id`,
passengers.`phone`,
passengers.`email`,
passengers.`password`,
passengers.`gender`,
passengers.`birthdate`,
passengers.`site`,
passengers.`first_name`,
passengers.`last_name`,
passengers.`education`,
passengers.`employmentType`,
passengers.`maritalStatus`,
passengers.`created_at`,
passengers.`updated_at`,
email_verifications.verified
FROM
`passengers`
LEFT JOIN email_verifications ON email_verifications.email = passengers.email
WHERE
passengers.phone = :phone AND passengers.email = :email ";
$stmt = $con->prepare($sql);
$stmt->bindParam(':email', $email);
$stmt->bindParam(':phone', $phone);
$stmt->execute();
$data = $stmt->fetchAll(PDO::FETCH_ASSOC);
$count = $stmt->rowCount();
if ($count > 0) {
$stored_password = $data[0]['password'];
if (password_verify($password, $stored_password)) {
unset($data[0]['password']);
echo json_encode([
"status" => "success",
"count" => $count,
"data" => $data
]);
} else {
// The password is incorrect
echo json_encode([
"status" => "Failure",
"data" => "Incorrect password."
]);
// printFailure("Incorrect password.");
}
} else {
// The user does not exist
echo json_encode([
"status" => "Failure",
"data" => "User does not exist."
]);
// printFailure("User does not exist.");
}
$conn->close();
?>

View File

@@ -1,41 +0,0 @@
<?php
include "../connect.php";
$email = filterRequest('email');
$id = filterRequest('id');
$sql = "SELECT
*,
phone_verification_passenger.verified
FROM
passengers
LEFT JOIN phone_verification_passenger ON phone_verification_passenger.phone_number = passengers.phone
WHERE
passengers.email =:email AND passengers.id = :id AND phone_verification_passenger.verified='1'
";
$stmt = $con->prepare($sql);
$stmt->bindParam(':email', $email);
$stmt->bindParam(':id', $id);
$stmt->execute();
$data = $stmt->fetchAll(PDO::FETCH_ASSOC);
$count = $stmt->rowCount();
header('Content-Type: application/json'); // Ensure the response is JSON
if ($count > 0) {
echo json_encode([
"status" => "success",
"count" => $count,
"data" => $data
]);
} else {
echo json_encode([
"status" => "Failure",
"data" => "User does not exist."
]);
}
$stmt = null; // Close the statement
$con = null; // Close the connection
exit(); // Ensure no further output

View File

@@ -1,42 +0,0 @@
<?php
include "../connect.php";
$phone_number = filterRequest("phone_number");
$token_code = filterRequest("token");
$expiration_time = filterRequest("expiration_time"); // Assuming this is a timestamp
// Check if the phone number already exists
$sql = "SELECT * FROM `phone_verification_passenger` WHERE `phone_number` = '$phone_number'";
$stmt = $con->prepare($sql);
$stmt->execute();
$rowCount = $stmt->rowCount();
if ($rowCount > 0) {
// The phone number already exists, so update the data
$sql = "UPDATE `phone_verification_passenger` SET `token` = '$token_code', `expiration_time` = DATE_ADD(NOW(), INTERVAL 5 MINUTE) WHERE `phone_number` = '$phone_number'";
$stmt = $con->prepare($sql);
$stmt->execute();
if ($stmt->rowCount() > 0) {
// The update was successful
printSuccess($message = "Phone verification data updated successfully");
} else {
// The update was unsuccessful
printFailure($message = "Failed to update phone verification data");
}
} else {
// The phone number does not exist, so insert the data
$sql = "INSERT INTO `phone_verification_passenger` (`phone_number`, `token`, `expiration_time`, `verified`, `created_at`) VALUES ('$phone_number', '$token_code', DATE_ADD(NOW(), INTERVAL 5 MINUTE), 0, NOW())";
$stmt = $con->prepare($sql);
$stmt->execute();
if ($stmt->rowCount() > 0) {
// The insertion was successful
printSuccess($message = "Phone verification data saved successfully");
} else {
// The insertion was unsuccessful
printFailure($message = "Failed to save phone verification data");
}
}
?>

View File

@@ -1,30 +0,0 @@
<?php
include "../connect.php";
$platform = filterRequest("platform");
$appName = filterRequest("appName");
$sql = "SELECT
`id`,
`platform`,
`appName`,
`createdAt`,
`version`
FROM
`packageInfo`
WHERE
platform='$platform' and appName='$appName';";
$stmt = $con->prepare($sql);
$stmt->execute();
$result = $stmt->fetchAll(PDO::FETCH_ASSOC);
if ($stmt->rowCount() > 0) {
// Print all the records
// printData($result);
printSuccess($data = $result);
} else {
// Print a failure message
printFailure($message = "No records found");
}
?>

View File

@@ -1,42 +0,0 @@
<?php
include "../../connect.php";
$phone_number = filterRequest("phone_number");
$token_code = filterRequest("token_code");
$expiration_time = filterRequest("expiration_time"); // Assuming this is a timestamp
// Check if the phone number already exists
$sql = "SELECT * FROM `phone_verification_passenger` WHERE `phone_number` = '$phone_number'";
$stmt = $con->prepare($sql);
$stmt->execute();
$rowCount = $stmt->rowCount();
if ($rowCount > 0) {
// The phone number already exists, so update the data
$sql = "UPDATE `phone_verification_passenger` SET `token_code` = '$token_code', `expiration_time` = DATE_ADD(NOW(), INTERVAL 5 MINUTE) WHERE `phone_number` = '$phone_number'";
$stmt = $con->prepare($sql);
$stmt->execute();
if ($stmt->rowCount() > 0) {
// The update was successful
printSuccess($message = "Phone verification data updated successfully");
} else {
// The update was unsuccessful
printFailure($message = "Failed to update phone verification data");
}
} else {
// The phone number does not exist, so insert the data
$sql = "INSERT INTO `phone_verification_passenger` (`phone_number`, `token_code`, `expiration_time`, `is_verified`, `created_at`) VALUES ('$phone_number', '$token_code', DATE_ADD(NOW(), INTERVAL 5 MINUTE), 0, NOW())";
$stmt = $con->prepare($sql);
$stmt->execute();
if ($stmt->rowCount() > 0) {
// The insertion was successful
printSuccess($message = "Phone verification data saved successfully");
} else {
// The insertion was unsuccessful
printFailure($message = "Failed to save phone verification data");
}
}
?>

View File

@@ -1,23 +0,0 @@
<?php
include "../connect.php";
$phone_number = filterRequest("phone_number");
$token_code = filterRequest("token_code");
// Check if the phone number and token code match
$sql = "SELECT `id`, `phone_number`, `token_code`, `expiration_time`, `is_verified`, `created_at` FROM `phone_verification_passenger` WHERE `phone_number` = '$phone_number' AND `token_code` = '$token_code' AND `is_verified` = 0 AND `expiration_time` > NOW()";
$stmt = $con->prepare($sql);
$stmt->execute();
$result = $stmt->fetch();
if ($result) {
// $id = $result["id"];
$sql = "UPDATE `phone_verification_passenger` SET `is_verified` = 1 WHERE `phone_number` = $phone_number";
$stmt = $con->prepare($sql);
$stmt->execute();
printSuccess($message = "Your phone number has been verified.");
} else {
printFailure($message = "Your phone number could not be verified. Please try again.");
}
?>

View File

@@ -1,30 +0,0 @@
<?php
include "../connect.php";
$email = filterRequest("email");
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type: text/html; charset=UTF-8" . "\r\n";
$headers .= "From: SEFER Team" . "\r\n";
// Create the email subject and body
$subject = 'Your SEFER account has been deleted';
$body = '
Dear passenger,
We are sorry to see you go, but we respect your decision to delete your SEFER account.
We would like to thank you for using our platform and for being a part of the SEFER community. We hope that you had a positive experience and that we were able to make your travels easier and more enjoyable.
If you have any questions or concerns, please do not hesitate to contact us.
Sincerely,
The SEFER Team
';
// Send the email
mail($email, $subject, $body);
?>

View File

@@ -1,34 +0,0 @@
<?php
include "../connect.php";
$email = filterRequest("email");
$token = filterRequest("token");
$admin='support@mobile-app.store';
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type: text/html; charset=UTF-8" . "\r\n";
$headers .= "From: $admin" . "\r\n";
$subject = "Verify your email address";
$bodyEmail = "
<html>
<head>
<title>Verify your email address</title>
</head>
<body>
<p>Hi [$email],</p>
<p>We recently received a request to verify your email address for your account on Ride App.</p>
<p>To verify your email address, please write this to app .</p>
$token
<p>If you did not request to verify your email address, please ignore this email.</p>
<p>Thank you,</p>
SEFER Team.
</body>
</html>
";
mail($email, $subject, $bodyEmail, $headers);

View File

@@ -1,72 +0,0 @@
<?php
include "../connect.php";
$email = filterRequest("email");
$token = filterRequest("token");
$sql = "SELECT * FROM `email_verifications` WHERE `email` = '$email'";
$stmt = $con->prepare($sql);
$stmt->execute();
$rowCount = $stmt->rowCount();
$admin='support@mobile-app.store';
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type: text/html; charset=UTF-8" . "\r\n";
$headers .= "From: $admin" . "\r\n";
$subject = "Verify your email address";
$bodyEmail = "
<html>
<head>
<title>Verify your email address</title>
</head>
<body>
<p>Hi [$email],</p>
<p>We recently received a request to verify your email address for your account on SEFER App.</p>
<p>To verify your email address, please write this to app .</p>
$token
<p>If you did not request to verify your email address, please ignore this email.</p>
<p>Thank you,</p>
SEFER Team.
</body>
</html>
";
if ($rowCount > 0) {
// The email already exists, so update the data
$sql = "UPDATE `email_verifications` SET `token` = '$token' WHERE `email` = '$email'";
$stmt = $con->prepare($sql);
$stmt->execute();
if ($stmt->rowCount() > 0) {
// The update was successful
printSuccess($message = "Email verification data updated successfully");
mail($email, $subject, $bodyEmail, $headers);
} else {
// The update was unsuccessful
printFailure($message = "Failed to update email verification data");
}
} else {
// The email does not exist, so insert the data
$sql = "INSERT INTO `email_verifications` (`email`, `token`) VALUES ('$email', '$token')";
$stmt = $con->prepare($sql);
$stmt->execute();
if ($stmt->rowCount() > 0) {
// The insertion was successful
printSuccess($message = "Email verification data saved successfully");
mail($email, $subject, $bodyEmail, $headers);
} else {
// The insertion was unsuccessful
printFailure($message = "Failed to save email verification data");
}
}
?>

View File

@@ -1,64 +0,0 @@
<?php
include "../connect.php";
$phone = filterRequest("phone");
$email = filterRequest("email");
$first_name = filterRequest("first_name");
$last_name = filterRequest("last_name");
$password = filterRequest("password");
$hashedPassword = password_hash($password, PASSWORD_DEFAULT);
$gender = filterRequest("gender");
$birthdate = filterRequest("birthdate");
$site = filterRequest("site");
$id = filterRequest("id");
// Check if the phone number or email address already exists in the database
$sql = "SELECT * FROM passengers WHERE phone='$phone' OR email='$email'";
$stmt = $con->prepare($sql);
$stmt->execute();
$results = $stmt->fetchAll();
if (count($results) > 0) {
// The phone number or email address already exists in the database
// Print a message and exit
printFailure($message="The email or phone number is already registered.");
exit;
} else {
// The phone number or email address does not exist in the database
// Insert a new record
$sql = "INSERT INTO `passengers` (
`id`,
`phone`,
`email`,
`password`,
`gender`,
`birthdate`,
`site`,
`first_name`,
`last_name`
) VALUES (
'$id',
'$phone',
'$email',
'$hashedPassword',
'$gender',
'$birthdate',
'$site',
'$first_name',
'$last_name'
)";
$stmt = $con->prepare($sql);
$stmt->execute();
}
// Check if the record was successfully saved
if ($stmt->rowCount() > 0) {
// Print a success message
printSuccess($message = "success to save passenger data");
} else {
// Print a failure message
printFailure($message = "Failed to save passenger data");
}
?>

View File

@@ -1,28 +0,0 @@
<?php
include "../../connect.php";
$sql = "SELECT
*
FROM
`smsSender`
WHERE
id = '1'";
$stmt = $con->prepare($sql);
$stmt->execute();
$result = $stmt->fetchAll(PDO::FETCH_ASSOC);
if ($stmt->rowCount() > 0) {
printSuccess($data = $result);
} else {
printFailure($message = "No driver order data found");
}
?>

View File

@@ -1,33 +0,0 @@
<?php
// Include the database connection file
include "../../connect.php";
// Filter and validate the phone number input
$phone_number = filterRequest("phone_number");
// Prepare the SQL query using a parameterized query to prevent SQL injection
$sql = "UPDATE phone_verification SET is_verified = 1 WHERE phone_number = :phone_number";
// Prepare the statement
$stmt = $con->prepare($sql);
// Bind the phone number parameter
$stmt->bindParam(":phone_number", $phone_number);
// Execute the query
$stmt->execute();
// Get the number of affected rows
$affectedRows = $stmt->rowCount();
// Check if the update was successful
if ($affectedRows > 0) {
// Return a success response
printSuccess($data = ["message" => "Phone number verified successfully"]);
} else {
// Return a failure response
printFailure($message = "No phone number found or verification failed");
}
?>

View File

@@ -1,33 +0,0 @@
<?php
// Include the database connection file
include "../../connect.php";
// Filter and validate the phone number input
$phone_number = filterRequest("phone_number");
// Prepare the SQL query using a parameterized query to prevent SQL injection
$sql = "UPDATE phone_verification_passenger SET verified = 1 WHERE phone_number = :phone_number";
// Prepare the statement
$stmt = $con->prepare($sql);
// Bind the phone number parameter
$stmt->bindParam(":phone_number", $phone_number);
// Execute the query
$stmt->execute();
// Get the number of affected rows
$affectedRows = $stmt->rowCount();
// Check if the update was successful
if ($affectedRows > 0) {
// Return a success response
printSuccess($data = ["message" => "Phone number verified successfully"]);
} else {
// Return a failure response
printFailure($message = "No phone number found or verification failed");
}
?>

View File

@@ -1,39 +0,0 @@
<?php
include "../../jwtconnect.php";
$captainId = filterRequest('captain_id');
$newToken = filterRequest("token");
$fingerPrint = filterRequest("fingerPrint");
if (!$captainId || !$newToken || !$fingerPrint) {
echo json_encode([
"status" => "failure",
"message" => "Missing required fields"
]);
exit;
}
try {
// بدون أي تشفير: خزّن التوكن كما هو
$tokenPlain = $newToken;
$stmt = $con->prepare("UPDATE driverToken SET token = ?, fingerPrint = ?, updated_at = NOW() WHERE captain_id = ?");
$ok = $stmt->execute([$tokenPlain, $fingerPrint, $captainId]);
if ($ok && $stmt->rowCount() > 0) {
echo json_encode([
"status" => "success",
"message" => "Driver token updated successfully"
]);
} else {
echo json_encode([
"status" => "failure",
"message" => "Captain not found or no update performed"
]);
}
} catch (PDOException $e) {
echo json_encode([
"status" => "failure",
"message" => "Database error: " . $e->getMessage()
]);
}

View File

@@ -1,46 +0,0 @@
<?php
require_once "../../jwtconnect.php"; // يحتوي $con و $encryptionHelper و filterRequest()
header('Content-Type: application/json; charset=utf-8');
$passengerId = filterRequest('passengerID');
$newToken = filterRequest('token');
$fingerPrint = filterRequest('fingerPrint');
if (!$passengerId || !$newToken || !$fingerPrint) {
echo json_encode([
"status" => "failure",
"message" => "Missing required fields"
]);
exit;
}
try {
// تشفير التوكن قبل التخزين
// $tokenEncrypted = $encryptionHelper->encryptData($newToken);
// تحديث سجل الراكب
$stmt = $con->prepare("
UPDATE tokens
SET token = ?, fingerPrint = ?
WHERE passengerID = ?
");
$ok = $stmt->execute([$newToken, $fingerPrint, $passengerId]);
if ($ok && $stmt->rowCount() > 0) {
echo json_encode([
"status" => "success",
"message" => "Passenger token updated successfully"
]);
} else {
echo json_encode([
"status" => "failure",
"message" => "Passenger not found or no update performed"
]);
}
} catch (PDOException $e) {
echo json_encode([
"status" => "failure",
"message" => "Database error: " . $e->getMessage()
]);
}

View File

@@ -1,39 +0,0 @@
<?php
include "../connect.php";
$email = filterRequest("email");
$token = filterRequest("token");
$sql = "SELECT `id`, `email`, `token`, `created_at`, `updated_at`, `verified` FROM `email_verifications` WHERE `email` = '$email' AND `token` = '$token'";
$stmt = $con->prepare($sql);
$stmt->execute();
$result = $stmt->fetch();
if ($result) {
$id = $result["id"];
$sql = "UPDATE `email_verifications` SET `verified` = 1 WHERE `id` = $id";
$stmt = $con->prepare($sql);
$stmt->execute();
$admin='support@sefer.com';
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type: text/html; charset=UTF-8" . "\r\n";
$headers .= "From: $admin" . "\r\n";
$subject = " Verify your email address";
$bodyEmail="Subject: Verify your email address
Hi [$email],
Your email address has been verified.
Thank you,
SEFER Team";
mail($email, $subject, $bodyEmail, $headers);
printSuccess($message = "Your email address has been verified.");
} else {
printFailure($message ="Your email address could not be verified. Please try again.");
}
?>

View File

@@ -1,33 +0,0 @@
<?php
include "../connect.php";
$phone_number = filterRequest("phone_number");
$token_code = filterRequest("token");
// Check if the phone number and token code match
$sql = "SELECT
`id`,
`phone_number`,
`token`,
`expiration_time`,
`verified`,
`created_at`
FROM
`phone_verification_passenger`
WHERE
`phone_number` = '$phone_number' AND `token` = '$token_code' AND `expiration_time` > NOW()";
$stmt = $con->prepare($sql);
$stmt->execute();
$result = $stmt->fetch();
if ($result) {
// $id = $result["id"];
$sql = "UPDATE `phone_verification_passenger` SET `verified` = 1 WHERE `phone_number` = $phone_number";
$stmt = $con->prepare($sql);
$stmt->execute();
printSuccess($message = "Your phone number has been verified.");
} else {
printFailure($message = "Your phone number could not be verified. Please try again.");
}
?>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 310 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 316 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 162 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 78 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 132 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 186 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 273 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 814 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 148 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 232 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 136 KiB

Some files were not shown because too many files have changed in this diff Show More