prepare("SELECT * FROM users WHERE id = ?"); $stmt->execute([$user_id]); $user = $stmt->fetch(); $startupId = $_GET['id'] ?? null; if (!$startupId) { header('Location: startups.php'); exit; } $stmt = db()->prepare(" SELECT s.*, fr.id as round_id, fr.funding_goal as active_goal, fr.funding_raised as active_raised, fr.status as round_status FROM startups s LEFT JOIN funding_rounds fr ON s.id = fr.startup_id AND fr.status = 'Active' WHERE s.id = ? "); $stmt->execute([$startupId]); $startup = $stmt->fetch(); if (!$startup) { die("Startup not found."); } // Check if user is the founder or an investor $isFounder = ($_SESSION['user_id'] == $startup['founder_id']); $isInvestor = ($user['role'] == 'investor'); $isAnyFounder = ($user['role'] == 'founder'); // Basic permissions check // Allow if: is the founder, OR is an investor, OR is any founder (for partnership), OR startup is public if (!$isFounder && !$isInvestor && !$isAnyFounder && $startup['status'] === 'private') { die("You do not have permission to view this profile."); } // Check if following $stmt = db()->prepare("SELECT 1 FROM startup_followers WHERE user_id = ? AND startup_id = ?"); $stmt->execute([$user_id, $startupId]); $isFollowing = (bool)$stmt->fetch(); // Fetch funding history $canSeeHistory = $isFounder || $isInvestor; $fundingHistory = []; if ($canSeeHistory) { $stmt = db()->prepare(" SELECT i.*, u.full_name as investor_name, u.id as investor_user_id FROM investments i LEFT JOIN users u ON i.investor_id = u.id WHERE i.startup_id = ? AND i.status != 'rejected' ORDER BY i.created_at DESC "); $stmt->execute([$startupId]); $fundingHistory = $stmt->fetchAll(); } // Check if the current user (investor) has an investment here $myInvestment = null; if ($isInvestor) { $stmt = db()->prepare("SELECT * FROM investments WHERE investor_id = ? AND startup_id = ? AND status != 'rejected' LIMIT 1"); $stmt->execute([$user_id, $startupId]); $myInvestment = $stmt->fetch(); } // Fetch approved investments for dividends calculation (Founder only) $approvedInvestments = []; if ($isFounder) { $stmt = db()->prepare(" SELECT i.*, u.full_name as investor_name FROM investments i JOIN users u ON i.investor_id = u.id WHERE i.startup_id = ? AND i.status = 'approved' "); $stmt->execute([$startupId]); $approvedInvestments = $stmt->fetchAll(); } // Fetch founders $stmt = db()->prepare("SELECT id, full_name FROM users WHERE id = ?"); $stmt->execute([$startup['founder_id']]); $founder = $stmt->fetch(); $platformName = defined('PLATFORM_NAME') ? PLATFORM_NAME : 'Gatsby'; // Calculate progress $goal = $startup['active_goal'] ?: 0; $raised = $startup['active_raised'] ?: 0; $progress = ($goal > 0) ? round(($raised / $goal) * 100) : 0; ?> <?= htmlspecialchars($startup['name']) ?> | Startup Details
<?= htmlspecialchars($platformName) ?> Logo
£
Log Out
Round status updated successfully!
Followers

Founded by

Message Founder Invest Now Edit Profile

My Investment

Invested
£
Total Return
£
Monthly Div
£
Next Payment
Interest: % | Term: Months | Status:
Full Portfolio

Active Funding Round

% Complete
Raised
£
Goal
£

Startup Money Pot

Available Capital
£
Total Investments Received
£

Active Repayments

Tracking monthly payments to your active investors.

diff(new DateTime($nextPayDate))->format("%r%a"); ?>
£ @ % over mo
£
Next: (d)

Product & Vision

Partnership & Co-founder Info

Co-founder Equity
%
Equity Type
Core Responsibilities
Desired Experience
Commitment Required
Other Details

Financial Health

Cash on Hand
£
Monthly Burn
£

Historical Documentation

$startup['doc_income_statements'], 'Balance Sheets' => $startup['doc_balance_sheets'], 'Cash Flow' => $startup['doc_cash_flow_statements'], 'Revenue Breakdown' => $startup['doc_revenue_breakdown'], 'Gross Margin' => $startup['doc_gross_margin'] ]; foreach ($docs as $label => $path): if ($path): ?>

Investment Terms

Interest Rate
%
Repayment Term
Mo
Min Invest
£50
AI Yield Recommendation: %

Funding History

No investment history available yet.

£