From d764fbd776c789ea4b03961c6f283fa47a5cee87 Mon Sep 17 00:00:00 2001
From: Julie Choquet <julie.choquet@ensiie.fr>
Date: Sun, 8 May 2016 13:03:16 +0200
Subject: [PATCH] affichage du profil autre user basique working

---
 Timeline/.~lock.TODO.txt#          |   1 +
 Timeline/carousel_click_profil.php |   0
 Timeline/click_profil.php          |   0
 Timeline/css/view_profil.css       |  26 +++++++
 Timeline/js/modal.js               |   2 +-
 Timeline/test.php                  |   0
 Timeline/view_profil.php           | 119 +++++++++++++++++++++++++++++
 7 files changed, 147 insertions(+), 1 deletion(-)
 create mode 100755 Timeline/.~lock.TODO.txt#
 mode change 100644 => 100755 Timeline/carousel_click_profil.php
 mode change 100644 => 100755 Timeline/click_profil.php
 create mode 100755 Timeline/css/view_profil.css
 create mode 100755 Timeline/test.php
 create mode 100755 Timeline/view_profil.php

diff --git a/Timeline/.~lock.TODO.txt# b/Timeline/.~lock.TODO.txt#
new file mode 100755
index 0000000..baf3106
--- /dev/null
+++ b/Timeline/.~lock.TODO.txt#
@@ -0,0 +1 @@
+,PC-JULIE/julie,,08.05.2016 09:06,file:///C:/Users/julie/AppData/Roaming/LibreOffice/4;
\ No newline at end of file
diff --git a/Timeline/carousel_click_profil.php b/Timeline/carousel_click_profil.php
old mode 100644
new mode 100755
diff --git a/Timeline/click_profil.php b/Timeline/click_profil.php
old mode 100644
new mode 100755
diff --git a/Timeline/css/view_profil.css b/Timeline/css/view_profil.css
new file mode 100755
index 0000000..50bb793
--- /dev/null
+++ b/Timeline/css/view_profil.css
@@ -0,0 +1,26 @@
+ul {
+  list-style-type:none;  
+}
+
+#infos {
+    margin-top : 5%;
+}
+#infos li{
+    padding :10px;
+}
+
+#infos li .etiquette{
+    font-weight :bold;
+    padding-right:3px;
+}
+
+#nav_photos li .glyphicon{
+  padding-right: 15px;
+  padding-bottom: 20px;
+}
+
+#nav_photos li {
+  font-size : 1.2em;
+  font-weight: bold;
+}
+
diff --git a/Timeline/js/modal.js b/Timeline/js/modal.js
index 1160b99..5bb45d3 100755
--- a/Timeline/js/modal.js
+++ b/Timeline/js/modal.js
@@ -43,7 +43,7 @@ $(document).ready(function (){
                             var identifiant = com[5];
                             var ext = com[6];
 
-                            var photo = '<a class="pull-left" href="#"><img class="media-object" src="users/avatar/'+identifiant+'.'+ext+'" alt="profile"></a>';
+                            var photo = '<a class="pull-left" href="view_profil.php?identifiant='+identifiant+'"><img class="media-object" src="users/avatar/'+identifiant+'.'+ext+'" alt="profile"></a>';
                             var titre = '<h4 class="media-heading text-uppercase reviews">'+surnom+'</h4><p class="media-date text-uppercase reviews ">';
                             var date = date_post+' '+heure_post2+'</p>';
                             var printContenu ='<p class="media-comment">'+contenu+'</p>';
diff --git a/Timeline/test.php b/Timeline/test.php
new file mode 100755
index 0000000..e69de29
diff --git a/Timeline/view_profil.php b/Timeline/view_profil.php
new file mode 100755
index 0000000..c1b39fe
--- /dev/null
+++ b/Timeline/view_profil.php
@@ -0,0 +1,119 @@
+<?php
+
+session_start();
+
+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 getInfosUser($db, $id) {
+
+        $stmt = $db->prepare("SELECT avatar, nom, prenom, surnom, promo, quote FROM utilisateur WHERE identifiant='$id'");
+        $stmt->bindParam(':id', $id);
+        $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)
+	      {
+
+	      	$infos = getInfosUser($DB, $idprofil);
+
+	      }
+	      $DB = null;
+
+	    }
+
+	    catch(PDOException $e){
+	      echo "Database Error";
+	    }
+
+}
+
+
+?>
+
+<!DOCTYPE html >
+<html lang="fr">
+  <head>
+    <meta charset="utf-8">
+    <title>TIMELINE</title>
+    
+    <!-- icone du titre de la page -->
+    <link rel="shortcut icon" href="fonts/icone2.jpg">
+ 
+    <!-- pour les moteurs de recherche -->
+    <meta name="description" lang="fr" content="plateforme de timeline photo pour soirée et évènement" />
+    <meta name="keywords" lang="fr" content="photos, soirée, timeline, ENSIIE, iiens" />
+
+     <!-- Latest compiled and minified CSS -->
+     <link rel="stylesheet" href="css/bootstrap.css">
+      
+     <!-- jquery -->
+     <script src="js/jquery_library.js"></script>
+
+     <!-- Latest compiled and minified JavaScript -->
+     <script src="js/bootstrap.js"></script>
+   
+
+   <!-- fichier css perso -->
+   <link rel="stylesheet" href="css/menu.css">
+   <link rel="stylesheet" href="css/view_profil.css">  
+  </head>
+
+<body>
+
+  		<?php include 'header.php'; ?>
+
+  		<div class="container-fluid">
+  			<div class="row">
+	    		<div class="col-xs-12 col-sm-6 col-lg-4">
+	    			<div class="thumbnail">
+		     			<img src="users/avatar/<?php echo $idprofil.".".$infos[0][0]; ?>" alt='avatar' > 
+					</div>
+				</div> 
+      	    	<div class="col-xs-12 col-sm-6 col-lg-4" id="infos">
+		     		<ul>
+	 		        	<li><span class="etiquette">Nom :</span><?php echo $infos[0][1]; ?></li>
+			        	<li><span class="etiquette">Prénom :</span><?php echo $infos[0][2]; ?></li>
+						<li><span class="etiquette">Surnom :</span><?php echo $infos[0][3]; ?></li>
+						<li><span class="etiquette">Promo :</span><?php echo $infos[0][4]; ?></li>
+		     		</ul> 
+				</div>
+				<blockquote class="col-xs-12" id="quote_block">
+					<?php echo $infos[0][5]; ?>
+				</blockquote>
+				
+	   		</div>
+	    
+	    	<div class="row">
+	    		<div class="col-xs-12" id="nav_photos">    
+	    			<ul>
+	    				<li><span class="glyphicon glyphicon-pushpin"></span>Ses identifications</li>
+	    				<li><span class="glyphicon glyphicon-camera"></span>Ses posts</li>
+	    				<li><span class="glyphicon  glyphicon-star"></span>Ses Wins</li>
+           			</ul>
+           		</div>
+           	</div>
+
+        </div>
+  
+ 		<?php include 'footer.php'; ?>
\ No newline at end of file
-- 
GitLab