chore: استيراد أولي من سيرو (ecfe7568) — بلا أي تعديل
نسخة كاملة من مستودع سيرو عند ecfe7568 لتكون أساس تطبيق «انطلق». نُسخ المتعقَّب في git فقط (12,509 ملفاً / 302 م.ب) بـ git archive، لا `cp -r` — فاستُثنيت تلقائياً مخلفات البناء (build · node_modules · .dart_tool · .gradle · Pods ≈ 10.7 غ.ب) وكل ما يستثنيه .gitignore. هذا الكوميت **بلا أي تعديل عمداً** حتى يكون كل ما يليه فرقاً مقروءاً مقابل سيرو الأصلي. سيرو نفسه لم يُمسّ. ⚠️ لا يبني بعد: `.env` و`lib/env/env.g.dart` غير متعقَّبين في سيرو (وهذا صحيح — أسرار لكل مستأجر). كل تطبيق فلاتر هنا يحتاج .env خاصاً بانطلق ثم توليد env.g.dart عبر build_runner. لا تُنسخ أسرار سيرو. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,87 @@
|
||||
<?php
|
||||
// إعدادات الإنتاج (إخفاء الأخطاء عن المستخدم)
|
||||
ini_set('display_errors', 0);
|
||||
error_reporting(E_ALL);
|
||||
|
||||
// ضبط الترويسة والترميز UTF-8 هام جداً للنصوص العربية
|
||||
header('Content-Type: application/json; charset=utf-8');
|
||||
|
||||
require_once __DIR__ . '/../../get_connect.php';
|
||||
|
||||
// ضمان خروج النصوص العربية من قاعدة البيانات بشكل سليم
|
||||
if (isset($con)) {
|
||||
$con->exec("set names utf8mb4");
|
||||
}
|
||||
|
||||
$phone = "";
|
||||
if (isset($_GET['phone_number'])) {
|
||||
$phone = htmlspecialchars(strip_tags($_GET['phone_number']));
|
||||
} elseif (isset($_POST['phone_number'])) {
|
||||
$phone = htmlspecialchars(strip_tags($_POST['phone_number']));
|
||||
} else {
|
||||
$phone = filterRequest("phone_number");
|
||||
}
|
||||
|
||||
if (empty($phone)) {
|
||||
jsonError("Phone number is required");
|
||||
exit;
|
||||
}
|
||||
|
||||
// تشفير الرقم للبحث
|
||||
$phoneEncrypted = $encryptionHelper->encryptData($phone);
|
||||
|
||||
// الاستعلام: نختار الحقول بدقة لتجنب التضارب
|
||||
$sql = "SELECT
|
||||
d.id as driver_id,
|
||||
d.name_arabic as driver_name_encrypted, -- الاسم من جدول السائق
|
||||
d.phone as phone_encrypted,
|
||||
d.gender as gender_encrypted
|
||||
|
||||
FROM
|
||||
`driver` d
|
||||
|
||||
WHERE
|
||||
d.phone = ?
|
||||
LIMIT 1";
|
||||
|
||||
try {
|
||||
$stmt = $con->prepare($sql);
|
||||
$stmt->execute([$phoneEncrypted]);
|
||||
|
||||
if ($stmt->rowCount() > 0) {
|
||||
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
|
||||
foreach ($rows as &$item) {
|
||||
// ============================================
|
||||
// 1. فك تشفير الحقول المشفرة فقط (حسب ملف CSV)
|
||||
// ============================================
|
||||
|
||||
// بيانات السائق
|
||||
if (!empty($item['driver_name_encrypted'])) {
|
||||
$item['driverName'] = $encryptionHelper->decryptData($item['driver_name_encrypted']);
|
||||
}
|
||||
if (!empty($item['phone_encrypted'])) {
|
||||
$item['phone'] = $encryptionHelper->decryptData($item['phone_encrypted']);
|
||||
}
|
||||
if (!empty($item['gender_encrypted'])) {
|
||||
$item['gender'] = $encryptionHelper->decryptData($item['gender_encrypted']);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
jsonSuccess($rows);
|
||||
|
||||
} else {
|
||||
jsonError("No driver found with this phone number");
|
||||
}
|
||||
|
||||
} catch (PDOException $e) {
|
||||
error_log("SQL Error: " . $e->getMessage());
|
||||
jsonError("Database error");
|
||||
} catch (Exception $e) {
|
||||
error_log("General Error: " . $e->getMessage());
|
||||
jsonError("System error");
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user