قرار المالك 2026-07-27: باك إند سيرو PHP هو المعتمد، وتطبيقاته المجرّبة ميدانياً تحل محل إعادة البناء المؤرشفة. سيرو نفسه لم يُمسّ. الخريطة: backend · payment_server · loction_server · ride_server · passenger_server · docker · dashboard · stress_test → الجذر siro_rider → apps/rider siro_driver → apps/driver siro_admin → dashboards/admin siro_service → dashboards/service android_bot → apps/android_bot socialBot → apps/socialBot نُسخ المتعقَّب في git سيرو فقط عبر `git archive` (3,198 ملفاً / ~169 م.ب) لا `cp -r` — فاستُثنيت مخلفات البناء تلقائياً. بلا أي تعديل محتوى عمداً: كل ما يلي يصير فرقاً مقروءاً مقابل المصدر. لم يُستورد وسببه: siromove.com (الموقع التسويقي يبقى marketing/ في تريبز، سيرو فيه 8 ملفات) · docs و planning (تريبز له docs/ الخاص) · deploy.sh (ليس نشراً على سيرفر بل `git add . && git push origin --all` — فخّ في مستودع آخر) · transit_dashboard (بانتظار قرار مصير backend-transit و dashboards/transit-web). ⚠️ لا يبني بعد — ثلاثة نواقص متوقعة ومقصودة: 1. `.env` و `lib/env/env.g.dart` غير متعقَّبين في سيرو (أسرار لكل مستأجر): كل تطبيق فلاتر يحتاج .env خاصاً ثم توليد env.g.dart بـ build_runner. 2. إعدادات Firebase (9 ملفات google-services.json و GoogleService-Info.plist) يستبعدها .gitignore تريبز — ولكل مستأجر مشروع Firebase خاص أصلاً. 3. apps/driver في سيرو يشير إلى `../../Intaleq/packages/get` خارج المستودع → يجب ضمّ الحزم داخله أسوة بـ apps/rider. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
83 lines
2.9 KiB
PHP
83 lines
2.9 KiB
PHP
<?php
|
|
require_once __DIR__ . '/../../../connect.php';
|
|
|
|
$phoneNumber = filterRequest("phone_number");
|
|
$otp = filterRequest("otp");
|
|
|
|
if (empty($phoneNumber) || empty($otp)) {
|
|
jsonError("Phone number and OTP are required.");
|
|
exit();
|
|
}
|
|
|
|
$phoneNumber_encrypted = otpPhoneKey($phoneNumber);
|
|
// الرمز يُقارن بالتساوي أيضاً، فيحتاج نفس الصيغة الثابتة
|
|
$otp_encrypted = otpPhoneKey($otp);
|
|
|
|
try {
|
|
$stmt = $con->prepare("
|
|
SELECT * FROM token_verification_driver
|
|
WHERE phone_number = ? AND token = ?
|
|
");
|
|
$stmt->execute([$phoneNumber_encrypted, $otp_encrypted]);
|
|
$result = $stmt->fetch(PDO::FETCH_ASSOC);
|
|
|
|
if ($result) {
|
|
$expiration_time = strtotime($result['expiration_time']);
|
|
|
|
if (time() <= $expiration_time) {
|
|
$con->prepare("UPDATE token_verification_driver SET verified = 1 WHERE id = ?")
|
|
->execute([$result['id']]);
|
|
|
|
$driverStmt = $con->prepare("SELECT id FROM driver WHERE phone = ?");
|
|
$driverStmt->execute([$phoneNumber_encrypted]);
|
|
$driver = $driverStmt->fetch(PDO::FETCH_ASSOC);
|
|
|
|
if ($driver) {
|
|
$driverID = $driver['id'];
|
|
$newToken = filterRequest("token");
|
|
$fingerPrint = filterRequest("fingerPrint");
|
|
|
|
if ($newToken && $fingerPrint) {
|
|
$tokenEncrypted = $encryptionHelper->encryptData($newToken);
|
|
|
|
$checkTokenStmt = $con->prepare("SELECT id FROM driverToken WHERE captain_id = ?");
|
|
$checkTokenStmt->execute([$driverID]);
|
|
|
|
if ($checkTokenStmt->rowCount() > 0) {
|
|
$con->prepare("UPDATE driverToken SET token = ?, fingerPrint = ? WHERE captain_id = ?")
|
|
->execute([$tokenEncrypted, $fingerPrint, $driverID]);
|
|
} else {
|
|
$con->prepare("INSERT INTO driverToken (token, fingerPrint, captain_id, created_at) VALUES (?, ?, ?, NOW())")
|
|
->execute([$tokenEncrypted, $fingerPrint, $driverID]);
|
|
}
|
|
|
|
$response = [
|
|
"message" => "Driver token verified and updated.",
|
|
"isRegistered" => true,
|
|
"driverID" => $driverID
|
|
];
|
|
jsonSuccess($response);
|
|
|
|
} else {
|
|
jsonError("Token or fingerprint missing.");
|
|
}
|
|
|
|
} else {
|
|
printSuccess([
|
|
"message" => "Phone verified, but driver not found.",
|
|
"isRegistered" => false
|
|
]);
|
|
}
|
|
|
|
} else {
|
|
jsonError("OTP expired. Request a new one.");
|
|
}
|
|
|
|
} else {
|
|
jsonError("Invalid OTP.");
|
|
}
|
|
|
|
} catch (PDOException $e) {
|
|
error_log("[verify_otp_driver.php] " . $e->getMessage());
|
|
jsonError("Database error occurred.");
|
|
} |