prepare("SELECT id FROM fiat_orders WHERE user_id = ? AND status IN ('matching', 'matched', 'submitting') ORDER BY id DESC LIMIT 1");
$stmt->execute([$_SESSION['user_id']]);
$pending_order = $stmt->fetch();
if ($pending_order) {
header("Location: matching.php?order_id=" . $pending_order['id']);
exit;
}
$stmt = $db->prepare("SELECT * FROM users WHERE id = ?");
$stmt->execute([$_SESSION['user_id']]);
$user = $stmt->fetch();
$fiat_rates = get_fiat_rates();
$fiat_currencies_info = [
'USD' => 'US Dollar',
'EUR' => 'Euro',
'GBP' => 'British Pound',
'CNY' => 'Chinese Yuan',
'HKD' => 'Hong Kong Dollar',
'JPY' => 'Japanese Yen',
'KRW' => 'Korean Won',
'SGD' => 'Singapore Dollar',
'TWD' => 'Taiwan Dollar',
'THB' => 'Thai Baht',
'VND' => 'Vietnamese Dong',
'IDR' => 'Indonesian Rupiah',
'MYR' => 'Malaysian Ringgit',
];
?>