encryptData($phone); // احضار كل الأعمدة باستثناء كلمة المرور $sql = "SELECT * FROM driver WHERE phone = :phone LIMIT 1"; $stmt = $con->prepare($sql); $stmt->execute([':phone' => $encPhone]); $driver = $stmt->fetch(PDO::FETCH_ASSOC); if ($driver) { // ✅ الحقول المشفرة اللي لازم تنفك: $encryptedFields = [ 'phone', 'email', 'first_name', 'last_name', 'national_number', 'address','gender','site', 'birthdate', 'name_arabic', ]; foreach ($encryptedFields as $field) { if (!empty($driver[$field])) { $driver[$field] = $encryptionHelper->decryptData($driver[$field]); } } // ❌ احذف كلمة المرور من النتيجة unset($driver['password']); jsonSuccess($driver); } else { jsonError("No driver found with this phone."); } } catch (PDOException $e) { jsonError("Error searching driver: " . $e->getMessage()); }