<?PHP 
require_once('core.php');
if(!isset($_SESSION['id']))
{
header("Location: index.php");
exit();
}
$menu = "commu";
$page = "photo";
$erreur = false;
?>
<!doctype html>
<html>
    <head>
        <meta charset="utf-8">
        <title><?PHP echo htmlentities(trim($cms['nom_hotel'])); ?> - Photo</title>
        
        <link rel="import" href="https://www.polymer-project.org/0.5/components/paper-ripple/paper-ripple.html">
        <link type="text/css" href="web/css/material.css" rel="stylesheet">
        <link rel="stylesheet" type="text/css" href="web/css/nav.css">
        <script src="web/js/jquery.js"></script>
        <script type="text/javascript" src="web/js/smoothscroll.js"></script>
    </head>    
    <body>
    <?PHP require_once('template/header/template_header.php'); ?>
        <div class="container_24">
        <?PHP require_once('template/header/template_nav.php'); ?>
        <?PHP if (isset($message) && $erreur == true) { ?>
                <div class="grid_24">
            <div id="erreur">
                <div class="title red">
                    <?PHP echo htmlentities(trim($message)); ?>
                </div>
            </div>
        </div>
        <?PHP } elseif (isset($message) && $erreur == false) { ?>
        <div class="grid_24">
            <div id="good">
                <div class="title red">
                    <?PHP echo htmlentities(trim($message)); ?>
                </div>
            </div>
        </div>
        <?PHP } ?>
    </div>
            <div class="container_24" style="width: 1080px;">
            <?PHP
            $SelectP = $bdd->prepare('SELECT * FROM server_pictures_publish');
            $SelectP->execute();
            while ($c = $SelectP->fetch()) {
            $SelecImage = $bdd->prepare('SELECT * FROM server_pictures WHERE id = ? LIMIT 1');
            $SelecImage->execute(array($c['picture_id']));
            $D = $SelecImage->fetch();
            $a = $bdd->prepare('SELECT * FROM users WHERE id = ? LIMIT 1');
            $a->execute(array($D['user_id']));
            $z = $a->fetch();
            ?>
            <div class="grid_9">
                <div id="contentBox" class="activity" style="overflow: hidden;">
                    <div class="head">
                        <div class="badgeImage cam"></div>
                        Publiée par <?PHP echo htmlspecialchars(trim($z['username'])); ?>
                        <br>
                        <span class="date">Photo numéro <?PHP echo htmlspecialchars(trim($D['id'])); ?></span>
                    </div>
                    <img src="<?PHP echo htmlspecialchars(trim($D['url'])); ?>">
                    </div>
                </div>
            <?PHP } ?>
        </div>
        <div class="container_24">
            <div class="grid_24">
                <div id="contentBox">
                    <div class="title red">
                        <?PHP echo htmlentities(trim($cms['nom_hotel'])); ?> est propulsé par PlusCMS par Dodone.
                    </div>
                </div>
            </div>
        </div>
    </body>
</html>