Edit Profile
Manage your public presence in the = htmlspecialchars($platformName) ?> community.
Danger Zone
Deleting your account is permanent and cannot be undone. All your profile information will be removed, but your startup listings will remain.
prepare("SELECT * FROM users WHERE id = ?"); $stmt->execute([$_SESSION['user_id']]); $user = $stmt->fetch(); $platformName = defined('PLATFORM_NAME') ? PLATFORM_NAME : 'Gatsby'; $error = ''; $success = ''; // Check for active funding rounds $stmt = db()->prepare("SELECT COUNT(*) FROM startups s JOIN funding_rounds fr ON s.id = fr.startup_id WHERE s.founder_id = ? AND fr.status = 'Active'"); $stmt->execute([$_SESSION['user_id']]); $activeRoundsCount = $stmt->fetchColumn(); if ($_SERVER['REQUEST_METHOD'] === 'POST') { if (isset($_POST['action']) && $_POST['action'] === 'delete_account') { if ($user['role'] === 'founder' && $activeRoundsCount > 0) { $error = "You cannot delete your account with active funding rounds. Please finish or cancel them first."; } else { // Delete account db()->beginTransaction(); try { // Remove profile (cascades or sets null according to our migration) $stmt = db()->prepare("DELETE FROM users WHERE id = ?"); $stmt->execute([$_SESSION['user_id']]); db()->commit(); session_destroy(); header("Location: login.php?msg=account_deleted"); exit; } catch (Exception $e) { db()->rollBack(); $error = "Account deletion failed: " . $e->getMessage(); } } } else { $full_name = trim($_POST['full_name'] ?? ''); $bio = trim($_POST['bio'] ?? ''); $interests = trim($_POST['interests'] ?? ''); $investment_appetite = trim($_POST['investment_appetite'] ?? ''); if (empty($full_name)) { $error = "Name cannot be empty."; } else { $stmt = db()->prepare("UPDATE users SET full_name = ?, bio = ?, interests = ?, investment_appetite = ? WHERE id = ?"); try { $stmt->execute([$full_name, $bio, $interests, $investment_appetite, $_SESSION['user_id']]); $success = "Profile updated successfully!"; // Update session if name changed $_SESSION['full_name'] = $full_name; // Refresh user data $stmt = db()->prepare("SELECT * FROM users WHERE id = ?"); $stmt->execute([$_SESSION['user_id']]); $user = $stmt->fetch(); } catch (PDOException $e) { $error = "Update failed: " . $e->getMessage(); } } } } ?>
Manage your public presence in the = htmlspecialchars($platformName) ?> community.
Deleting your account is permanent and cannot be undone. All your profile information will be removed, but your startup listings will remain.