Update: 2026-06-11 18:22:57
This commit is contained in:
BIN
walletintaleq.intaleq.xyz/v2/main/auth/.DS_Store
vendored
Normal file
BIN
walletintaleq.intaleq.xyz/v2/main/auth/.DS_Store
vendored
Normal file
Binary file not shown.
@@ -0,0 +1,29 @@
|
||||
<?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");
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,23 @@
|
||||
<?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");
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,35 @@
|
||||
<?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");
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,19 @@
|
||||
<?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");
|
||||
}
|
||||
?>
|
||||
22
walletintaleq.intaleq.xyz/v2/main/auth/captin/getAccount.php
Normal file
22
walletintaleq.intaleq.xyz/v2/main/auth/captin/getAccount.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?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");
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,23 @@
|
||||
<?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");
|
||||
}
|
||||
?>
|
||||
67
walletintaleq.intaleq.xyz/v2/main/auth/captin/login.php
Normal file
67
walletintaleq.intaleq.xyz/v2/main/auth/captin/login.php
Normal file
@@ -0,0 +1,67 @@
|
||||
<?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();
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,56 @@
|
||||
<?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();
|
||||
110
walletintaleq.intaleq.xyz/v2/main/auth/captin/register.php
Executable file
110
walletintaleq.intaleq.xyz/v2/main/auth/captin/register.php
Executable file
@@ -0,0 +1,110 @@
|
||||
<?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());
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?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");
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,44 @@
|
||||
<?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");
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,111 @@
|
||||
<?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");
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,33 @@
|
||||
<?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.");
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,27 @@
|
||||
<?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");
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,27 @@
|
||||
<?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");
|
||||
}
|
||||
|
||||
?>
|
||||
23
walletintaleq.intaleq.xyz/v2/main/auth/cnMap.php
Normal file
23
walletintaleq.intaleq.xyz/v2/main/auth/cnMap.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?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;
|
||||
?>
|
||||
1
walletintaleq.intaleq.xyz/v2/main/auth/cn_map.json
Normal file
1
walletintaleq.intaleq.xyz/v2/main/auth/cn_map.json
Normal file
@@ -0,0 +1 @@
|
||||
["3","7","1","9","0","5","2","6","4","8"]
|
||||
0
walletintaleq.intaleq.xyz/v2/main/auth/error_log
Normal file
0
walletintaleq.intaleq.xyz/v2/main/auth/error_log
Normal file
67
walletintaleq.intaleq.xyz/v2/main/auth/login.php
Normal file
67
walletintaleq.intaleq.xyz/v2/main/auth/login.php
Normal file
@@ -0,0 +1,67 @@
|
||||
<?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();
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,41 @@
|
||||
<?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
|
||||
42
walletintaleq.intaleq.xyz/v2/main/auth/otpmessage.php
Normal file
42
walletintaleq.intaleq.xyz/v2/main/auth/otpmessage.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?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");
|
||||
}
|
||||
}
|
||||
?>
|
||||
30
walletintaleq.intaleq.xyz/v2/main/auth/packageInfo.php
Normal file
30
walletintaleq.intaleq.xyz/v2/main/auth/packageInfo.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?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");
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,42 @@
|
||||
<?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");
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,23 @@
|
||||
<?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.");
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,30 @@
|
||||
<?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);
|
||||
|
||||
?>
|
||||
34
walletintaleq.intaleq.xyz/v2/main/auth/sendEmail.php
Normal file
34
walletintaleq.intaleq.xyz/v2/main/auth/sendEmail.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?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);
|
||||
72
walletintaleq.intaleq.xyz/v2/main/auth/sendVerifyEmail.php
Normal file
72
walletintaleq.intaleq.xyz/v2/main/auth/sendVerifyEmail.php
Normal file
@@ -0,0 +1,72 @@
|
||||
<?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");
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
64
walletintaleq.intaleq.xyz/v2/main/auth/signup.php
Normal file
64
walletintaleq.intaleq.xyz/v2/main/auth/signup.php
Normal file
@@ -0,0 +1,64 @@
|
||||
<?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");
|
||||
}
|
||||
|
||||
?>
|
||||
28
walletintaleq.intaleq.xyz/v2/main/auth/sms/getSender.php
Normal file
28
walletintaleq.intaleq.xyz/v2/main/auth/sms/getSender.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?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");
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,33 @@
|
||||
<?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");
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,33 @@
|
||||
<?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");
|
||||
}
|
||||
|
||||
?>
|
||||
39
walletintaleq.intaleq.xyz/v2/main/auth/token/update_driver_auth.php
Executable file
39
walletintaleq.intaleq.xyz/v2/main/auth/token/update_driver_auth.php
Executable file
@@ -0,0 +1,39 @@
|
||||
<?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()
|
||||
]);
|
||||
}
|
||||
46
walletintaleq.intaleq.xyz/v2/main/auth/token/update_passenger_token.php
Executable file
46
walletintaleq.intaleq.xyz/v2/main/auth/token/update_passenger_token.php
Executable file
@@ -0,0 +1,46 @@
|
||||
<?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()
|
||||
]);
|
||||
}
|
||||
39
walletintaleq.intaleq.xyz/v2/main/auth/verifyEmail.php
Normal file
39
walletintaleq.intaleq.xyz/v2/main/auth/verifyEmail.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?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.");
|
||||
}
|
||||
?>
|
||||
33
walletintaleq.intaleq.xyz/v2/main/auth/verifyOtpMessage.php
Normal file
33
walletintaleq.intaleq.xyz/v2/main/auth/verifyOtpMessage.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?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.");
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user