prepare("SELECT `id` FROM `users` WHERE `username` = :username OR `phone` = :phone LIMIT 1"); $stmt_check->execute([':username' => $username, ':phone' => $phone]); if ($stmt_check->fetch()) { $error_message = 'اسم المستخدم أو رقم الجوال مسجل مسبقاً بنظام المنصة.'; } else { // تشفير كلمة المرور بآلية آمنة $hashed_pass = password_hash($password, PASSWORD_BCRYPT); // زراعة العضو الجديد في جدول users $stmt_insert = $pdo->prepare("INSERT INTO `users` (`username`, `password_hash`, `full_name`, `phone`, `city`, `identity_num`) VALUES (:username, :hashed_pass, :full_name, :phone, :city, :identity_num)"); $stmt_insert->execute([ ':username' => $username, ':hashed_pass' => $hashed_pass, ':full_name' => $full_name, ':phone' => $phone, ':city' => $city, ':identity_num' => $identity_num ]); $success_message = 'تم إنشاء عضويتك بنجاح ومطابقتها أمنياً ببيئة النظام! يمكنك الآن الدخول.'; } } catch (PDOException $e) { $error_message = 'حدث خطأ أثناء حفظ البيانات، يرجى المحاولة لاحقاً.'; } } else { $error_message = 'يرجى تعبئة جميع خانات التسجيل بشكل كامل.'; } } ?>