34702-vm/apply.php
2025-10-05 21:53:53 +00:00

56 lines
2.1 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
require_once 'header.php';
require_once 'db/config.php';
if (!isset($_SESSION['loggedin']) || $_SESSION['role'] !== 'talent') {
header('Location: /dashboard.php');
exit;
}
$user_id = $_SESSION['user_id'];
$message = '';
$pdo = db();
// Handle form submission
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$bio = $_POST['bio'] ?? '';
$category = $_POST['category'] ?? '';
try {
$stmt = $pdo->prepare("UPDATE users SET bio = ?, category = ?, profile_status = 'pending' WHERE id = ?");
$stmt->execute([$bio, $category, $user_id]);
$message = '<div class="alert alert-success">Profiliniz başarıyla güncellendi. Başvurunuz incelenmek üzere gönderildi.</div>';
} catch (PDOException $e) {
$message = '<div class="alert alert-danger">Profil güncellenirken bir hata oluştu: ' . $e->getMessage() . '</div>';
}
}
// Fetch current user data
$stmt = $pdo->prepare("SELECT bio, category FROM users WHERE id = ?");
$stmt->execute([$user_id]);
$user = $stmt->fetch(PDO::FETCH_ASSOC);
?>
<div class="container mt-5">
<h1>Başvuru Yap / Profili Düzenle</h1>
<p>Influencer profilinizi tamamlamak veya güncellemek için aşağıdaki formu doldurun.</p>
<?php echo $message; ?>
<form action="" method="POST">
<div class="mb-3">
<label for="category" class="form-label">Kategori</label>
<input type="text" class="form-control" id="category" name="category" value="<?php echo htmlspecialchars($user['category'] ?? ''); ?>" placeholder="Örn: Moda, Teknoloji, Seyahat">
</div>
<div class="mb-3">
<label for="bio" class="form-label">Biyografi</label>
<textarea class="form-control" id="bio" name="bio" rows="6" placeholder="Kendinizden, içeriklerinizden ve hedef kitlenizden bahsedin."><?php echo htmlspecialchars($user['bio'] ?? ''); ?></textarea>
</div>
<button type="submit" class="btn btn-primary">Kaydet ve Başvuruyu Gönder</button>
<a href="/dashboard.php" class="btn btn-secondary">Panele Dön</a>
</form>
</div>
<?php require_once 'footer.php'; ?>