1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
| <?php
session_start();
require 'db/database.php';
include 'partials/header.php';
/* ON RECUPERE LES COMMENTAIRES */
setlocale(LC_TIME, 'fr_FR.UTF8', 'fr.UTF8', 'fr_FR.UTF-8', 'fr.UTF-8');
setlocale(LC_ALL, 'fr_FR');
$commentaires = $db->query("SET NAMES utf8");
$commentaires = $db->query('SELECT id, nom, message, DATEDIFF(CURRENT_DATE, date_creation) as date_creation, DATE_FORMAT(heure_creation, "%HH%i") as heure_creation, DATE_FORMAT(edit_date, "%d %M %Y à %HH%i") as edit_date FROM commentaires ORDER BY id DESC'); // RECUPERATION ECOULEMENT DU NOMBRE DE JOUR DEPUIS LA CREATION DU COMMENTAIRE
$coms = $commentaires->fetchAll();
?>
<!DOCTYPE html>
<html>
<head>
<title>Contactez-Moi !</title>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<link href='http://fonts.googleapis.com/css?family=Lato' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="css/style.css">
<script src="test.js"></script>
</head>
<body>
<div class="wrapper">
<h1 class="text-logo">Poster un commentaire</h1>
<div id="flash" class="flash flash-danger">
<p class="comments-nom"></p>
<p class="comments-message"></p>
</div>
<!-- ----------------------------- -->
<!-- FORMULAIRE DE COMMENTAIRES -->
<!-- ----------------------------- -->
<form id="form-commentaire" class="formulaire-inscription" action="" method="POST">
<input type="text" class="form-control-commentaires" name="nom" readonly="readonly" style="font-weight: bold; color: #AF5975 !important;" value="<?php if(isset($_SESSION['admin'])) { echo $_SESSION['name']; } ?><?php if(isset($_SESSION['membre'])) { echo $_SESSION['name']; } ?>">
<textarea id="message" type="text" class="form-control-commentaires" name="message" placeholder="Message"><?= isset($_SESSION['inputs']['message']) ? $_SESSION['inputs']['message'] : ''; ?></textarea>
<button class="bouton bouton-success" type="submit">ENVOYER</span></button>
</form>
<div id="success" class="flash flash-success">Votre commentaire à bien été publié.</div>
<!-- ----------------------------- -->
<!-- ON AFFICHE LES COMMENTAIRES -->
<!-- ----------------------------- -->
<div class="wrapper-formulaire-commentaires">
<?php foreach($coms as $c): ?>
<div class="element"><img class="avatar-accueil-commentaires" src="images/icons/avatar.png" width="45"></div>
<div id="conteneur">
<div class="nom"><?= $c->nom; ?>
<?php if($c->date_creation > 1 AND $c->date_creation < 31) { ?><span class="date_creation">il y a <?= $c->date_creation ?> jours à <?= $c->heure_creation ?></span> <?php } ?>
<?php if($c->date_creation == 1) { ?><span class="date_creation">Hier à <?= $c->heure_creation ?></span><?php } ?>
<?php if($c->date_creation < 1) { ?><span class="date_creation">Aujourd'hui à <?= $c->heure_creation ?></span><?php } ?>
</div>
<div class="message"><?= $c->message ; ?></div>
</div>
<?php endforeach; ?>
</div>
</div> <!-- FIN div WRAPPER -->
<script src="test.js"></script>
</body>
</html> |
Partager