diff --git a/html/editpage.php b/html/editpage.php index 7d724d9b..fb142f10 100644 --- a/html/editpage.php +++ b/html/editpage.php @@ -164,9 +164,17 @@ if(isset($fichier)) { } echo "
"; echo "

Articles

"; + echo "
"; + $bdd = connect($dbhost, $dbname, $dbuser, $dbpass); - $req = $bdd->prepare("SELECT ID, titre, date FROM articles WHERE classification <= :accreditation ORDER BY date DESC LIMIT 10"); + $condition = "" + if(isset($_GET['search'])) { + $search = "%" . htmlspecialchars($_GET['search']) . "%"; + $condition = " AND (titre LIKE " . $search . " OR ID LIKE " . $search; + } + $req = $bdd->prepare("SELECT ID, titre, date FROM articles WHERE classification <= :accreditation :condition ORDER BY date DESC LIMIT 10"); $req->bindParam(":accreditation", $_SESSION['accreditation']); + $req->bindParam(":condition", $condition); $req->execute(); $resultat = $req->fetchAll(PDO::FETCH_ASSOC);