prepare("SELECT * FROM users WHERE id = ?"); $stmt->execute([$_SESSION['user_id']]); $user = $stmt->fetch(); if (!$user) { session_destroy(); header("Location: login.php"); exit; } if ($user['verified'] == 0) { session_destroy(); header("Location: login.php?error=not_verified"); exit; } if ($user['role'] === 'founder' && $user['onboarding_completed'] == 0) { header("Location: founder_onboarding.php"); exit; } $platformName = defined('PLATFORM_NAME') ? PLATFORM_NAME : 'Gatsby'; $trendingIds = []; $stmt = db()->prepare(" SELECT s.id FROM startups s LEFT JOIN startup_followers sf ON s.id = sf.startup_id GROUP BY s.id ORDER BY COUNT(sf.id) DESC LIMIT 3 "); $stmt->execute(); $topFollowed = $stmt->fetchAll(PDO::FETCH_COLUMN); $trendingIds = array_merge($trendingIds, $topFollowed); $stmt = db()->prepare(" SELECT id FROM startups ORDER BY funding_raised DESC LIMIT 3 "); $stmt->execute(); $topFunded = $stmt->fetchAll(PDO::FETCH_COLUMN); $trendingIds = array_unique(array_merge($trendingIds, $topFunded)); $myStartups = []; $myInvestments = []; $repaymentSummary = [ 'total_raised' => 0, 'total_obligation' => 0, 'monthly_outgoing' => 0, 'active_investors' => 0, 'next_payment_date' => null ]; if ($user['role'] === 'founder') { $stmt = db()->prepare(" SELECT s.*, fr.funding_goal as active_goal, fr.funding_raised as active_raised, fr.status as round_status, fr.id as round_id FROM startups s LEFT JOIN funding_rounds fr ON s.id = fr.startup_id AND fr.status = 'Active' WHERE s.founder_id = ? ORDER BY s.created_at DESC "); $stmt->execute([$_SESSION['user_id']]); $myStartups = $stmt->fetchAll(); // Repayment Summary Calculation $stmt = db()->prepare(" SELECT SUM(CASE WHEN i.status IN ('approved', 'completed') THEN i.amount ELSE 0 END) as total_raised, SUM(CASE WHEN i.status IN ('approved', 'completed') THEN i.total_return ELSE 0 END) as total_obligation, SUM(CASE WHEN i.status = 'approved' THEN i.monthly_dividend ELSE 0 END) as monthly_outgoing, COUNT(DISTINCT CASE WHEN i.status = 'approved' THEN i.investor_id END) as active_investors, MIN(CASE WHEN i.status = 'approved' THEN i.next_payment_date END) as next_payment_date FROM investments i JOIN startups s ON i.startup_id = s.id WHERE s.founder_id = ? "); $stmt->execute([$_SESSION['user_id']]); $repaymentSummary = $stmt->fetch(); } else { $stmt = db()->prepare("SELECT i.*, s.name as startup_name FROM investments i JOIN startups s ON i.startup_id = s.id WHERE i.investor_id = ? ORDER BY i.created_at DESC"); $stmt->execute([$_SESSION['user_id']]); $myInvestments = $stmt->fetchAll(); } function number_get_formatted($num) { return number_format((float)$num, 0, '.', ','); } ?> Dashboard — <?= htmlspecialchars($platformName) ?>
<?= htmlspecialchars($platformName) ?> Logo
£
Log Out
Launchpad Active

Welcome back, .

Your command center for the next big thing.

Funding & Repayment Overview

Total Raised
£
Total Obligation
£
Monthly Outgoing
£
Active Investors
Next Due Date

My Ventures

Ready to share your vision with the world?

Start Your First Round
Trending
Target: £
£
Funds Raised

Portfolio Overview

Find New Deals

Start backing the next generation of founders.

Start Investing
Committed on
£

Ecosystem Activity

Insights from your network and trending matches will appear here.

My Money Pot

Available Balance
£

My Profile

Edit