This commit is contained in:
Flatlogic Bot 2026-02-28 16:01:57 +00:00
parent 392dc73382
commit 844a54704c
8 changed files with 740 additions and 296 deletions

View File

@ -68,9 +68,9 @@ function number_get_formatted($num) {
<nav class="nav-links">
<?php if ($user['role'] === 'founder'): ?>
<a href="startups.php">My Startups</a>
<a href="partners.php">Find Partners</a>
<a href="discover.php">Find Partners</a>
<?php else: ?>
<a href="discover.php">Discover</a>
<a href="startups.php">Browse Startups</a>
<a href="portfolio.php">Portfolio</a>
<?php endif; ?>
<a href="messages.php">Messages</a>
@ -126,14 +126,14 @@ function number_get_formatted($num) {
<div class="card" style="margin-bottom: 30px;">
<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 25px;">
<h3 style="margin: 0;">Portfolio Overview</h3>
<a href="discover.php" class="btn btn-primary" style="padding: 10px 20px; font-size: 14px;">Find New Deals</a>
<a href="startups.php" class="btn btn-primary" style="padding: 10px 20px; font-size: 14px;">Find New Deals</a>
</div>
<?php if (empty($myInvestments)): ?>
<div style="text-align: center; padding: 50px 0; background: rgba(255,255,255,0.02); border-radius: 16px; border: 1px dashed var(--border-color);">
<i class="fas fa-chart-line" style="font-size: 40px; color: var(--accent-blue); opacity: 0.5; margin-bottom: 15px;"></i>
<p style="color: var(--text-secondary); margin-bottom: 20px;">Browse the next generation of student-led innovation.</p>
<a href="discover.php" class="btn btn-primary">Start Investing</a>
<a href="startups.php" class="btn btn-primary">Start Investing</a>
</div>
<?php else: ?>
<div style="display: grid; grid-template-columns: 1fr; gap: 15px;">
@ -194,10 +194,18 @@ function number_get_formatted($num) {
<?php endif; ?>
</div>
<div class="card" style="background: var(--gradient-primary); color: #fff; border: none;">
<?php if ($user['role'] === 'founder'): ?>
<div class="card" style="background: var(--gradient-primary); color: #fff; border: none; margin-bottom: 30px;">
<h3 style="color: #fff; margin-bottom: 10px;">Find Partners</h3>
<p style="font-size: 14px; opacity: 0.9; margin-bottom: 20px;">Ready to find your perfect co-founder? Start swiping through profiles.</p>
<a href="discover.php" class="btn" style="width: 100%; background: #fff; color: var(--accent-blue); font-weight: 700; text-align: center; display: block; text-decoration: none;">Start Matching</a>
</div>
<?php endif; ?>
<div class="card" style="background: rgba(255,255,255,0.05); color: #fff; border: 1px solid var(--border-color);">
<h3 style="color: #fff; margin-bottom: 10px;">Gatsby Pro</h3>
<p style="font-size: 14px; opacity: 0.9; margin-bottom: 20px;">Get advanced analytics and direct intros to top-tier VC scouts.</p>
<button class="btn" style="width: 100%; background: #fff; color: var(--accent-blue); font-weight: 700;">Learn More</button>
<button class="btn btn-secondary" style="width: 100%;">Learn More</button>
</div>
</div>
</div>
@ -228,4 +236,4 @@ function number_get_formatted($num) {
</style>
</body>
</html>
</html>

View File

@ -0,0 +1,26 @@
-- Migration: Founder Matching and Additional Fields
CREATE TABLE IF NOT EXISTS swipes (
id INT AUTO_INCREMENT PRIMARY KEY,
swiper_id INT NOT NULL,
swiped_id INT NOT NULL,
direction ENUM('like', 'dislike') NOT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (swiper_id) REFERENCES users(id) ON DELETE CASCADE,
FOREIGN KEY (swiped_id) REFERENCES users(id) ON DELETE CASCADE,
UNIQUE KEY unique_swipe (swiper_id, swiped_id)
);
CREATE TABLE IF NOT EXISTS matches (
id INT AUTO_INCREMENT PRIMARY KEY,
user1_id INT NOT NULL,
user2_id INT NOT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (user1_id) REFERENCES users(id) ON DELETE CASCADE,
FOREIGN KEY (user2_id) REFERENCES users(id) ON DELETE CASCADE,
UNIQUE KEY unique_match (user1_id, user2_id)
);
-- Add missing onboarding fields
ALTER TABLE users
ADD COLUMN preferred_working_style ENUM('remote', 'in-person', 'hybrid') AFTER risk_tolerance,
ADD COLUMN availability VARCHAR(255) AFTER preferred_working_style;

View File

@ -1,19 +1,69 @@
<?php
session_start();
if (!isset($_SESSION['user_id'])) {
header("Location: login.php");
if (!isset($_SESSION['user_id']) || $_SESSION['role'] !== 'founder') {
header("Location: dashboard.php");
exit;
}
require_once __DIR__ . '/db/config.php';
$stmt = db()->prepare("SELECT * FROM users WHERE id = ?");
// Check if onboarding is completed
$stmt = db()->prepare("SELECT onboarding_completed 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();
if (!$user['onboarding_completed']) {
header("Location: founder_onboarding.php");
exit;
}
$current_user_id = $_SESSION['user_id'];
// Handle Swipe via AJAX/POST
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['action']) && $_POST['action'] === 'swipe') {
$swiped_id = (int)$_POST['swiped_id'];
$direction = $_POST['direction']; // 'like' or 'dislike'
if ($swiped_id > 0 && in_array($direction, ['like', 'dislike'])) {
$stmt = db()->prepare("INSERT IGNORE INTO swipes (swiper_id, swiped_id, direction) VALUES (?, ?, ?)");
$stmt->execute([$current_user_id, $swiped_id, $direction]);
// Check for match
if ($direction === 'like') {
$stmt = db()->prepare("SELECT id FROM swipes WHERE swiper_id = ? AND swiped_id = ? AND direction = 'like'");
$stmt->execute([$swiped_id, $current_user_id]);
if ($stmt->fetch()) {
// It's a match!
$stmt = db()->prepare("INSERT IGNORE INTO matches (user1_id, user2_id) VALUES (?, ?)");
$u1 = min($current_user_id, $swiped_id);
$u2 = max($current_user_id, $swiped_id);
$stmt->execute([$u1, $u2]);
// Add notification
$stmt = db()->prepare("INSERT INTO notifications (user_id, content) VALUES (?, ?)");
$stmt->execute([$swiped_id, "You have a new match!"]);
$stmt->execute([$current_user_id, "You have a new match!"]);
echo json_encode(['status' => 'success', 'match' => true]);
exit;
}
}
echo json_encode(['status' => 'success', 'match' => false]);
exit;
}
}
// Fetch founders to swipe on
$stmt = db()->prepare("
SELECT * FROM users
WHERE role = 'founder'
AND id != ?
AND onboarding_completed = 1
AND id NOT IN (SELECT swiped_id FROM swipes WHERE swiper_id = ?)
LIMIT 10
");
$stmt->execute([$current_user_id, $current_user_id]);
$founders = $stmt->fetchAll();
$platformName = defined('PLATFORM_NAME') ? PLATFORM_NAME : 'Gatsby';
?>
@ -22,141 +72,201 @@ $platformName = defined('PLATFORM_NAME') ? PLATFORM_NAME : 'Gatsby';
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Discover Startups <?= htmlspecialchars($platformName) ?></title>
<title>Discover <?= 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">
<style>
.discover-container {
max-width: 400px;
margin: 0 auto;
position: relative;
height: 600px;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.swipe-card {
position: absolute;
width: 100%;
height: 500px;
background: var(--card-bg);
border: 1px solid var(--border-color);
border-radius: 20px;
overflow: hidden;
box-shadow: 0 10px 30px rgba(0,0,0,0.3);
transition: transform 0.4s ease, opacity 0.4s ease;
user-select: none;
cursor: grab;
display: flex;
flex-direction: column;
}
.swipe-card:active { cursor: grabbing; }
.card-img {
height: 250px;
background: linear-gradient(45deg, #2c3e50, #000000);
display: flex;
align-items: center;
justify-content: center;
font-size: 80px;
color: rgba(255,255,255,0.1);
}
.card-body { padding: 20px; flex-grow: 1; }
.card-name { font-size: 24px; font-weight: 700; margin-bottom: 5px; }
.card-meta { color: var(--text-secondary); font-size: 14px; margin-bottom: 15px; }
.card-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 15px; }
.tag { background: rgba(255,255,255,0.05); padding: 4px 10px; border-radius: 6px; font-size: 12px; }
.card-bio { font-size: 14px; color: var(--text-secondary); line-height: 1.5; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.swipe-actions {
display: flex;
gap: 20px;
margin-top: 550px;
z-index: 10;
}
.swipe-btn {
width: 60px;
height: 60px;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
font-size: 24px;
cursor: pointer;
transition: transform 0.2s;
border: none;
}
.swipe-btn:hover { transform: scale(1.1); }
.btn-dislike { background: #ff4d4d; color: #fff; }
.btn-like { background: #2ecc71; color: #fff; }
#match-modal {
position: fixed;
top: 0; left: 0; width: 100%; height: 100%;
background: rgba(0,0,0,0.9);
z-index: 1000;
display: none;
align-items: center;
justify-content: center;
text-align: center;
flex-direction: column;
}
</style>
</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 class="sidebar">
<div class="logo"><?= htmlspecialchars($platformName) ?></div>
<nav>
<a href="dashboard.php"><i class="fas fa-home"></i> Dashboard</a>
<a href="discover.php" class="active"><i class="fas fa-search"></i> Partner Matching</a>
<a href="startups.php"><i class="fas fa-rocket"></i> My Startups</a>
<a href="portfolio.php"><i class="fas fa-chart-line"></i> Portfolio</a>
<a href="messages.php"><i class="fas fa-comment"></i> Messages</a>
<a href="notifications.php"><i class="fas fa-bell"></i> Notifications</a>
</nav>
<div style="margin-top: auto; padding: 20px;">
<a href="logout.php" style="color: #ff5555;"><i class="fas fa-sign-out-alt"></i> Log Out</a>
</div>
</div>
<div class="main-content">
<div class="header">
<h1>Partner Matching</h1>
<div class="user-profile">
<span><?= htmlspecialchars($_SESSION['full_name']) ?></span>
<div class="avatar"><?= strtoupper(substr($_SESSION['full_name'], 0, 1)) ?></div>
</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 class="discover-container" id="card-stack">
<?php if (empty($founders)): ?>
<div style="text-align: center; color: var(--text-secondary);">
<i class="fas fa-user-friends" style="font-size: 48px; margin-bottom: 20px;"></i>
<p>No more founders found for now.<br>Check back later!</p>
</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>
<?php else: ?>
<?php foreach (array_reverse($founders) as $f): ?>
<div class="swipe-card" data-id="<?= $f['id'] ?>">
<div class="card-img"><i class="fas fa-user"></i></div>
<div class="card-body">
<div class="card-name"><?= htmlspecialchars($f['full_name']) ?></div>
<div class="card-meta"><?= htmlspecialchars($f['university']) ?> • <?= htmlspecialchars($f['degree_program']) ?> '<?= substr($f['graduation_year'], -2) ?></div>
<div class="card-tags">
<?php
$skills = explode(',', $f['skills']);
foreach (array_slice($skills, 0, 3) as $skill):
?>
<span class="tag"><?= htmlspecialchars(trim($skill)) ?></span>
<?php endforeach; ?>
</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 class="card-bio"><?= htmlspecialchars($f['bio']) ?></div>
<div style="margin-top: 15px; font-size: 12px; color: var(--accent-blue);">
<i class="fas fa-bolt"></i> Interested in: <?= htmlspecialchars($f['startup_industries']) ?>
</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;
<div class="swipe-actions">
<button class="swipe-btn btn-dislike" onclick="swipe('dislike')"><i class="fas fa-times"></i></button>
<button class="swipe-btn btn-like" onclick="swipe('like')"><i class="fas fa-heart"></i></button>
</div>
<?php endif; ?>
</div>
</div>
<div id="match-modal">
<h1 style="font-size: 60px; color: var(--accent-blue); margin-bottom: 20px;">IT'S A MATCH!</h1>
<p style="font-size: 20px; margin-bottom: 40px;">You and this founder both swiped right on each other.</p>
<div style="display: flex; gap: 20px;">
<button class="btn btn-primary" onclick="window.location.href='messages.php'">Send a Message</button>
<button class="btn" style="border: 1px solid #fff;" onclick="closeMatch()">Keep Swiping</button>
</div>
</div>
<script>
function swipe(direction) {
const stack = document.getElementById('card-stack');
const cards = stack.querySelectorAll('.swipe-card');
if (cards.length === 0) return;
const topCard = cards[cards.length - 1];
const swipedId = topCard.getAttribute('data-id');
// Animation
if (direction === 'like') {
topCard.style.transform = 'translateX(500px) rotate(20deg)';
} else {
topCard.style.transform = 'translateX(-500px) rotate(-20deg)';
}
topCard.style.opacity = '0';
// Logic
fetch('discover.php', {
method: 'POST',
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
body: `action=swipe&swiped_id=${swipedId}&direction=${direction}`
})
.then(r => r.json())
.then(data => {
if (data.match) {
document.getElementById('match-modal').style.display = 'flex';
}
setTimeout(() => {
topCard.remove();
if (stack.querySelectorAll('.swipe-card').length === 0) {
location.reload(); // Refresh to show empty state or new batch
}
}, 400);
});
}
</style>
function closeMatch() {
document.getElementById('match-modal').style.display = 'none';
}
</script>
</body>
</html>
</html>

View File

@ -30,6 +30,8 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$preferred_stage = $_POST['preferred_stage'] ?? 'Idea';
$commitment_level = $_POST['commitment_level'] ?? 'part-time';
$risk_tolerance = $_POST['risk_tolerance'] ?? 'medium';
$preferred_working_style = $_POST['preferred_working_style'] ?? 'hybrid';
$availability = trim($_POST['availability'] ?? '');
$equity_expectations = trim($_POST['equity_expectations'] ?? '');
$preferred_co_founder_skills = isset($_POST['preferred_co_founder_skills']) ? implode(',', $_POST['preferred_co_founder_skills']) : '';
$bio = trim($_POST['bio'] ?? '');
@ -48,6 +50,8 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
preferred_stage = ?,
commitment_level = ?,
risk_tolerance = ?,
preferred_working_style = ?,
availability = ?,
equity_expectations = ?,
preferred_co_founder_skills = ?,
bio = ?,
@ -66,6 +70,8 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$preferred_stage,
$commitment_level,
$risk_tolerance,
$preferred_working_style,
$availability,
$equity_expectations,
$preferred_co_founder_skills,
$bio,
@ -131,8 +137,8 @@ $all_industries = ['AI & Machine Learning', 'Fintech', 'SaaS', 'Climate Tech', '
<div class="card" style="width: 100%; max-width: 700px;">
<div class="logo" style="text-align: center; margin-bottom: 20px;"><?= htmlspecialchars($platformName) ?></div>
<h2 style="margin-bottom: 10px; text-align: center;">Welcome, <?= htmlspecialchars($user['full_name']) ?></h2>
<p style="text-align: center; color: var(--text-secondary); margin-bottom: 30px;">Tell us about your background and interests to help us find the best matches.</p>
<h2 style="margin-bottom: 10px; text-align: center;">Partner Questionnaire</h2>
<p style="text-align: center; color: var(--text-secondary); margin-bottom: 30px;">Tell us about your background to help us find the best co-founder matches.</p>
<div class="step-indicator">
<div class="step-dot active" id="dot-1"></div>
@ -230,20 +236,36 @@ $all_industries = ['AI & Machine Learning', 'Fintech', 'SaaS', 'Climate Tech', '
<!-- Step 4: Founder Preferences -->
<div class="step" id="step-4">
<h3 style="margin-bottom: 20px;">4. Founder Preferences</h3>
<div class="form-group">
<label>Commitment level</label>
<select name="commitment_level">
<option value="part-time">Part-time</option>
<option value="full-time">Full-time</option>
</select>
<div style="display: grid; grid-template-columns: 1fr 1fr; gap: 20px;">
<div class="form-group">
<label>Commitment level</label>
<select name="commitment_level">
<option value="part-time">Part-time</option>
<option value="full-time">Full-time</option>
</select>
</div>
<div class="form-group">
<label>Risk tolerance</label>
<select name="risk_tolerance">
<option value="low">Low</option>
<option value="medium">Medium</option>
<option value="high">High</option>
</select>
</div>
</div>
<div class="form-group">
<label>Risk tolerance</label>
<select name="risk_tolerance">
<option value="low">Low</option>
<option value="medium">Medium</option>
<option value="high">High</option>
</select>
<div style="display: grid; grid-template-columns: 1fr 1fr; gap: 20px;">
<div class="form-group">
<label>Working Style</label>
<select name="preferred_working_style">
<option value="hybrid">Hybrid</option>
<option value="remote">Remote</option>
<option value="in-person">In-person</option>
</select>
</div>
<div class="form-group">
<label>Availability</label>
<input type="text" name="availability" placeholder="e.g. Weeknights & Weekends">
</div>
</div>
<div class="form-group">
<label>Equity expectations</label>
@ -266,7 +288,7 @@ $all_industries = ['AI & Machine Learning', 'Fintech', 'SaaS', 'Climate Tech', '
</div>
<div style="display: flex; justify-content: space-between; margin-top: 30px;">
<button type="button" class="btn" style="border: 1px solid var(--border-color);" onclick="nextStep(3)">Back</button>
<button type="submit" class="btn btn-primary">Complete Onboarding</button>
<button type="submit" class="btn btn-primary">Complete Questionnaire</button>
</div>
</div>
</form>
@ -281,6 +303,7 @@ $all_industries = ['AI & Machine Learning', 'Fintech', 'SaaS', 'Climate Tech', '
for (let i = 1; i <= step; i++) {
document.getElementById('dot-' + i).classList.add('active');
}
window.scrollTo(0, 0);
}
document.getElementById('prevExp').addEventListener('change', function() {

View File

@ -13,9 +13,66 @@ $user = $stmt->fetch();
$platformName = defined('PLATFORM_NAME') ? PLATFORM_NAME : 'Gatsby';
$stmt = db()->prepare("SELECT m.*, u.full_name as other_user_name FROM messages m JOIN users u ON (m.sender_id = u.id OR m.receiver_id = u.id) WHERE (m.sender_id = ? OR m.receiver_id = ?) AND u.id != ? ORDER BY m.created_at DESC");
// Fetch Matches for Founders
$matches = [];
if ($user['role'] === 'founder') {
$stmt = db()->prepare("
SELECT m.*,
u.full_name as match_name,
u.id as match_id,
u.university,
u.degree_program
FROM matches m
JOIN users u ON (m.user1_id = u.id OR m.user2_id = u.id)
WHERE (m.user1_id = ? OR m.user2_id = ?)
AND u.id != ?
");
$stmt->execute([$_SESSION['user_id'], $_SESSION['user_id'], $_SESSION['user_id']]);
$matches = $stmt->fetchAll();
}
// Fetch Conversations
$stmt = db()->prepare("
SELECT DISTINCT u.id as other_user_id, u.full_name as other_user_name, u.role as other_role
FROM messages m
JOIN users u ON (m.sender_id = u.id OR m.receiver_id = u.id)
WHERE (m.sender_id = ? OR m.receiver_id = ?)
AND u.id != ?
");
$stmt->execute([$_SESSION['user_id'], $_SESSION['user_id'], $_SESSION['user_id']]);
$messages = $stmt->fetchAll();
$conversations = $stmt->fetchAll();
$active_chat_id = isset($_GET['chat_with']) ? (int)$_GET['chat_with'] : null;
$active_chat_user = null;
$chat_messages = [];
if ($active_chat_id) {
$stmt = db()->prepare("SELECT id, full_name, role FROM users WHERE id = ?");
$stmt->execute([$active_chat_id]);
$active_chat_user = $stmt->fetch();
if ($active_chat_user) {
$stmt = db()->prepare("
SELECT * FROM messages
WHERE (sender_id = ? AND receiver_id = ?)
OR (sender_id = ? AND receiver_id = ?)
ORDER BY created_at ASC
");
$stmt->execute([$_SESSION['user_id'], $active_chat_id, $active_chat_id, $_SESSION['user_id']]);
$chat_messages = $stmt->fetchAll();
}
}
// Handle sending message
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['content']) && $active_chat_id) {
$content = trim($_POST['content']);
if (!empty($content)) {
$stmt = db()->prepare("INSERT INTO messages (sender_id, receiver_id, content) VALUES (?, ?, ?)");
$stmt->execute([$_SESSION['user_id'], $active_chat_id, $content]);
header("Location: messages.php?chat_with=$active_chat_id");
exit;
}
}
?>
<!doctype html>
<html lang="en">
@ -26,6 +83,55 @@ $messages = $stmt->fetchAll();
<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">
<style>
.chat-container {
display: grid;
grid-template-columns: 350px 1fr;
gap: 0;
height: calc(100vh - 150px);
background: var(--card-bg);
border-radius: 20px;
overflow: hidden;
border: 1px solid var(--border-color);
}
.chat-sidebar {
border-right: 1px solid var(--border-color);
display: flex;
flex-direction: column;
background: rgba(255,255,255,0.02);
}
.chat-main {
display: flex;
flex-direction: column;
background: transparent;
}
.conv-item {
padding: 15px 20px;
border-bottom: 1px solid var(--border-color);
cursor: pointer;
transition: all 0.2s;
display: flex;
align-items: center;
gap: 12px;
}
.conv-item:hover { background: rgba(255,255,255,0.05); }
.conv-item.active { background: rgba(0, 122, 255, 0.1); border-left: 3px solid var(--accent-blue); }
.avatar-sm {
width: 40px; height: 40px; border-radius: 12px; background: var(--gradient-primary);
display: flex; align-items: center; justify-content: center; font-weight: 700; color: #fff;
}
.chat-header { padding: 15px 25px; border-bottom: 1px solid var(--border-color); display: flex; align-items: center; gap: 15px; }
.chat-messages { flex: 1; overflow-y: auto; padding: 25px; display: flex; flex-direction: column; gap: 15px; }
.msg-bubble {
max-width: 70%; padding: 12px 18px; border-radius: 18px; font-size: 14px; line-height: 1.5;
}
.msg-sent { align-self: flex-end; background: var(--accent-blue); color: #fff; border-bottom-right-radius: 4px; }
.msg-received { align-self: flex-start; background: var(--surface-color); border: 1px solid var(--border-color); border-bottom-left-radius: 4px; }
.chat-input { padding: 20px; border-top: 1px solid var(--border-color); display: flex; gap: 15px; }
.chat-input input {
flex: 1; padding: 12px 20px; border-radius: 12px; background: var(--surface-color); border: 1px solid var(--border-color); color: #fff;
}
</style>
</head>
<body>
@ -35,9 +141,9 @@ $messages = $stmt->fetchAll();
<nav class="nav-links">
<?php if ($user['role'] === 'founder'): ?>
<a href="startups.php">My Startups</a>
<a href="partners.php">Find Partners</a>
<a href="discover.php">Find Partners</a>
<?php else: ?>
<a href="discover.php">Discover</a>
<a href="startups.php">Browse Startups</a>
<a href="portfolio.php">Portfolio</a>
<?php endif; ?>
<a href="messages.php" class="active">Messages</a>
@ -50,40 +156,91 @@ $messages = $stmt->fetchAll();
</div>
</header>
<main class="container" style="padding-top: 50px;">
<h1>Messages</h1>
<p style="color: var(--text-secondary); margin-bottom: 40px;">Communicate with founders and investors in the network.</p>
<div style="display: grid; grid-template-columns: 350px 1fr; gap: 30px; height: 600px;">
<div class="card" style="padding: 0; display: flex; flex-direction: column;">
<div style="padding: 20px; border-bottom: 1px solid var(--border-color);">
<input type="text" placeholder="Search conversations..." style="width: 100%; padding: 10px; border-radius: 8px; background: var(--surface-color); border: 1px solid var(--border-color); color: #fff;">
</div>
<div style="flex: 1; overflow-y: auto;">
<?php if (empty($messages)): ?>
<div style="text-align: center; padding: 40px 20px; color: var(--text-secondary);">
<p>No conversations yet.</p>
<a href="discover.php" class="btn btn-secondary" style="margin-top: 20px;">Find people</a>
</div>
<?php else: ?>
<?php foreach ($messages as $msg): ?>
<div style="padding: 20px; border-bottom: 1px solid var(--border-color); cursor: pointer; transition: background 0.2s;" onmouseover="this.style.background='var(--surface-color)'" onmouseout="this.style.background='transparent'">
<div style="font-weight: 600; margin-bottom: 5px;"><?= htmlspecialchars($msg['other_user_name']) ?></div>
<div style="font-size: 14px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;">
<?= htmlspecialchars($msg['content']) ?>
</div>
<main class="container" style="padding-top: 30px;">
<div class="chat-container">
<div class="chat-sidebar">
<div style="padding: 20px; font-weight: 700; border-bottom: 1px solid var(--border-color);">Conversations</div>
<?php if ($user['role'] === 'founder' && !empty($matches)): ?>
<div style="padding: 10px 20px; font-size: 11px; text-transform: uppercase; color: var(--text-secondary); letter-spacing: 1px;">New Matches</div>
<?php foreach ($matches as $match): ?>
<?php
// Check if already has conversation
$hasConv = false;
foreach ($conversations as $c) { if ($c['other_user_id'] == $match['match_id']) $hasConv = true; }
if ($hasConv) continue;
?>
<div class="conv-item <?= $active_chat_id == $match['match_id'] ? 'active' : '' ?>" onclick="window.location.href='messages.php?chat_with=<?= $match['match_id'] ?>'">
<div class="avatar-sm" style="background: var(--accent-blue);"><?= substr($match['match_name'], 0, 1) ?></div>
<div>
<div style="font-weight: 600; font-size: 14px;"><?= htmlspecialchars($match['match_name']) ?></div>
<div style="font-size: 11px; color: var(--accent-blue);">New Match! Say hi!</div>
</div>
<?php endforeach; ?>
<?php endif; ?>
</div>
</div>
<?php endforeach; ?>
<?php endif; ?>
<div style="padding: 15px 20px 10px; font-size: 11px; text-transform: uppercase; color: var(--text-secondary); letter-spacing: 1px;">Recent Chats</div>
<?php if (empty($conversations)): ?>
<div style="padding: 20px; text-align: center; color: var(--text-secondary); font-size: 13px;">No active chats.</div>
<?php else: ?>
<?php foreach ($conversations as $conv): ?>
<div class="conv-item <?= $active_chat_id == $conv['other_user_id'] ? 'active' : '' ?>" onclick="window.location.href='messages.php?chat_with=<?= $conv['other_user_id'] ?>'">
<div class="avatar-sm"><?= substr($conv['other_user_name'], 0, 1) ?></div>
<div>
<div style="font-weight: 600; font-size: 14px;"><?= htmlspecialchars($conv['other_user_name']) ?></div>
<div style="font-size: 12px; color: var(--text-secondary);"><?= ucfirst($conv['other_role']) ?></div>
</div>
</div>
<?php endforeach; ?>
<?php endif; ?>
</div>
<div class="card" style="display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 40px;">
<i class="fas fa-comments" style="font-size: 80px; color: var(--accent-blue); opacity: 0.1; margin-bottom: 40px;"></i>
<h3>Select a conversation</h3>
<p style="color: var(--text-secondary); max-width: 300px;">Choose a contact on the left to start messaging. Reach out to students, co-founders, or investors.</p>
<div class="chat-main">
<?php if ($active_chat_user): ?>
<div class="chat-header">
<div class="avatar-sm"><?= substr($active_chat_user['full_name'], 0, 1) ?></div>
<div>
<div style="font-weight: 700;"><?= htmlspecialchars($active_chat_user['full_name']) ?></div>
<div style="font-size: 12px; color: var(--text-secondary);"><?= ucfirst($active_chat_user['role']) ?></div>
</div>
</div>
<div class="chat-messages" id="chat-box">
<?php if (empty($chat_messages)): ?>
<div style="text-align: center; color: var(--text-secondary); margin-top: 50px;">
<i class="fas fa-hand-sparkles" style="font-size: 40px; margin-bottom: 20px; opacity: 0.3;"></i>
<p>This is the start of your conversation with <?= htmlspecialchars(explode(' ', $active_chat_user['full_name'])[0]) ?>.</p>
</div>
<?php else: ?>
<?php foreach ($chat_messages as $msg): ?>
<div class="msg-bubble <?= $msg['sender_id'] == $_SESSION['user_id'] ? 'msg-sent' : 'msg-received' ?>">
<?= htmlspecialchars($msg['content']) ?>
<div style="font-size: 10px; opacity: 0.6; margin-top: 5px; text-align: right;">
<?= date('H:i', strtotime($msg['created_at'])) ?>
</div>
</div>
<?php endforeach; ?>
<?php endif; ?>
</div>
<form class="chat-input" method="POST">
<input type="text" name="content" placeholder="Type a message..." required autocomplete="off">
<button type="submit" class="btn btn-primary" style="padding: 0 25px;"><i class="fas fa-paper-plane"></i></button>
</form>
<?php else: ?>
<div style="flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; opacity: 0.5;">
<i class="fas fa-comments" style="font-size: 100px; margin-bottom: 30px;"></i>
<h3>Select a conversation to start chatting</h3>
<p>Find co-founders in the matching section.</p>
</div>
<?php endif; ?>
</div>
</div>
</main>
<script>
const chatBox = document.getElementById('chat-box');
if (chatBox) chatBox.scrollTop = chatBox.scrollHeight;
</script>
</body>
</html>
</html>

View File

@ -1,105 +1,3 @@
<?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 other users with role 'founder' (potential partners)
$stmt = db()->prepare("SELECT * FROM users WHERE role = 'founder' AND id != ? ORDER BY created_at DESC");
$stmt->execute([$_SESSION['user_id']]);
$partners = $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>Find Partners <?= 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>
<a href="partners.php" class="active">Find Partners</a>
<?php else: ?>
<a href="discover.php">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>Find Co-Founders</h1>
<p style="color: var(--text-secondary);">Connect with ambitious students building the future.</p>
</div>
</div>
<?php if (empty($partners)): ?>
<div class="card" style="text-align: center; padding: 60px 0;">
<i class="fas fa-users-slash" style="font-size: 64px; color: var(--accent-blue); opacity: 0.2; margin-bottom: 20px;"></i>
<h3>No potential partners found</h3>
<p style="color: var(--text-secondary);">Be the first to list your profile or check back later.</p>
</div>
<?php else: ?>
<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 30px;">
<?php foreach ($partners as $partner): ?>
<div class="card">
<div style="display: flex; align-items: center; gap: 15px; margin-bottom: 20px;">
<div style="width: 50px; height: 50px; background: var(--surface-color); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 20px; border: 1px solid var(--border-color);">
<?= substr($partner['full_name'], 0, 1) ?>
</div>
<div>
<div style="font-weight: 600;"><?= htmlspecialchars($partner['full_name']) ?></div>
<div style="font-size: 12px; color: var(--text-secondary);"><?= htmlspecialchars($partner['university']) ?> '<?= substr($partner['graduation_year'], -2) ?></div>
</div>
</div>
<p style="color: var(--text-secondary); font-size: 14px; margin-bottom: 20px; height: 60px; overflow: hidden;"><?= htmlspecialchars($partner['bio']) ?></p>
<div style="display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px;">
<?php if ($partner['interests']): ?>
<?php foreach (explode(',', $partner['interests']) as $tag): ?>
<span style="background: rgba(255, 255, 255, 0.05); border: 1px solid var(--border-color); padding: 2px 8px; border-radius: 4px; font-size: 10px;"><?= htmlspecialchars(trim($tag)) ?></span>
<?php endforeach; ?>
<?php endif; ?>
</div>
<a href="messages.php?to=<?= $partner['id'] ?>" class="btn btn-secondary" style="width: 100%; text-align: center;">Send Message</a>
</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>
header("Location: discover.php");
exit;

194
startup_details.php Normal file
View File

@ -0,0 +1,194 @@
<?php
session_start();
if (!isset($_SESSION['user_id'])) {
header("Location: login.php");
exit;
}
require_once __DIR__ . '/db/config.php';
$startup_id = (int)($_GET['id'] ?? 0);
if (!$startup_id) {
header("Location: startups.php");
exit;
}
$stmt = db()->prepare("SELECT s.*, u.full_name as founder_name, u.university as founder_uni, u.graduation_year FROM startups s JOIN users u ON s.founder_id = u.id WHERE s.id = ?");
$stmt->execute([$startup_id]);
$startup = $stmt->fetch();
if (!$startup) {
header("Location: startups.php");
exit;
}
$stmt = db()->prepare("SELECT * FROM users WHERE id = ?");
$stmt->execute([$_SESSION['user_id']]);
$user = $stmt->fetch();
$error = '';
$success = '';
// Handle Investment
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['action']) && $_POST['action'] === 'invest') {
if ($user['role'] !== 'investor') {
$error = "Founders cannot make investments.";
} else {
$amount = (float)($_POST['amount'] ?? 0);
if ($amount < 50) {
$error = "Minimum investment is £50.";
} else {
db()->beginTransaction();
try {
$stmt = db()->prepare("INSERT INTO investments (investor_id, startup_id, amount, status) VALUES (?, ?, ?, 'approved')");
$stmt->execute([$_SESSION['user_id'], $startup_id, $amount]);
$stmt = db()->prepare("UPDATE startups SET funding_raised = funding_raised + ? WHERE id = ?");
$stmt->execute([$amount, $startup_id]);
$stmt = db()->prepare("INSERT INTO notifications (user_id, content) VALUES (?, ?)");
$stmt->execute([$startup['founder_id'], "New investment of £" . number_format($amount) . " in " . $startup['name'] . "!"]);
db()->commit();
$success = "Investment successful! You've successfully backed " . htmlspecialchars($startup['name']) . ".";
header("refresh:2;url=portfolio.php");
} catch (Exception $e) {
db()->rollBack();
$error = "Investment failed: " . $e->getMessage();
}
}
}
}
$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><?= htmlspecialchars($startup['name']) ?> — <?= 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">
<?php if ($user['role'] === 'founder'): ?>
<a href="startups.php">My Startups</a>
<a href="discover.php">Find Partners</a>
<?php else: ?>
<a href="startups.php">Browse Startups</a>
<a href="portfolio.php">Portfolio</a>
<?php endif; ?>
<a href="messages.php">Messages</a>
<a href="notifications.php">Notifications</a>
</nav>
<div style="display: flex; align-items: center; gap: 15px;">
<a href="dashboard.php" style="color: var(--text-secondary);"><i class="fas fa-th-large"></i></a>
<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; padding-bottom: 50px;">
<div style="display: grid; grid-template-columns: 2fr 1.2fr; gap: 40px;">
<div>
<div style="display: flex; align-items: center; gap: 20px; margin-bottom: 30px;">
<div style="width: 80px; height: 80px; background: var(--gradient-primary); border-radius: 24px; display: flex; align-items: center; justify-content: center; font-size: 32px; font-weight: 700; color: #fff; box-shadow: 0 10px 30px rgba(0, 122, 255, 0.3);">
<?= substr($startup['name'], 0, 1) ?>
</div>
<div>
<h1 style="margin-bottom: 5px;"><?= htmlspecialchars($startup['name']) ?></h1>
<div style="color: var(--text-secondary); font-size: 14px;">
Founded by <?= htmlspecialchars($startup['founder_name']) ?> (<?= htmlspecialchars($startup['founder_uni']) ?>)
</div>
</div>
</div>
<div class="card" style="margin-bottom: 30px;">
<h3>About Startup</h3>
<p style="color: var(--text-secondary); line-height: 1.8; white-space: pre-line;">
<?= htmlspecialchars($startup['description']) ?>
</p>
</div>
<div class="card">
<h3>Investment Terms (Dividend-Only Returns)</h3>
<div style="padding: 20px; background: rgba(0, 122, 255, 0.05); border: 1px solid rgba(0, 122, 255, 0.2); border-radius: 12px; margin-top: 15px;">
<p style="font-size: 14px; margin-bottom: 10px;"><i class="fas fa-info-circle"></i> <strong>How it works:</strong></p>
<ul style="font-size: 14px; color: var(--text-secondary); margin-left: 20px; line-height: 1.6;">
<li>Investors are entitled to a share of future profits as **dividends**.</li>
<li>No voting rights or equity control are granted to investors.</li>
<li>Returns are primarily distributed through profit-sharing mechanisms.</li>
<li>This model focuses on sustainable student-led business growth.</li>
</ul>
</div>
</div>
</div>
<div>
<div class="card" style="margin-bottom: 30px; background: var(--surface-color); border: 1px solid var(--border-color);">
<h3 style="margin-bottom: 25px;">Funding Progress</h3>
<div style="margin-bottom: 30px;">
<div style="display: flex; justify-content: space-between; margin-bottom: 10px;">
<span style="font-weight: 700; font-size: 24px;">£<?= number_format($startup['funding_raised'], 0) ?></span>
<span style="color: var(--text-secondary); font-size: 14px; align-self: flex-end;">of £<?= number_format($startup['funding_target'], 0) ?></span>
</div>
<div style="width: 100%; height: 12px; background: var(--border-color); border-radius: 6px; overflow: hidden;">
<div style="width: <?= min(100, ($startup['funding_raised'] / ($startup['funding_target'] ?: 1)) * 100) ?>%; height: 100%; background: var(--gradient-primary); box-shadow: 0 0 20px rgba(0, 122, 255, 0.5);"></div>
</div>
<div style="text-align: right; font-size: 12px; color: var(--text-secondary); margin-top: 8px;">
<?= round(($startup['funding_raised'] / ($startup['funding_target'] ?: 1)) * 100) ?>% Raised
</div>
</div>
<?php if ($success): ?>
<div style="background: rgba(0, 255, 0, 0.1); border: 1px solid rgba(0, 255, 0, 0.3); color: #55ff55; padding: 12px; border-radius: 8px;">
<?= htmlspecialchars($success) ?>
</div>
<?php elseif ($error): ?>
<div style="background: rgba(255, 0, 0, 0.1); border: 1px solid rgba(255, 0, 0, 0.3); color: #ff5555; padding: 12px; border-radius: 8px; margin-bottom: 20px;">
<?= htmlspecialchars($error) ?>
</div>
<?php endif; ?>
<?php if (!$success): ?>
<?php if ($user['role'] === 'investor'): ?>
<form method="POST">
<input type="hidden" name="action" value="invest">
<div style="margin-bottom: 20px;">
<label style="display: block; margin-bottom: 8px; font-size: 14px;">Investment Amount (£)</label>
<input type="number" name="amount" min="50" step="50" required style="width: 100%; padding: 12px; border-radius: 12px; background: rgba(255,255,255,0.05); border: 1px solid var(--border-color); color: #fff; font-size: 18px; font-weight: 700;">
</div>
<button type="submit" class="btn btn-primary" style="width: 100%; padding: 15px;">Back This Project</button>
</form>
<?php elseif ($startup['founder_id'] == $_SESSION['user_id']): ?>
<div style="padding: 20px; text-align: center; border: 1px dashed var(--border-color); border-radius: 12px;">
<p style="font-size: 14px; color: var(--text-secondary); margin-bottom: 0;">This is your startup listing. You can't invest in your own project.</p>
</div>
<?php else: ?>
<div style="padding: 20px; text-align: center; border: 1px dashed var(--border-color); border-radius: 12px;">
<p style="font-size: 14px; color: var(--text-secondary); margin-bottom: 0;">Only verified investors can participate in funding rounds.</p>
</div>
<?php endif; ?>
<?php endif; ?>
</div>
<div class="card">
<h3>Risk Disclosure</h3>
<p style="font-size: 12px; color: var(--text-secondary); line-height: 1.5;">
Student startups carry high risk. Dividends are not guaranteed and depend on the profitability of the venture. This is not financial advice. All student entrepreneurs are verified, but Gatsby does not conduct full financial audits of individual ideas.
</p>
</div>
</div>
</div>
</main>
</body>
</html>

View File

@ -20,7 +20,7 @@ if ($user['role'] === 'founder') {
$myStartups = $stmt->fetchAll();
} else {
// Investors see all public startups
$stmt = db()->prepare("SELECT * FROM startups WHERE status = 'public' ORDER BY created_at DESC");
$stmt = db()->prepare("SELECT s.*, u.full_name as founder_name FROM startups s JOIN users u ON s.founder_id = u.id WHERE s.status = 'public' ORDER BY s.created_at DESC");
$stmt->execute();
$myStartups = $stmt->fetchAll();
}
@ -30,7 +30,7 @@ if ($user['role'] === 'founder') {
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>My Startups <?= htmlspecialchars($platformName) ?></title>
<title><?= $user['role'] === 'founder' ? 'My Startups' : 'Browse 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">
@ -43,9 +43,9 @@ if ($user['role'] === 'founder') {
<nav class="nav-links">
<?php if ($user['role'] === 'founder'): ?>
<a href="startups.php" class="active">My Startups</a>
<a href="partners.php">Find Partners</a>
<a href="discover.php">Find Partners</a>
<?php else: ?>
<a href="discover.php">Discover</a>
<a href="startups.php" class="active">Browse Startups</a>
<a href="portfolio.php">Portfolio</a>
<?php endif; ?>
<a href="messages.php">Messages</a>
@ -62,7 +62,7 @@ if ($user['role'] === 'founder') {
<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 40px;">
<div>
<h1><?= $user['role'] === 'founder' ? 'My Startups' : 'Student Startups' ?></h1>
<p style="color: var(--text-secondary);">Manage and track your ventures.</p>
<p style="color: var(--text-secondary);"><?= $user['role'] === 'founder' ? 'Manage and track your ventures.' : 'Discover the next generation of student-led innovation.' ?></p>
</div>
<?php if ($user['role'] === 'founder'): ?>
<a href="start_funding.php" class="btn btn-primary">List New Startup</a>
@ -83,7 +83,12 @@ if ($user['role'] === 'founder') {
<?php foreach ($myStartups as $startup): ?>
<div class="card">
<div style="display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 15px;">
<h3 style="margin: 0;"><?= htmlspecialchars($startup['name']) ?></h3>
<div>
<h3 style="margin: 0;"><?= htmlspecialchars($startup['name']) ?></h3>
<?php if ($user['role'] === 'investor'): ?>
<div style="font-size: 12px; color: var(--text-secondary); margin-top: 4px;">by <?= htmlspecialchars($startup['founder_name']) ?></div>
<?php endif; ?>
</div>
<span style="font-size: 10px; text-transform: uppercase; padding: 4px 8px; background: rgba(0, 242, 255, 0.1); color: var(--accent-blue); border-radius: 4px; border: 1px solid rgba(0, 242, 255, 0.3);">
<?= htmlspecialchars($startup['status']) ?>
</span>
@ -94,10 +99,10 @@ if ($user['role'] === 'founder') {
<div style="margin-bottom: 20px;">
<div style="display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 8px;">
<span>Progress</span>
<span><?= round(($startup['funding_raised'] / $startup['funding_target']) * 100) ?>%</span>
<span><?= round(($startup['funding_raised'] / ($startup['funding_target'] ?: 1)) * 100) ?>%</span>
</div>
<div style="width: 100%; height: 8px; background: var(--border-color); border-radius: 4px; overflow: hidden;">
<div style="width: <?= min(100, ($startup['funding_raised'] / $startup['funding_target']) * 100) ?>%; height: 100%; background: var(--gradient-primary);"></div>
<div style="width: <?= min(100, ($startup['funding_raised'] / ($startup['funding_target'] ?: 1)) * 100) ?>%; height: 100%; background: var(--gradient-primary);"></div>
</div>
</div>
<div style="display: flex; justify-content: space-between; align-items: center; border-top: 1px solid var(--border-color); padding-top: 20px;">
@ -109,7 +114,7 @@ if ($user['role'] === 'founder') {
<div style="font-size: 10px; color: var(--text-secondary); text-transform: uppercase;">Target</div>
<div style="font-weight: 700; color: #fff;">£<?= number_format($startup['funding_target'], 0) ?></div>
</div>
<a href="startup_details.php?id=<?= $startup['id'] ?>" class="btn btn-secondary" style="padding: 8px 16px; font-size: 12px;">Manage</a>
<a href="startup_details.php?id=<?= $startup['id'] ?>" class="btn btn-secondary" style="padding: 8px 16px; font-size: 12px;"><?= $user['role'] === 'founder' ? 'Manage' : 'View' ?></a>
</div>
</div>
<?php endforeach; ?>
@ -117,5 +122,28 @@ if ($user['role'] === 'founder') {
</div>
</main>
<style>
header {
background: rgba(10, 10, 10, 0.8);
backdrop-filter: blur(20px);
border-bottom: 1px solid var(--border-color);
padding: 15px 0;
position: sticky;
top: 0;
z-index: 1000;
}
.nav-links a {
color: var(--text-secondary);
text-decoration: none;
margin: 0 15px;
font-size: 14px;
font-weight: 500;
transition: color 0.2s;
}
.nav-links a:hover, .nav-links a.active {
color: #fff;
}
</style>
</body>
</html>
</html>