38873-vm/profile.php
Flatlogic Bot 3575e4a095 v70
2026-02-28 23:27:55 +00:00

215 lines
12 KiB
PHP

<?php
session_start();
require_once 'db/config.php';
if (!isset($_SESSION['user_id'])) {
header('Location: login.php');
exit;
}
$current_user_id = $_SESSION['user_id'];
$target_user_id = $_GET['id'] ?? $current_user_id;
$stmt = db()->prepare("SELECT * FROM users WHERE id = ?");
$stmt->execute([$target_user_id]);
$target_user = $stmt->fetch();
if (!$target_user) {
die("User not found.");
}
$is_own_profile = ($current_user_id == $target_user_id);
$stmt_current = db()->prepare("SELECT role FROM users WHERE id = ?");
$stmt_current->execute([$current_user_id]);
$current_user = $stmt_current->fetch();
$platformName = defined('PLATFORM_NAME') ? PLATFORM_NAME : 'Gatsby';
// Fetch target user's startups if they are a founder
$startups = [];
if ($target_user['role'] === 'founder') {
$stmt = db()->prepare("SELECT * FROM startups WHERE founder_id = ? ORDER BY created_at DESC");
$stmt->execute([$target_user_id]);
$startups = $stmt->fetchAll();
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title><?= htmlspecialchars($target_user['full_name']) ?> | Profile</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&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.0.0/css/all.min.css">
<style>
.profile-card {
background: var(--surface-color);
border: 1px solid var(--border-color);
border-radius: 32px;
padding: 50px;
margin-bottom: 40px;
}
.stat-box {
background: rgba(255,255,255,0.03);
border: 1px solid var(--border-color);
border-radius: 20px;
padding: 20px;
text-align: center;
}
.tag {
display: inline-block;
padding: 6px 14px;
background: rgba(255,255,255,0.05);
border: 1px solid var(--border-color);
border-radius: 50px;
font-size: 13px;
color: var(--text-secondary);
margin: 0 8px 8px 0;
}
</style>
</head>
<body style="background: #000; color: #fff;">
<header>
<div class="container" style="display: flex; justify-content: space-between; align-items: center; width: 100%;">
<a href="dashboard.php" class="logo-container">
<img src="assets/images/logo.svg?v=<?php echo time(); ?>" alt="<?= htmlspecialchars($platformName) ?> Logo" class="logo-img">
<span class="logo-text"><?= htmlspecialchars($platformName) ?></span>
</a>
<nav class="nav-links">
<a href="dashboard.php">Dashboard</a>
<a href="messages.php">Messages</a>
</nav>
<div style="display: flex; align-items: center; gap: 15px;">
<?php if ($is_own_profile): ?>
<a href="edit_profile.php" class="btn btn-secondary" style="font-size: 12px; border-radius: 10px;">Edit Profile</a>
<?php endif; ?>
<a href="logout.php" class="btn btn-secondary" style="padding: 8px 16px; font-size: 12px; border-radius: 10px;">Log Out</a>
</div>
</div>
</header>
<div class="container" style="padding: 80px 20px;">
<div style="max-width: 1000px; margin: 0 auto;">
<div class="profile-card">
<div style="display: flex; align-items: center; gap: 40px; margin-bottom: 40px;">
<div style="width: 140px; height: 140px; background: var(--gradient-primary); border-radius: 40px; display: flex; align-items: center; justify-content: center; font-size: 60px; color: #fff; font-weight: 900; box-shadow: 0 20px 40px rgba(0, 122, 255, 0.2);">
<?= substr($target_user['full_name'], 0, 1) ?>
</div>
<div style="flex: 1;">
<div style="display: flex; align-items: center; gap: 15px; margin-bottom: 10px;">
<h1 style="font-size: 40px; font-weight: 900; margin: 0; letter-spacing: -1px;"><?= htmlspecialchars($target_user['full_name']) ?></h1>
<span style="background: rgba(0, 242, 255, 0.1); color: var(--accent-blue); padding: 6px 14px; border-radius: 100px; font-size: 12px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase;">
<?= htmlspecialchars($target_user['role']) ?>
</span>
</div>
<div style="color: var(--text-secondary); font-size: 18px; margin-bottom: 20px;">
<i class="fas fa-university"></i> <?= htmlspecialchars($target_user['university']) ?> • <?= htmlspecialchars($target_user['degree_program']) ?>
</div>
<div style="display: flex; gap: 15px;">
<?php if (!$is_own_profile): ?>
<a href="messages.php?chat_with=<?= $target_user['id'] ?>" class="btn btn-primary" style="padding: 12px 24px; font-size: 14px;">
<i class="far fa-comment-dots"></i> Message
</a>
<?php endif; ?>
<?php if ($target_user['role'] === 'founder' && $target_user['cv_url']): ?>
<a href="<?= htmlspecialchars($target_user['cv_url']) ?>" target="_blank" class="btn btn-secondary" style="padding: 12px 24px; font-size: 14px; border-color: var(--border-color);">
<i class="fas fa-file-pdf"></i> Download CV
</a>
<?php endif; ?>
</div>
</div>
</div>
<div style="grid-template-columns: 1fr 2fr; display: grid; gap: 50px;">
<div>
<h3 style="font-size: 18px; font-weight: 800; margin-bottom: 20px; border-bottom: 1px solid var(--border-color); padding-bottom: 10px;">About</h3>
<p style="color: var(--text-secondary); line-height: 1.6; font-size: 15px; margin-bottom: 30px;">
<?= nl2br(htmlspecialchars($target_user['bio'] ?: 'No bio provided.')) ?>
</p>
<h3 style="font-size: 18px; font-weight: 800; margin-bottom: 20px; border-bottom: 1px solid var(--border-color); padding-bottom: 10px;">Details</h3>
<div style="display: flex; flex-direction: column; gap: 15px;">
<div>
<div style="font-size: 11px; text-transform: uppercase; color: var(--text-secondary); margin-bottom: 4px;">Location</div>
<div style="font-weight: 600;"><i class="fas fa-globe-americas" style="margin-right: 5px; opacity: 0.6;"></i> <?= htmlspecialchars($target_user['country'] ?: 'Not specified') ?></div>
</div>
<?php if($target_user['role'] === 'founder'): ?>
<div>
<div style="font-size: 11px; text-transform: uppercase; color: var(--text-secondary); margin-bottom: 4px;">Commitment</div>
<div style="font-weight: 600;"><?= ucfirst(htmlspecialchars($target_user['commitment_level'] ?: 'Not specified')) ?></div>
</div>
<?php endif; ?>
</div>
</div>
<div>
<?php if($target_user['role'] === 'founder'): ?>
<h3 style="font-size: 18px; font-weight: 800; margin-bottom: 20px; border-bottom: 1px solid var(--border-color); padding-bottom: 10px;">Skills & Expertise</h3>
<div style="margin-bottom: 40px;">
<?php
$skills = explode(',', $target_user['skills'] ?? '');
foreach ($skills as $skill): if(empty(trim($skill))) continue; ?>
<span class="tag"><?= htmlspecialchars(trim($skill)) ?></span>
<?php endforeach; if(empty(trim($target_user['skills'] ?? ''))) echo '<p style="color: var(--text-secondary);">No skills listed.</p>';
?>
</div>
<h3 style="font-size: 18px; font-weight: 800; margin-bottom: 20px; border-bottom: 1px solid var(--border-color); padding-bottom: 10px;">Ventures</h3>
<div style="display: grid; gap: 15px;">
<?php foreach ($startups as $startup): ?>
<a href="startup_details.php?id=<?= $startup['id'] ?>" style="display: flex; align-items: center; justify-content: space-between; padding: 20px; background: rgba(255,255,255,0.03); border-radius: 18px; border: 1px solid var(--border-color); text-decoration: none; color: inherit;">
<div style="display: flex; align-items: center; gap: 15px;">
<div style="width: 45px; height: 45px; border-radius: 12px; background: var(--gradient-primary); display: flex; align-items: center; justify-content: center; font-weight: 800;">
<?= substr($startup['name'], 0, 1) ?>
</div>
<div>
<div style="font-weight: 700;"><?= htmlspecialchars($startup['name']) ?></div>
<div style="font-size: 12px; color: var(--text-secondary);"><?= htmlspecialchars($startup['industry']) ?></div>
</div>
</div>
<i class="fas fa-chevron-right" style="color: var(--text-secondary); font-size: 12px;"></i>
</a>
<?php endforeach; if(empty($startups)) echo '<p style="color: var(--text-secondary);">No startups listed.</p>'; ?>
</div>
<?php else: ?>
<h3 style="font-size: 18px; font-weight: 800; margin-bottom: 20px; border-bottom: 1px solid var(--border-color); padding-bottom: 10px;">Investment Profile</h3>
<div style="display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 40px;">
<div class="stat-box">
<div style="font-size: 11px; text-transform: uppercase; color: var(--text-secondary); margin-bottom: 10px;">Appetite</div>
<div style="font-size: 18px; font-weight: 800; color: var(--accent-blue);"><?= htmlspecialchars($target_user['investment_appetite'] ?: 'N/A') ?></div>
</div>
<div class="stat-box">
<div style="font-size: 11px; text-transform: uppercase; color: var(--text-secondary); margin-bottom: 10px;">Risk Tolerance</div>
<div style="font-size: 18px; font-weight: 800; color: #fff;"><?= ucfirst(htmlspecialchars($target_user['risk_tolerance'] ?: 'N/A')) ?></div>
</div>
</div>
<h3 style="font-size: 18px; font-weight: 800; margin-bottom: 20px; border-bottom: 1px solid var(--border-color); padding-bottom: 10px;">Interests</h3>
<div style="margin-bottom: 40px;">
<?php
$interests = explode(',', $target_user['interests'] ?? '');
foreach ($interests as $interest): if(empty(trim($interest))) continue; ?>
<span class="tag"><?= htmlspecialchars(trim($interest)) ?></span>
<?php endforeach; if(empty(trim($target_user['interests'] ?? ''))) echo '<p style="color: var(--text-secondary);">No interests listed.</p>';
?>
</div>
<?php endif; ?>
</div>
</div>
</div>
</div>
</div>
<footer style="padding: 60px 0; border-top: 1px solid var(--border-color); margin-top: 100px; text-align: center;">
<p style="color: var(--text-secondary); font-size: 14px;">&copy; <?= date('Y') ?> Gatsby Capitalist Platform. All rights reserved.</p>
</footer>
</body>
</html>