34607-vm/profile.php
Flatlogic Bot 34236e9979 1.0.0
2025-10-03 03:24:30 +00:00

63 lines
2.9 KiB
PHP

<?php
require_once 'templates/header.php';
if (!isset($_SESSION['user_id'])) {
header('Location: login.php');
exit();
}
require_once 'db/config.php';
$pdo = db();
$stmt = $pdo->prepare('SELECT * FROM users WHERE id = ?');
$stmt->execute([$_SESSION['user_id']]);
$user = $stmt->fetch();
?>
<div class="container">
<div class="row">
<div class="col-md-8 offset-md-2">
<h1 class="text-center mb-4">Your Profile</h1>
<?php if (isset($_GET['success'])): ?>
<div class="alert alert-success">Profile updated successfully!</div>
<?php endif; ?>
<div class="card">
<div class="card-body">
<form action="auth.php" method="POST">
<input type="hidden" name="action" value="update_profile">
<div class="mb-3">
<label for="name" class="form-label">Name</label>
<input type="text" class="form-control" id="name" name="name" value="<?php echo htmlspecialchars($user['name']); ?>" required>
</div>
<div class="mb-3">
<label for="email" class="form-label">Email address</label>
<input type="email" class="form-control" id="email" name="email" value="<?php echo htmlspecialchars($user['email']); ?>" required>
</div>
<div class="mb-3">
<label for="bio" class="form-label">Bio</label>
<textarea class="form-control" id="bio" name="bio" rows="3"><?php echo htmlspecialchars($user['bio'] ?? ''); ?></textarea>
</div>
<div class="mb-3">
<label for="skills" class="form-label">Skills (comma-separated)</label>
<input type="text" class="form-control" id="skills" name="skills" value="<?php echo htmlspecialchars($user['skills'] ?? ''); ?>">
</div>
<div class="mb-3">
<label for="interests" class="form-label">Interests (comma-separated)</label>
<input type="text" class="form-control" id="interests" name="interests" value="<?php echo htmlspecialchars($user['interests'] ?? ''); ?>">
</div>
<div class="mb-3">
<label for="goals" class="form-label">Goals</label>
<textarea class="form-control" id="goals" name="goals" rows="3"><?php echo htmlspecialchars($user['goals'] ?? ''); ?></textarea>
</div>
<button type="submit" class="btn btn-primary">Update Profile</button>
</form>
</div>
</div>
</div>
</div>
</div>
<?php require_once 'templates/footer.php'; ?>