Update file news.php
This commit is contained in:
parent
98c6208b3b
commit
e3ef74bf7c
@ -45,7 +45,7 @@ if (filter_var($_GET['article'], FILTER_VALIDATE_INT)) {
|
||||
<div>
|
||||
<div>
|
||||
<?php
|
||||
if ($article != "" && file_exists('/var/www/e59/content/journal/' . $article . '.md')) {
|
||||
if (!isset($_GET['search']) && $article != "" && file_exists('/var/www/e59/content/journal/' . $article . '.md')) {
|
||||
$markdownContent = file_get_contents('/var/www/e59/content/journal/' . $article . '.md');
|
||||
|
||||
require_once '../include/parsedown.php';
|
||||
@ -69,11 +69,19 @@ if (filter_var($_GET['article'], FILTER_VALIDATE_INT)) {
|
||||
echo "</div></div>";
|
||||
} else {
|
||||
$bdd = connect($dbhost, $dbname, $dbuser, $dbpass);
|
||||
$req = $bdd->prepare("SELECT ID, titre, date FROM articles WHERE classification <= :accreditation ORDER BY date DESC");
|
||||
if (isset($_GET['search'])) {
|
||||
$req = $bdd->prepare("SELECT ID, titre, date FROM articles WHERE classification <= :accreditation AND titre LIKE '%:search%'ORDER BY date DESC");
|
||||
$req->bindParam(":search", $_GET['search']);
|
||||
} else {
|
||||
$req = $bdd->prepare("SELECT ID, titre, date FROM articles WHERE classification <= :accreditation ORDER BY date DESC");
|
||||
}
|
||||
$req->bindParam(":accreditation", $_SESSION['accreditation']);
|
||||
$req->execute();
|
||||
$resultat = $req->fetchAll(PDO::FETCH_ASSOC);
|
||||
|
||||
echo "<h1>Dernières news du Club</h1>";
|
||||
echo "<form action='' method='get'><input type='text' placeholder='Rechercher un article' name='search'></form>"
|
||||
|
||||
if ($resultat) {
|
||||
foreach($resultat as $row) {
|
||||
$date = strtotime($row['date']);
|
||||
|
Loading…
x
Reference in New Issue
Block a user