Update: 2026-06-26 00:36:22
This commit is contained in:
@@ -1,30 +0,0 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/../../connect.php';
|
||||
|
||||
$sql = "SELECT * FROM `passengers` ORDER BY `created_at` DESC LIMIT 5";
|
||||
$stmt = $con->prepare($sql);
|
||||
$stmt->execute();
|
||||
|
||||
if ($stmt->rowCount() > 0) {
|
||||
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
|
||||
// فك التشفير للحقول الحساسة
|
||||
foreach ($rows as &$row) {
|
||||
$row['phone'] = $encryptionHelper->decryptData($row['phone']);
|
||||
$row['email'] = $encryptionHelper->decryptData($row['email']);
|
||||
$row['gender'] = $encryptionHelper->decryptData($row['gender']);
|
||||
$row['birthdate'] = $encryptionHelper->decryptData($row['birthdate']);
|
||||
$row['site'] = $encryptionHelper->decryptData($row['site']);
|
||||
$row['first_name'] = $encryptionHelper->decryptData($row['first_name']);
|
||||
$row['last_name'] = $encryptionHelper->decryptData($row['last_name']);
|
||||
$row['sosPhone'] = $encryptionHelper->decryptData($row['sosPhone']);
|
||||
$row['education'] = $encryptionHelper->decryptData($row['education']);
|
||||
$row['employmentType'] = $encryptionHelper->decryptData($row['employmentType']);
|
||||
$row['maritalStatus'] = $encryptionHelper->decryptData($row['maritalStatus']);
|
||||
}
|
||||
|
||||
jsonSuccess($rows);
|
||||
} else {
|
||||
jsonError("No passengers found");
|
||||
}
|
||||
?>
|
||||
@@ -1,46 +0,0 @@
|
||||
<?php
|
||||
// test_socket_dispatch.php
|
||||
|
||||
$socketUrl = getenv('LOCATION_SERVER_URL') ?: 'http://location.intaleq.xyz:2021';
|
||||
$INTERNAL_KEY = getenv('INTERNAL_SOCKET_KEY');
|
||||
if (empty($INTERNAL_KEY)) {
|
||||
$keyPath = getenv('INTERNAL_SOCKET_KEY_PATH');
|
||||
if ($keyPath && file_exists($keyPath)) {
|
||||
$INTERNAL_KEY = trim(file_get_contents($keyPath));
|
||||
}
|
||||
}
|
||||
|
||||
// جرّب Driver ID موجود عندك
|
||||
$driverId = 691;
|
||||
$rideId = 99999;
|
||||
|
||||
// payload تجريبي (بنفس شكل اللي عم تبعته بالـ add_ride)
|
||||
$payload = ["32.11153","36.0668","173.00","32.12207","36.06351","1.8064","","849a9faf3e68c1aeb708",
|
||||
"حمزه عايد","TOKEN","963992952235","1.8064","1","false","1.8064","3","692","","","3","false",
|
||||
"32.11153499923237,36.06680665165186","","","","","173.00","28.00","963992952235@intaleqapp.com",
|
||||
"وادي أكيدر","وادي أكيدر","Fixed Price","0.00","5.0"];
|
||||
|
||||
$postData = [
|
||||
'action' => 'dispatch_order',
|
||||
'drivers_ids' => json_encode([$driverId]),
|
||||
'ride_id' => $rideId,
|
||||
'payload' => $payload
|
||||
];
|
||||
|
||||
$ch = curl_init($socketUrl);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($ch, CURLOPT_POST, true);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($postData));
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, ["x-internal-key: $INTERNAL_KEY"]);
|
||||
curl_setopt($ch, CURLOPT_TIMEOUT, 3);
|
||||
|
||||
$response = curl_exec($ch);
|
||||
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||
|
||||
if (curl_errno($ch)) {
|
||||
die("Curl error: " . curl_error($ch));
|
||||
}
|
||||
curl_close($ch);
|
||||
|
||||
echo "HTTP Code: $httpCode\n";
|
||||
echo "Response: $response\n";
|
||||
205
backend/test_add_driver_and_car.php
Normal file
205
backend/test_add_driver_and_car.php
Normal file
@@ -0,0 +1,205 @@
|
||||
<?php
|
||||
/**
|
||||
* test_add_driver_and_car.php
|
||||
* ===========================
|
||||
* يضيف سائق + سيارته في قاعدة البيانات مباشرة (لأغراض الاختبار).
|
||||
* يستخدم نفس التشفير ونظام إدارة الهوية مثل الإنتاج.
|
||||
*
|
||||
* الاستخدام:
|
||||
* https://example.com/backend/test_add_driver_and_car.php?phone=96279xxxxxxx&password=1234&first_name=Ahmed&last_name=Ali&make=Hyundai&model=Elantra&year=2020&car_plate=1234&color=White
|
||||
*
|
||||
* جميع الحقول الاختيارية لها قيمة افتراضية.
|
||||
*/
|
||||
|
||||
require_once __DIR__ . '/core/bootstrap.php';
|
||||
|
||||
header('Content-Type: application/json; charset=utf-8');
|
||||
|
||||
try {
|
||||
/* ================== قراءة المدخلات ================== */
|
||||
$phone = filterRequest('phone');
|
||||
$password = filterRequest('password');
|
||||
$first_name = filterRequest('first_name');
|
||||
$last_name = filterRequest('last_name');
|
||||
|
||||
if (empty($phone) || empty($password) || empty($first_name) || empty($last_name)) {
|
||||
jsonError('Required: phone, password, first_name, last_name');
|
||||
exit;
|
||||
}
|
||||
|
||||
// توحيد الرقم (إزالة +/مسافات)
|
||||
$phone = preg_replace('/[ \-\(\)\+]/', '', $phone);
|
||||
|
||||
// حقول السائق الاختيارية
|
||||
$email = filterRequest('email') ?: $phone . '@intaleqapp.com';
|
||||
$gender = filterRequest('gender') ?: 'Male';
|
||||
$national_number = filterRequest('national_number') ?: '';
|
||||
$birthdate = filterRequest('birthdate') ?: '1990-01-01';
|
||||
$site = filterRequest('site') ?: 'testing';
|
||||
$license_type = filterRequest('license_type') ?: 'private';
|
||||
$employmentType = filterRequest('employmentType') ?: 'full_time';
|
||||
|
||||
// حقول السيارة
|
||||
$make = filterRequest('make') ?: 'Toyota';
|
||||
$model = filterRequest('model') ?: 'Camry';
|
||||
$year = filterRequest('year') ?: '2020';
|
||||
$car_plate = filterRequest('car_plate') ?: 'TEST' . random_int(100, 999);
|
||||
$vin = filterRequest('vin') ?: 'VIN' . bin2hex(random_bytes(8));
|
||||
$color = filterRequest('color') ?: 'White';
|
||||
$color_hex = filterRequest('color_hex') ?: '#FFFFFF';
|
||||
$fuel = filterRequest('fuel') ?: 'Petrol';
|
||||
$owner = filterRequest('owner') ?: trim($first_name . ' ' . $last_name);
|
||||
$expiration_date = filterRequest('expiration_date') ?: date('Y-m-d', strtotime('+1 year'));
|
||||
|
||||
/* ================== ID السائق ================== */
|
||||
$driverId = 'TEST' . date('YmdHis') . random_int(1000, 9999);
|
||||
|
||||
/* ================== التشفير ================== */
|
||||
$encPhone = $encryptionHelper->encryptData($phone);
|
||||
$encEmail = $encryptionHelper->encryptData($email);
|
||||
$encFirstName = $encryptionHelper->encryptData($first_name);
|
||||
$encLastName = $encryptionHelper->encryptData($last_name);
|
||||
$encNameArabic = $encryptionHelper->encryptData("$first_name $last_name");
|
||||
$encGender = $encryptionHelper->encryptData($gender);
|
||||
$encNationalNumber = $national_number ? $encryptionHelper->encryptData($national_number) : '';
|
||||
$encBirthdate = $encryptionHelper->encryptData($birthdate);
|
||||
$encSite = $encryptionHelper->encryptData($site);
|
||||
$encOwner = $encryptionHelper->encryptData($owner);
|
||||
$encCarPlate = $encryptionHelper->encryptData($car_plate);
|
||||
$encVin = $encryptionHelper->encryptData($vin);
|
||||
|
||||
$passwordHashed = password_hash($password, PASSWORD_DEFAULT);
|
||||
|
||||
$con = Database::get('main');
|
||||
|
||||
/* ================== التحقق من التكرار ================== */
|
||||
$dup = $con->prepare("SELECT id FROM driver WHERE phone = :p OR email = :e");
|
||||
$dup->execute([':p' => $encPhone, ':e' => $encEmail]);
|
||||
if ($dup->rowCount() > 0) {
|
||||
jsonError("Phone or email already registered.");
|
||||
exit;
|
||||
}
|
||||
|
||||
$con->beginTransaction();
|
||||
|
||||
/* ================== 1) إدراج السائق ================== */
|
||||
$sqlDriver = "
|
||||
INSERT INTO driver (
|
||||
id, phone, email, password, gender, license_type, national_number,
|
||||
name_arabic, issue_date, expiry_date, license_categories,
|
||||
address, licenseIssueDate, status, birthdate, site,
|
||||
first_name, last_name, accountBank, bankCode,
|
||||
employmentType, maritalStatus, fullNameMaritial, expirationDate,
|
||||
created_at, updated_at
|
||||
) VALUES (
|
||||
:id, :phone, :email, :pwd, :gender, :license_type, :national_number,
|
||||
:name_arabic, :issue_date, :expiry_date, :license_categories,
|
||||
:address, :licenseIssueDate, :status, :birthdate, :site,
|
||||
:first_name, :last_name, :accountBank, :bankCode,
|
||||
:employmentType, :maritalStatus, :fullNameMaritial, :expirationDate,
|
||||
NOW(), NOW()
|
||||
)
|
||||
";
|
||||
$insD = $con->prepare($sqlDriver);
|
||||
$insD->execute([
|
||||
':id' => $driverId,
|
||||
':phone' => $encPhone,
|
||||
':email' => $encEmail,
|
||||
':pwd' => $passwordHashed,
|
||||
':gender' => $encGender,
|
||||
':license_type' => $license_type,
|
||||
':national_number' => $encNationalNumber,
|
||||
':name_arabic' => $encNameArabic,
|
||||
':issue_date' => '2020-01-01',
|
||||
':expiry_date' => '2030-01-01',
|
||||
':license_categories' => 'B',
|
||||
':address' => $encSite,
|
||||
':licenseIssueDate' => '2020-01-01',
|
||||
':status' => 'pending_review',
|
||||
':birthdate' => $encBirthdate,
|
||||
':site' => $encSite,
|
||||
':first_name' => $encFirstName,
|
||||
':last_name' => $encLastName,
|
||||
':accountBank' => 'yet',
|
||||
':bankCode' => 'CIB',
|
||||
':employmentType' => $employmentType,
|
||||
':maritalStatus' => 'Single',
|
||||
':fullNameMaritial' => '',
|
||||
':expirationDate' => date('Y-m-d', strtotime('+5 years')),
|
||||
]);
|
||||
|
||||
/* ================== 2) إدراج السيارة ================== */
|
||||
$sqlCar = "
|
||||
INSERT INTO CarRegistration (
|
||||
driverID, vin, car_plate, make, model, year, expiration_date,
|
||||
color, owner, color_hex, fuel,
|
||||
vehicle_category_id, fuel_type_id,
|
||||
isDefault, created_at, status
|
||||
) VALUES (
|
||||
:driverID, :vin, :car_plate, :make, :model, :year, :expiration_date,
|
||||
:color, :owner, :color_hex, :fuel,
|
||||
:vehicle_category_id, :fuel_type_id,
|
||||
:isDefault, NOW(), 'active'
|
||||
)
|
||||
";
|
||||
$insC = $con->prepare($sqlCar);
|
||||
$insC->execute([
|
||||
':driverID' => $driverId,
|
||||
':vin' => $encVin,
|
||||
':car_plate' => $encCarPlate,
|
||||
':make' => $make,
|
||||
':model' => $model,
|
||||
':year' => $year,
|
||||
':expiration_date' => $expiration_date,
|
||||
':color' => $color,
|
||||
':owner' => $encOwner,
|
||||
':color_hex' => $color_hex,
|
||||
':fuel' => $fuel,
|
||||
':vehicle_category_id' => 1,
|
||||
':fuel_type_id' => 1,
|
||||
':isDefault' => 1,
|
||||
]);
|
||||
|
||||
$carRegID = $con->lastInsertId();
|
||||
|
||||
/* ================== 3) توكن السائق ================== */
|
||||
$token = bin2hex(random_bytes(20));
|
||||
$sqlToken = "
|
||||
INSERT INTO driverToken (token, captain_id, fingerPrint, created_at)
|
||||
VALUES (:token, :captain_id, :fingerPrint, NOW())
|
||||
";
|
||||
$con->prepare($sqlToken)->execute([
|
||||
':token' => $token,
|
||||
':captain_id' => $driverId,
|
||||
':fingerPrint' => 'test_fingerprint',
|
||||
]);
|
||||
|
||||
/* ================== 4) توثيق رقم الهاتف ================== */
|
||||
$sqlPhoneVer = "
|
||||
INSERT INTO phone_verification (phone_number, driverId, email, token_code, expiration_time, is_verified, created_at)
|
||||
VALUES (:phone, :driverId, :email, :token_code, DATE_ADD(NOW(), INTERVAL 1 YEAR), 1, NOW())
|
||||
";
|
||||
$con->prepare($sqlPhoneVer)->execute([
|
||||
':phone' => $encPhone,
|
||||
':driverId' => $driverId,
|
||||
':email' => $encEmail,
|
||||
':token_code' => $encryptionHelper->encryptData('999'),
|
||||
]);
|
||||
|
||||
/* ================== Commit ================== */
|
||||
$con->commit();
|
||||
|
||||
printSuccess([
|
||||
'driverID' => $driverId,
|
||||
'carRegID' => $carRegID,
|
||||
'status' => 'success',
|
||||
'message' => "Driver $first_name $last_name created successfully with status pending_review.",
|
||||
]);
|
||||
|
||||
} catch (Exception $e) {
|
||||
if (isset($con) && $con instanceof PDO && $con->inTransaction()) {
|
||||
$con->rollBack();
|
||||
}
|
||||
error_log("[test_add_driver] " . $e->getMessage());
|
||||
jsonError($e->getMessage());
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/core/bootstrap.php';
|
||||
$redis->flushAll();
|
||||
|
||||
$ch = curl_init('https://jordan-siro.intaleqapp.com/backend/loginFirstTime.php');
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($ch, CURLOPT_HEADER, true);
|
||||
curl_setopt($ch, CURLOPT_POST, true);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, 'id=new&password=unknown&aud=passenger-app:ios');
|
||||
$response = curl_exec($ch);
|
||||
curl_close($ch);
|
||||
|
||||
echo "RAW RESPONSE:\n";
|
||||
echo $response;
|
||||
Reference in New Issue
Block a user