|
Server : LiteSpeed System : Linux terra.hostitbro.com 5.14.0-611.54.3.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Thu May 7 16:31:24 EDT 2026 x86_64 User : outerorb ( 1091) PHP Version : 8.1.34 Disable Function : mail Directory : /home2/outerorb/.trash/survey_system/ | |
|
Path: /home2/outerorb/.trash/survey_system/suggest_feature.php
Size: 1.56 KB
Permissions: 0666
<?php
require_once __DIR__ . '/config.php';
require_once __DIR__ . '/inc/eventlog.php';
if (!is_logged_in()) {
header('Location: ' . BASE_URL . '/index.php');
exit;
}
$user = current_user();
if ($user['role'] === 'admin') {
header('Location: ' . BASE_URL . '/dashboard.php');
exit;
}
$message = '';
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$suggestion = trim($_POST['suggestion'] ?? '');
if (empty($suggestion)) {
$message = 'Suggestion cannot be empty.';
} else {
$stmt = $pdo->prepare('INSERT INTO suggestions (user_id, suggestion) VALUES (?, ?)');
$stmt->execute([$user['id'], $suggestion]);
// Log the feature suggestion
log_event('feature_suggestion_submitted', ['suggestion_preview' => substr($suggestion, 0, 100) . (strlen($suggestion) > 100 ? '...' : '')]);
$message = 'Thank you! Your suggestion has been submitted.';
}
}
?>
<?php include __DIR__ . '/inc/header.php'; ?>
<div class="container mt-4">
<h2>Suggest a Feature</h2>
<?php if ($message): ?>
<div class="alert alert-info"><?= h($message) ?></div>
<?php endif; ?>
<form method="post">
<div class="mb-3">
<label for="suggestion" class="form-label">Your Suggestion</label>
<textarea class="form-control" id="suggestion" name="suggestion" rows="5" required></textarea>
</div>
<button type="submit" class="btn btn-primary">Submit Suggestion</button>
</form>
</div>
<?php include __DIR__ . '/inc/footer.php'; ?>