163 lines
8.9 KiB
PHP
163 lines
8.9 KiB
PHP
<?php
|
|
session_start();
|
|
if (!isset($_SESSION['user_id'])) {
|
|
header("Location: login.php");
|
|
exit;
|
|
}
|
|
|
|
require_once __DIR__ . '/db/config.php';
|
|
|
|
$stmt = db()->prepare("SELECT * FROM users WHERE id = ?");
|
|
$stmt->execute([$_SESSION['user_id']]);
|
|
$user = $stmt->fetch();
|
|
|
|
// Fetch startups (mock or real)
|
|
$stmt = db()->query("SELECT s.*, u.full_name as founder_name, u.university FROM startups s JOIN users u ON s.founder_id = u.id ORDER BY s.created_at DESC");
|
|
$startups = $stmt->fetchAll();
|
|
|
|
$platformName = defined('PLATFORM_NAME') ? PLATFORM_NAME : 'Gatsby';
|
|
?>
|
|
<!doctype html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<title>Discover Startups — <?= htmlspecialchars($platformName) ?></title>
|
|
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
|
|
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
|
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
|
</head>
|
|
<body>
|
|
|
|
<header>
|
|
<div class="container" style="display: flex; justify-content: space-between; align-items: center; width: 100%;">
|
|
<div class="logo"><?= htmlspecialchars($platformName) ?></div>
|
|
<nav class="nav-links">
|
|
<a href="dashboard.php">Dashboard</a>
|
|
<?php if ($user['role'] === 'founder'): ?>
|
|
<a href="startups.php">My Startups</a>
|
|
<?php else: ?>
|
|
<a href="discover.php" class="active">Discover</a>
|
|
<a href="portfolio.php">Portfolio</a>
|
|
<?php endif; ?>
|
|
<a href="messages.php">Messages</a>
|
|
</nav>
|
|
<div style="display: flex; align-items: center; gap: 15px;">
|
|
<span><?= htmlspecialchars($user['full_name']) ?></span>
|
|
<a href="logout.php" class="btn btn-secondary" style="padding: 8px 16px;">Log Out</a>
|
|
</div>
|
|
</div>
|
|
</header>
|
|
|
|
<main class="container" style="padding-top: 50px;">
|
|
<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 40px;">
|
|
<div>
|
|
<h1>Discover Startups</h1>
|
|
<p style="color: var(--text-secondary);">Back the most ambitious student projects.</p>
|
|
</div>
|
|
<?php if ($user['role'] === 'founder'): ?>
|
|
<a href="start_funding.php" class="btn btn-primary">Start Funding Round</a>
|
|
<?php endif; ?>
|
|
</div>
|
|
|
|
<?php if (empty($startups)): ?>
|
|
<div class="card" style="text-align: center; padding: 60px 0;">
|
|
<i class="fas fa-search" style="font-size: 64px; color: var(--accent-blue); opacity: 0.2; margin-bottom: 20px;"></i>
|
|
<h3>No startups found</h3>
|
|
<p style="color: var(--text-secondary);">Be the first to list a startup or check back later.</p>
|
|
<?php if ($user['role'] === 'founder'): ?>
|
|
<a href="start_funding.php" class="btn btn-primary" style="margin-top: 20px;">List My Startup</a>
|
|
<?php endif; ?>
|
|
</div>
|
|
|
|
<!-- Mock Data for demonstration if empty -->
|
|
<h2 style="margin: 60px 0 30px;">Featured Startups (Mock)</h2>
|
|
<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(350px, 1fr)); gap: 30px;">
|
|
<div class="card">
|
|
<div style="display: flex; justify-content: space-between; margin-bottom: 20px;">
|
|
<span style="background: rgba(0, 242, 255, 0.1); color: var(--accent-blue); padding: 4px 12px; border-radius: 20px; font-size: 12px; font-weight: 600;">Fintech</span>
|
|
<span style="color: var(--text-secondary); font-size: 12px;">Oxford University</span>
|
|
</div>
|
|
<h3>UniPay</h3>
|
|
<p style="color: var(--text-secondary); font-size: 14px; margin-bottom: 20px;">A decentralized payment platform designed specifically for international students to avoid high exchange fees.</p>
|
|
<div style="margin-bottom: 20px;">
|
|
<div style="display: flex; justify-content: space-between; font-size: 14px; margin-bottom: 8px;">
|
|
<span>Raised: £4,500</span>
|
|
<span>Target: £10,000</span>
|
|
</div>
|
|
<div style="width: 100%; height: 6px; background: var(--surface-color); border-radius: 3px; overflow: hidden;">
|
|
<div style="width: 45%; height: 100%; background: var(--gradient-primary);"></div>
|
|
</div>
|
|
</div>
|
|
<div style="display: flex; justify-content: space-between; align-items: center;">
|
|
<span style="font-size: 14px; font-weight: 500;">Min Invest: £50</span>
|
|
<a href="#" class="btn btn-primary" style="padding: 8px 16px;">View Details</a>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="card">
|
|
<div style="display: flex; justify-content: space-between; margin-bottom: 20px;">
|
|
<span style="background: rgba(138, 43, 226, 0.1); color: var(--accent-violet); padding: 4px 12px; border-radius: 20px; font-size: 12px; font-weight: 600;">Sustainability</span>
|
|
<span style="color: var(--text-secondary); font-size: 12px;">LSE</span>
|
|
</div>
|
|
<h3>GreenCampus</h3>
|
|
<p style="color: var(--text-secondary); font-size: 14px; margin-bottom: 20px;">AI-powered waste management system for university campuses to increase recycling rates by 40%.</p>
|
|
<div style="margin-bottom: 20px;">
|
|
<div style="display: flex; justify-content: space-between; font-size: 14px; margin-bottom: 8px;">
|
|
<span>Raised: £1,200</span>
|
|
<span>Target: £5,000</span>
|
|
</div>
|
|
<div style="width: 100%; height: 6px; background: var(--surface-color); border-radius: 3px; overflow: hidden;">
|
|
<div style="width: 24%; height: 100%; background: var(--gradient-primary);"></div>
|
|
</div>
|
|
</div>
|
|
<div style="display: flex; justify-content: space-between; align-items: center;">
|
|
<span style="font-size: 14px; font-weight: 500;">Min Invest: £50</span>
|
|
<a href="#" class="btn btn-primary" style="padding: 8px 16px;">View Details</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<?php else: ?>
|
|
<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(350px, 1fr)); gap: 30px;">
|
|
<?php foreach ($startups as $startup): ?>
|
|
<div class="card">
|
|
<div style="display: flex; justify-content: space-between; margin-bottom: 20px;">
|
|
<span style="background: rgba(0, 242, 255, 0.1); color: var(--accent-blue); padding: 4px 12px; border-radius: 20px; font-size: 12px; font-weight: 600;">Startup</span>
|
|
<span style="color: var(--text-secondary); font-size: 12px;"><?= htmlspecialchars($startup['university']) ?></span>
|
|
</div>
|
|
<h3><?= htmlspecialchars($startup['name']) ?></h3>
|
|
<p style="color: var(--text-secondary); font-size: 14px; margin-bottom: 20px;"><?= htmlspecialchars($startup['description']) ?></p>
|
|
<div style="margin-bottom: 20px;">
|
|
<div style="display: flex; justify-content: space-between; font-size: 14px; margin-bottom: 8px;">
|
|
<span>Raised: £<?= number_format($startup['funding_raised'], 0) ?></span>
|
|
<span>Target: £<?= number_format($startup['funding_target'], 0) ?></span>
|
|
</div>
|
|
<?php
|
|
$percent = ($startup['funding_target'] > 0) ? ($startup['funding_raised'] / $startup['funding_target'] * 100) : 0;
|
|
$percent = min(100, $percent);
|
|
?>
|
|
<div style="width: 100%; height: 6px; background: var(--surface-color); border-radius: 3px; overflow: hidden;">
|
|
<div style="width: <?= $percent ?>%; height: 100%; background: var(--gradient-primary);"></div>
|
|
</div>
|
|
</div>
|
|
<div style="display: flex; justify-content: space-between; align-items: center;">
|
|
<span style="font-size: 14px; font-weight: 500;">Min Invest: £50</span>
|
|
<a href="startup_details.php?id=<?= $startup['id'] ?>" class="btn btn-primary" style="padding: 8px 16px;">View Details</a>
|
|
</div>
|
|
</div>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
<?php endif; ?>
|
|
</main>
|
|
|
|
<style>
|
|
.active {
|
|
color: var(--text-primary) !important;
|
|
border-bottom: 2px solid var(--accent-blue);
|
|
padding-bottom: 5px;
|
|
}
|
|
</style>
|
|
|
|
</body>
|
|
</html>
|