Index Page – Logged In


This is the index page when the user is logged in. Everything is the same apart from the the sign up page is obviously removed and the other features are in the navigation bar such as the profile tab, find a match tab and finally the logout button which are all included within the dropdown menu. The login and logout button also needed a php page within javascript. Once again this information is grabbed through a query from PHPmyadmin when the user registered and then will once again give a message if the user successfully logged in or not.

<p style="text-align: center;"></p>
if(isset($_POST["login"])) {

$username = $_POST["username"];
$password = $_POST["password"];

$query = "SELECT * FROM users WHERE username='{$username}' AND password='{$password}' LIMIT 1";

$result = mysqli_query($connection, $query);

if($user = mysqli_fetch_assoc($result)) {

$_SESSION["message"] = "Success, Welcome back {$user["username"]}";
$_SESSION["username"] = $user["username"];
$_SESSION["user_id"] = $user["id"];

} else {

$_SESSION["message"] = "Either your username or password is incorrect";
<p style="text-align: center;">

The logout was very simple in that the user is simply directed back to the index page (index.php).

<p style="text-align: center;"></p>

<p style="text-align: center;">

We also wanted to fill in the empty space we had below the Welcome message and decided after looking at other websites that we would use a carousel to display different images of couples and how our website “helped them find a partner”. The code below is for the carousel.

&lt;?php if(isset($_SESSION[&quot;username&quot;])) { ?&gt;
&lt;div id=&quot;myCarousel&quot; class=&quot;carousel slide&quot; data-ride=&quot;carousel&quot;&gt;

&lt;div class=&quot;carousel-inner&quot; role=&quot;listbox&quot;&gt;
&lt;div class=&quot;item active&quot;&gt;
&lt;img src=&quot;images/liamquote.jpg&quot; alt=&quot;Chania&quot;&gt;

&lt;div class=&quot;item&quot;&gt;
&lt;img src=&quot;images/dom.jpg&quot; alt=&quot;Chania&quot;&gt;

&lt;div class=&quot;item&quot;&gt;
&lt;img src=&quot;images/callumquote.jpg&quot; alt=&quot;Flower&quot;&gt;

&lt;div class=&quot;item&quot;&gt;
&lt;img src=&quot;images/watsonquote.jpg&quot; alt=&quot;Flower&quot;&gt;

&lt;a class=&quot;left carousel-control&quot; href=&quot;#myCarousel&quot; role=&quot;button&quot; data-slide=&quot;prev&quot;&gt;
&lt;span class=&quot;glyphicon glyphicon-chevron-left&quot; aria-hidden=&quot;true&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;sr-only&quot;&gt;Previous&lt;/span&gt;
&lt;a class=&quot;right carousel-control&quot; href=&quot;#myCarousel&quot; role=&quot;button&quot; data-slide=&quot;next&quot;&gt;
&lt;span class=&quot;glyphicon glyphicon-chevron-right&quot; aria-hidden=&quot;true&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;sr-only&quot;&gt;Next&lt;/span&gt;
&lt;?php } ?&gt;
&lt;p style=&quot;text-align: left;&quot;&gt;


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s