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 87 88 89 90
| <?php
session_start();
// parametre de connexion
$host_name = "localhost";
$database = "forum_projet";
$db_user_name = "root";
$db_password = "root";
// connexion
$conn = mysqli_connect($host_name, $db_user_name, $db_password, $database);
if ($_session=['username']) {
?>
<html>
<head>
<title> home page </title>
</head>
<?php include ("header.php"); ?>
<center>
<br/>
<a href = "post.php"><button> post topic </button></a>
<br/>
<br/>
<?php echo ' <table border="1px;">'; ?>
<tr>
<td>
<span>ID</span>
</td>
<td width="400px;" style="test-align: center;">
nom
</td>
<td width="80px;" style="text-align: center;">
createur
</td>
<td width="80px;" style="text-align: center;">
date
</td>
</tr>
</center>
<body>
</body>
</html>
<?php
$check= mysqli_query($conn,"select id_sujet,nom_sujet,createur_sujet,date from sujets") ;
if (mysqli_num_rows ($check) !=0){
while ($row = mysqli_fetch_assoc($check)){
$id=$row['id_sujet'] ;
echo"<tr>";
echo "<td>".$row['id_sujet']."</td>";
echo "<td style ='text-align : center;'> <a href='sujet.php?id=$id'> ".$row['nom_sujet']."</a></td>";
echo "<td>".$row['createur_sujet']."</td>";
echo "<td>".$row['date']."</td>";
echo "</tr>";
}
}else{
echo "sujet non trouver";
}
echo" </table>";
if (@$_GET['action'] == "logout") {
session_destroy() ;
header ("location: ess_log.php") ;
}
}else{
echo " you must be logged in";
}
?> |
Partager