Ejemplo n.º 1
0
// exemple avec le répertoire courant
$repertoire = "./Images";
// la valeur de retour de scandir est un tableau
$fichiers = scandir($repertoire);
$compteur = 0;
?>

<head>
    <link rel="stylesheet" type="text/css" href="styles.css">
</head>
<table class="vision">
    <?php 
if ($fichiers !== FALSE) {
    for ($i = sizeof($fichiers) - 1; $i >= 0; $i--) {
        $nomFichier = $fichiers[$i];
        if ($nomFichier[0] != "." && !empty($gestion->GetInfoFromImage($nomFichier))) {
            if ($compteur == 5) {
                echo "</tr>";
                $compteur = 0;
            }
            if ($compteur % 5 == 0) {
                echo "<tr>";
            }
            echo '<td><a href="gestimage.php?i=' . $nomFichier . '"><img src="Images/' . $nomFichier . '"></a></td>';
            $compteur++;
        }
        if ($i == 0 && $compteur != 5) {
            echo "</tr>";
        }
    }
} else {
Ejemplo n.º 2
0
<head>
    <link rel='stylesheet' type='text/css' href='styles.css'>
</head>
<?php 
session_start();
include_once "BaseDeDonne.php";
include_once "BDClass.php";
$gestion = new Gestion();
include_once "headpage.php";
$image = $_GET["i"];
$ImageInfos = 0;
if ($ImageInfos = $gestion->GetInfoFromImage($image)) {
    $imageUser = $ImageInfos[0][0];
    $imageDate = $ImageInfos[0][1];
    $imageTitre = $ImageInfos[0][2];
}
gestionPost($gestion);
//Section Image
echo "\n<div class='lediv'>\n    <img class='limg' src='./Images/" . $image . "'>\n</div>\n<div class='comment'>\n    <h2>" . $imageTitre . "</h2>\n    <b>Auteur: " . $imageUser . "</b>\n    <br>\n    Date de Création: " . $imageDate . "\n</div>\n";
//Sections Commentaire
echo "\n<hr>\n<div class='comment'>\n";
$tableauCommentaire = $gestion->GetCommentaireFromImage($image);
echo "\n    <table class='upload' style='width: 100%'>\n    <tr>\n        <td>User</td>\n        <td>Date</td>\n        <td colspan='2'>Commentaire</td>\n    </tr>\n    ";
for ($i = 0; $i < count($tableauCommentaire); $i++) {
    echo "\n        <tr>\n            <td>" . $tableauCommentaire[$i][0] . "</td>\n            <td>" . $tableauCommentaire[$i][1] . "</td>";
    if ($tableauCommentaire[$i][0] == $_SESSION["user"] || $_SESSION["user"] == "admin") {
        echo "\n            <td>" . $tableauCommentaire[$i][2] . "</td>\n            <form action='gestimage.php' method='post'>\n                <td class='SupprimerButton'>\n                    <input type='submit' value='Supprimer' name='SupCom'>\n                    <input type='hidden' value='" . $tableauCommentaire[$i][3] . "' name='IdImagePost'>\n                </td>\n            </form>\n        </tr>\n        ";
    } else {
        echo "<td colspan='2'>" . $tableauCommentaire[$i][2] . "</td>";
    }
}