💰 Twój Portfel
Dostępne środki
📊 Ostatnie transakcje
🔍 Brak transakcji
Tutaj pojawią się Twoje przyszłe transakcje
getMessage()); } // Pobieranie statystyk użytkownika $user_id = $_SESSION['user_id']; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/account_suspension.php'; $suspensionState = og_is_current_user_suspended($pdo); $isSuspended = (bool)($suspensionState['is_suspended'] ?? false); $suspendedReason = (string)($suspensionState['reason'] ?? ''); $suspendedUntil = (string)($suspensionState['suspended_until'] ?? ''); $stmt = $pdo->prepare("SELECT * FROM user_stats WHERE user_id = ?"); $stmt->execute([$user_id]); $stats = $stmt->fetch(PDO::FETCH_ASSOC); // Jeśli nie ma statystyk (stary użytkownik), utwórz rekord if (!$stats) { $stmt_create = $pdo->prepare("INSERT INTO user_stats (user_id, balance, matches_played, matches_won, matches_lost, matches_draw, tournaments_played, tournaments_won, leagues_participated, total_income, total_expenses, total_transactions, account_status) VALUES (?, 0.00, 0, 0, 0, 0, 0, 0, 0, 0.00, 0.00, 0, 'active')"); $stmt_create->execute([$user_id]); // Pobierz ponownie $stmt->execute([$user_id]); $stats = $stmt->fetch(PDO::FETCH_ASSOC); } // Formatowanie wartości $balance = number_format($stats['balance'], 2, '.', ''); $total_income = number_format($stats['total_income'], 2, '.', ''); $total_expenses = number_format($stats['total_expenses'], 2, '.', ''); $decisive_matches = ((int)$stats['matches_won']) + ((int)$stats['matches_lost']); $win_rate = $decisive_matches > 0 ? round((((int)$stats['matches_won']) / $decisive_matches) * 100, 1) : 0; $walletStatusLabel = $isSuspended ? '✗ Zawieszone' : (($stats['account_status'] ?? 'active') === 'active' ? '✓ Aktywne' : '✗ Nieaktywne'); $walletStatusColor = $isSuspended ? '#c62828' : ((($stats['account_status'] ?? 'active') === 'active') ? '#27ae60' : '#e74c3c'); // Pobieranie ostatnich 10 transakcji $stmt_transactions = $pdo->prepare("SELECT * FROM transactions WHERE user_id = ? ORDER BY created_at DESC LIMIT 10"); $stmt_transactions->execute([$user_id]); $transactions = $stmt_transactions->fetchAll(PDO::FETCH_ASSOC); // Funkcja do formatowania daty w języku polskim function formatPolishDate($datetime) { $months = [ 1 => 'stycznia', 2 => 'lutego', 3 => 'marca', 4 => 'kwietnia', 5 => 'maja', 6 => 'czerwca', 7 => 'lipca', 8 => 'sierpnia', 9 => 'września', 10 => 'października', 11 => 'listopada', 12 => 'grudnia' ]; $timestamp = strtotime($datetime); $day = date('j', $timestamp); $month = $months[(int)date('n', $timestamp)]; $year = date('Y', $timestamp); $time = date('H:i', $timestamp); return "$day $month $year, $time"; } ?>
🔍 Brak transakcji
Tutaj pojawią się Twoje przyszłe transakcje