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 * FROM startups WHERE 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'); // Basic permissions check if (!$isFounder && $startup['status'] === 'private' && !$isInvestor) { die("You do not have permission to view this profile."); } // Fetch funding history if investor $canSeeHistory = $isFounder || $isInvestor; $fundingHistory = []; if ($canSeeHistory) { $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 = ? ORDER BY i.created_at DESC"); $stmt->execute([$startupId]); $fundingHistory = $stmt->fetchAll(); } // Fetch founders $stmt = db()->prepare("SELECT full_name as name FROM users WHERE id = ?"); $stmt->execute([$startup['founder_id']]); $founder = $stmt->fetch(); $platformName = defined('PLATFORM_NAME') ? PLATFORM_NAME : 'Gatsby'; ?>
Founded by = htmlspecialchars($founder['name']) ?>
= nl2br(htmlspecialchars($startup['product_service'])) ?>
= htmlspecialchars($startup['business_model']) ?>
= htmlspecialchars($startup['operational_stage']) ?>
No investment history available yet.