prepare("SELECT * FROM users WHERE id = ?"); $stmt->execute([$current_user_id]); $user = $stmt->fetch(); if (!$user) { session_destroy(); header("Location: login.php"); exit; } $user_role = $user['role']; // Leaderboard: Most Followed This Week $stmt = db()->prepare(" SELECT s.id, s.name, s.description, u.full_name as founder_name, COUNT(sf.id) as followers_count FROM startups s JOIN users u ON s.founder_id = u.id JOIN startup_followers sf ON s.id = sf.startup_id WHERE sf.created_at >= DATE_SUB(NOW(), INTERVAL 7 DAY) GROUP BY s.id ORDER BY followers_count DESC LIMIT 10 "); $stmt->execute(); $mostFollowed = $stmt->fetchAll(); // Leaderboard: Most Funded This Week $stmt = db()->prepare(" SELECT s.id, s.name, s.description, u.full_name as founder_name, SUM(i.amount) as funded_amount FROM startups s JOIN users u ON s.founder_id = u.id JOIN investments i ON s.id = i.startup_id WHERE i.status = 'approved' AND i.created_at >= DATE_SUB(NOW(), INTERVAL 7 DAY) GROUP BY s.id ORDER BY funded_amount DESC LIMIT 10 "); $stmt->execute(); $mostFunded = $stmt->fetchAll(); // Search logic $q = $_GET['q'] ?? ''; $browseStartups = []; $where = "s.status = 'public'"; $params = []; if ($q) { $where .= " AND (s.name LIKE ? OR s.description LIKE ? OR u.full_name LIKE ?)"; $params[] = "%$q%"; $params[] = "%$q%"; $params[] = "%$q%"; } $stmt = db()->prepare(" SELECT s.*, u.full_name as founder_name FROM startups s JOIN users u ON s.founder_id = u.id WHERE $where ORDER BY s.created_at DESC LIMIT 20 "); $stmt->execute($params); $browseStartups = $stmt->fetchAll(); $platformName = defined('PLATFORM_NAME') ? PLATFORM_NAME : 'Gatsby'; ?> Discovery Hub — <?= htmlspecialchars($platformName) ?>
Log Out

Discovery Hub

Explore the best student-led innovation across the network.

Most Followed
$s): ?>
by
Most Funded
$s): ?>
by
£

Browse All Startups

by

Raised
£