Edit Profile
Back to DashboardManage your public presence in the = htmlspecialchars($platformName) ?> community.
Danger Zone
Deleting your account is permanent. All your data, startups, and matches will be removed.
prepare("SELECT * FROM users WHERE id = ?"); $stmt->execute([$user_id]); $user = $stmt->fetch(); if (!$user) { header('Location: login.php'); exit; } $platformName = defined('PLATFORM_NAME') ? PLATFORM_NAME : 'Gatsby'; $error = ''; $success = ''; // Centralized country list $countries = require 'includes/countries.php'; if ($_SERVER['REQUEST_METHOD'] === 'POST') { if (isset($_POST['action']) && $_POST['action'] === 'update_profile') { $full_name = trim($_POST['full_name']); $bio = trim($_POST['bio']); $university = trim($_POST['university']); $degree_program = trim($_POST['degree_program']); $skills = trim($_POST['skills']); $startup_industries = trim($_POST['startup_industries']); $country = $_POST['country'] ?? ''; $cv_url = $user['cv_url']; // Handle CV Upload if (isset($_FILES['cv_file']) && $_FILES['cv_file']['error'] === UPLOAD_ERR_OK) { $file_tmp = $_FILES['cv_file']['tmp_name']; $file_name = $_FILES['cv_file']['name']; $file_ext = strtolower(pathinfo($file_name, PATHINFO_EXTENSION)); $allowed_exts = ['pdf', 'doc', 'docx']; if (in_array($file_ext, $allowed_exts)) { $upload_dir = 'assets/docs/cvs/'; if (!is_dir($upload_dir)) { mkdir($upload_dir, 0777, true); } $new_file_name = 'cv_' . $user_id . '_' . time() . '.' . $file_ext; $target_path = $upload_dir . $new_file_name; if (move_uploaded_file($file_tmp, $target_path)) { $cv_url = $target_path; } else { $error = "Failed to upload CV."; } } else { $error = "Invalid CV file type. Only PDF, DOC, and DOCX are allowed."; } } if (!$error) { if ($full_name) { $stmt = db()->prepare("UPDATE users SET full_name = ?, bio = ?, university = ?, degree_program = ?, skills = ?, startup_industries = ?, country = ?, cv_url = ? WHERE id = ?"); $stmt->execute([$full_name, $bio, $university, $degree_program, $skills, $startup_industries, $country, $cv_url, $user_id]); $success = "Profile updated successfully!"; // Refresh user data $stmt = db()->prepare("SELECT * FROM users WHERE id = ?"); $stmt->execute([$user_id]); $user = $stmt->fetch(); } else { $error = "Full name is required."; } } } elseif (isset($_POST['action']) && $_POST['action'] === 'delete_account') { try { db()->beginTransaction(); db()->prepare("DELETE FROM startup_followers WHERE user_id = ?")->execute([$user_id]); db()->prepare("DELETE FROM matches WHERE user1_id = ? OR user2_id = ?")->execute([$user_id, $user_id]); db()->prepare("DELETE FROM swipes WHERE swiper_id = ? OR swiped_id = ?")->execute([$user_id, $user_id]); db()->prepare("DELETE FROM notifications WHERE user_id = ?")->execute([$user_id]); db()->prepare("DELETE FROM users WHERE id = ?")->execute([$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(); } } } ?>
Manage your public presence in the = htmlspecialchars($platformName) ?> community.
Deleting your account is permanent. All your data, startups, and matches will be removed.