From d3f5e14853e5e9690115161da1d945fad69baf94 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Cl=C3=A9ment=20Veyssi=C3=A8re?=
 <clement.veyssiere@ensiie.fr>
Date: Sun, 16 Dec 2018 19:21:57 +0100
Subject: [PATCH] CSS+login on profile page + link to influencer's website

---
 facto.php               |  6 +++---
 page_profile/profil.php | 13 +++++++------
 page_welcome/index.php  |  2 +-
 page_welcome/login.php  |  3 ++-
 4 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/facto.php b/facto.php
index e587619..1ec6330 100644
--- a/facto.php
+++ b/facto.php
@@ -61,7 +61,7 @@ function header2($where){
 		<nav class="navbar navbar-expand-lg navbar-light py-4">
 			<div class="container">
 				<h1 style="margin: auto">
-					<a class="navbar-brand" href="'.$where.'">
+					<a class="navbar-brand" href="../page_welcome/index.php">
 						<!-- <i class="fas fa-utensils"></i> -->
 						<img width="50" height="50" src="../images/ll.png" alt="logo">
 						&nbsp;Know Your Influencer
@@ -76,7 +76,7 @@ function header2($where){
 
 					<ul class="navbar-nav mx-auto text-center">
 						<li class="nav-item active">
-							<a class="nav-link" href="'.$where.'">Home
+							<a class="nav-link" href="../page_welcome/index.php">Home
 								<span class="sr-only">(current)</span>
 							</a>
 						</li>
@@ -149,7 +149,7 @@ function header2($where){
                   <label>Username</label>
                   <input type="text" name="username"/>
                   <br />
-
+                  <input type="hidden" name="back" value="'.$_SERVER["REQUEST_URI"].'"/>
                   <label>Password</label>
                   <input type="password" name="password"/>
                   <br />
diff --git a/page_profile/profil.php b/page_profile/profil.php
index 8944825..c638235 100644
--- a/page_profile/profil.php
+++ b/page_profile/profil.php
@@ -51,7 +51,7 @@ $youtube_fav = $_SESSION['youtube'];
 <?php head(); ?>
 
 <body  class="bg2">
-<?php header2('../page_welcome/index.php'); ?>
+<?php header2($_SERVER['REQUEST_URI']); ?>
 
 <div id='profile'>
 
@@ -70,12 +70,12 @@ $youtube_fav = $_SESSION['youtube'];
 					elseif ($socialNetwork === "Youtube") {
 						echo getChannelProfileImage($id);
 					}
-					?>' alt='profile_image' style="width:100px;height:100px;"/>
+					?>' alt='profile_image' style="width:100px;height:100px;border-radius:50px"/>
 					<br/>
 					<br/>
 					<?php
 					if (!$_SESSION['username']){
-						echo '<a id="modal_trigger" href="#modal">Login to add to favorites</a>';
+						echo '<div>Login to add to favorites</div>';
 					}
 					elseif ( in_array($id, $twitter_fav) || in_array($id, $youtube_fav) ){
 						echo '<button style="margin-left:10px">Subscribed</button>';
@@ -97,13 +97,13 @@ $youtube_fav = $_SESSION['youtube'];
 					?>
 			</div>
 			<br/><br/>
-			<div class='flexspace' style="padding:30px 40px 0px;border-left:1px solid;width:100%;background-image: linear-gradient(to bottom right, #919df9, #93eeff);border-radius:50px">
+			<div class='flexspace' style="margin-top:90px;margin-bottom:90px;padding:30px 40px 0px;border:1px solid;border-color: red;width:100%;background: white;border-radius:50px">
 				<div><?php echo $socialNetwork; ?> Username <br/> <h5><?php
 						if ($socialNetwork === "Twitter") {
-							echo getUserScreenName($id);
+							echo '<a href="https://twitter.com/'.getUserScreenName($id).'" target="_blank" style="color:black">'.getUserScreenName($id).'</a>';
 						}
 						elseif ($socialNetwork === "Youtube") {
-							echo getChannelUsername($id);
+							echo '<a href="https://www.youtube.com/channel/'.$id.'" target="_blank" style="color:black">'.getChannelUsername($id).'</a>';;
 						}
 					?>
 
@@ -258,6 +258,7 @@ $youtube_fav = $_SESSION['youtube'];
 </script>
 <!-- //password-script -->
 
+<script src="../js/login.js"></script>
 <!-- gallery light box -->
 <script src="../js/smoothbox.jquery2.js"></script>
 <!-- //gallery light box -->
diff --git a/page_welcome/index.php b/page_welcome/index.php
index e39f7ab..91444f9 100644
--- a/page_welcome/index.php
+++ b/page_welcome/index.php
@@ -18,7 +18,7 @@ session_start();
 ?>
 
 <body>
-	<?php header2('index.php');
+	<?php header2($_SERVER['REQUEST_URI']);
   ?>
 
   <div class="callbacks_container">
diff --git a/page_welcome/login.php b/page_welcome/login.php
index b9a0873..99344fb 100644
--- a/page_welcome/login.php
+++ b/page_welcome/login.php
@@ -15,6 +15,7 @@ if (mysqli_connect_errno()) {
 // REGISTER USER
 if (isset($_POST['login'])) {
   // receive all input values from the form
+  $back = $_POST['back'];
   $username = $_POST['username'];
   $password = $_POST['password'];
 
@@ -42,7 +43,7 @@ if ($user && count($errors) == 0) { // if user exists
 	$_SESSION['success'] = "You are now logged in";
   $_SESSION['twitter'] = unserialize($favorites['twitter']);
   $_SESSION['youtube'] = unserialize($favorites['youtube']);
-  header('location: index.php');
+  header('Location:'.$back);
 }
 // if user doesn't exist
 elseif (!$user){
-- 
GitLab