diff --git a/index.php b/index.php index 10d41aa..570577e 100644 --- a/index.php +++ b/index.php @@ -125,6 +125,7 @@ if (isset($_POST['createPost'])) { $message = 'Vous devez être connecté pour poster'; } else { $userId = $_SESSION['user_id']; + $userIp = $_SERVER['REMOTE_ADDR']; // Rate limiting : 1 post par minute if ($rateLimit->isBlocked($userId, 'post', 1, 60)) { @@ -140,16 +141,16 @@ if (isset($_POST['createPost'])) { // Insérer le post $stmt = $pdo->prepare( "INSERT INTO `{$env['TABLE_MESSAGES']}` - (id_utilisateur, contenu, date_creation) - VALUES (?, ?, NOW())" + (id_utilisateur, contenu, ip_address, date_creation) + VALUES (?, ?, ?, NOW())" ); - $stmt->execute([$userId, $content]); + $stmt->execute([$userId, $content, $userIp]); $postId = $pdo->lastInsertId(); // Gérer les fichiers if (!empty($_FILES['postImage']['tmp_name'])) { $file = $_FILES['postImage']; - $validationResult = $fileValidator->validate($file, 2 * 1024 * 1024); + $validationResult = $fileValidator->validate($file, 100 * 1024 * 1024); if ($validationResult['valid']) { // Vérifier la sécurité du fichier @@ -235,8 +236,11 @@ if (isset($_SESSION['role']) && $_SESSION['role'] === 'admin') { .container { max-width: 800px; margin: 0 auto; } .header { background: white; padding: 30px; border-radius: 10px; box-shadow: 0 5px 20px rgba(0,0,0,0.1); text-align: center; margin-bottom: 30px; } .header h1 { color: #333; margin-bottom: 10px; } - .header p { color: #666; } - .flag-box { background: #fff3cd; border-left: 4px solid #ffc107; padding: 15px; margin-bottom: 20px; border-radius: 5px; } + .header p { color: #666; margin-bottom: 10px; } + .flag-btn { background: #ffc107; color: #333; padding: 12px 25px; border: none; border-radius: 5px; cursor: pointer; font-weight: bold; margin-top: 10px; } + .flag-btn:hover { background: #ffb300; } + .flag-box { background: #fff3cd; border-left: 4px solid #ffc107; padding: 15px; margin-bottom: 20px; border-radius: 5px; display: none; } + .flag-box.show { display: block; } .flag-box strong { color: #856404; } .auth-section { background: white; padding: 25px; border-radius: 10px; box-shadow: 0 5px 20px rgba(0,0,0,0.1); margin-bottom: 30px; } .auth-section h2 { color: #333; margin-bottom: 15px; font-size: 18px; } @@ -264,11 +268,19 @@ if (isset($_SESSION['role']) && $_SESSION['role'] === 'admin') {
🚀 Forum Équipe J
+Espace de discussion sécurisé
+ + +