Skip to content
Extraits de code Groupes Projets
Valider d4baf78f rédigé par Julie Choquet's avatar Julie Choquet
Parcourir les fichiers

voir les posts d'un autre user ok

parent 6f9be19a
Branches
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -25,6 +25,7 @@ TO DO : ...@@ -25,6 +25,7 @@ TO DO :
- click photo utilisateur -> affichage profil - click photo utilisateur -> affichage profil
- ses wins - ses wins
- ses machins blabla - ses machins blabla
- replacer mon profil les champs quote et surnom par l'actuel
TO DO LATER : TO DO LATER :
- boutons j'aime, vote, et ajout commentaire sur click photo - boutons j'aime, vote, et ajout commentaire sur click photo
......
...@@ -111,7 +111,7 @@ ...@@ -111,7 +111,7 @@
<div class="row"> <div class="row">
<div class="col-sm-3 col-md-2 sidebar"> <div class="col-sm-3 col-md-2 sidebar">
<div class="thumbnail"> <div class="thumbnail">
<img alt="profil" src=<?php echo $avatar; ?> /> <a href="view_profil.php?identifiant=<?php echo $id; ?>" ><img alt="profil" src=<?php echo $avatar; ?> /></a>
<div class="caption"> <div class="caption">
<p> <?php echo $msg; ?></p> <p> <?php echo $msg; ?></p>
</div> </div>
......
<?php <?php
session_start(); session_start();
$id = $_SESSION['login'];
function checkIdentifiantUser($db,$id){ function checkIdentifiantUser($db,$id){
...@@ -83,6 +84,7 @@ if(isset($_GET['identifiant'])) ...@@ -83,6 +84,7 @@ if(isset($_GET['identifiant']))
<?php include 'header.php'; ?> <?php include 'header.php'; ?>
<?php if($id == $idprofil) { echo '<h1 class="page-header">Votre profil, vu par les autres</h1>'; } ?>
<div class="container-fluid"> <div class="container-fluid">
<div class="row"> <div class="row">
<div class="col-xs-12 col-sm-6 col-lg-4"> <div class="col-xs-12 col-sm-6 col-lg-4">
......
<?php <?php
session_start(); session_start();
$id = $_SESSION['login'];
function checkIdentifiantUser($db,$id){
/* On prépare la requête pour éviter les injections SQL */
$stmt = $db->prepare("SELECT COUNT(*) FROM utilisateur WHERE identifiant=:id");
$stmt->bindParam(':id', $id);
$stmt->execute();
return $stmt->fetchColumn();
}
?> ?>
......
...@@ -2,6 +2,77 @@ ...@@ -2,6 +2,77 @@
session_start(); session_start();
include 'carousel.php';
$id = $_SESSION['login'];
function checkIdentifiantUser($db,$id){
/* On prépare la requête pour éviter les injections SQL */
$stmt = $db->prepare("SELECT COUNT(*) FROM utilisateur WHERE identifiant=:id");
$stmt->bindParam(':id', $id);
$stmt->execute();
return $stmt->fetchColumn();
}
function surnomUser($db, $id) {
$stmt = $db->prepare("SELECT surnom FROM utilisateur WHERE identifiant=:id");
$stmt->bindParam(':id', $id);
$stmt->setFetchMode(PDO::FETCH_OBJ);
$stmt->execute();
$stmt = $stmt->fetch();
return $stmt->surnom;
}
function getPhotosSesPosts($db, $idprofil) {
$stmt = $db->prepare("SELECT soiree.annee, soiree.name, photo.idphoto, photo.extension, photo.composteur, soiree.theme, soiree.idsoiree FROM photo INNER JOIN soiree ON photo.idsoiree=soiree.idsoiree WHERE photo.idposteur=:id");
$stmt->bindParam(':id', $idprofil);
$stmt->execute();
$stmt->setFetchMode(PDO::FETCH_NUM);
$result = $stmt->fetchAll();
return $result;
}
if(isset($_GET['identifiant']))
{
/* On vérifie que l'identifiant existe avec une requete préparée sinon page d'acceuil logout */
$idprofil = $_GET['identifiant'];
try{
$DB = new PDO("pgsql:host=localhost;dbname=projet_web", "postgres", "root");
if(checkIdentifiantUser($DB,$idprofil) == 1)
{
if($id == $idprofil)
{
header('location: mes_posts.php');
}
else
{
$tabPhotos = getPhotosSesPosts($DB, $idprofil);
$surnom = surnomUser($DB, $idprofil);
}
}
$DB = null;
}
catch(PDOException $e){
echo "Database Error";
}
}
?> ?>
...@@ -28,11 +99,37 @@ session_start(); ...@@ -28,11 +99,37 @@ session_start();
<script src="js/bootstrap.js"></script> <script src="js/bootstrap.js"></script>
<!-- Js carousel -->
<script src="js/carousel.js"></script>
<script type="text/javascript" src="js/modal.js"></script>
<!-- fichier css perso --> <!-- fichier css perso -->
<link rel="stylesheet" href="css/menu.css"> <link rel="stylesheet" href="css/menu.css">
<link rel="stylesheet" href="css/view_profil_post.css"> <link rel="stylesheet" href="css/mes_posts.css">
<link rel="stylesheet" type="text/css" href="css/modal.css">
</head> </head>
<body> <body>
<?php include 'header.php'; ?> <?php include 'header.php'; ?>
<h3 class="page-header">Posts de <?php echo $surnom; ?></h3>
<?php
if($tabPhotos)
{
carousel($tabPhotos,1);
}
else
{
echo "<div class='container-fluid'>";
echo "<p class='nothing'>Cette tanche n'a encore rien posté !<p>";
echo '</div>';
}
?>
<?php include 'modal.php'; ?>
<?php include 'footer.php'; ?>
\ No newline at end of file
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter