Web/TP/TPSecurite/article_list.php
2023-05-25 11:53:03 +02:00

41 lines
573 B
PHP
Executable File

<?php
require_once 'lib/common.php';
session_start();
$db = initDatabase();
$req = mysqli_query($db,"SELECT * FROM article");
$articles=mysqli_fetch_all($req);
?>
<?php
include './templates/header.php';
?>
<body container>
<h1>Liste des articles</h1>
<?php
if (!empty($_SESSION['user'])) {
echo "<p>Bonjour, " . $_SESSION['user']['name']. ".</p>";
}
?>
<ul>
<?php
foreach ($articles as $article) {
echo '<li><a href="article_view.php?id=' . $article[0].'">'
. $article[1] . "</a></li>\n";
}
?>
</ul>
<?php
include './templates/footer.php';
?>
</body>
</html>