Index Page – Logged In

loggedin2

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.

</pre>
<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"];

redirectTo("profile.php");
} else {

$_SESSION["message"] = "Either your username or password is incorrect";
}
redirectTo("index.php");
<p style="text-align: center;">

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

</pre>
<p style="text-align: center;"></p>
<?php
require_once("../includes/session.php");
require_once("../includes/functions.php");
session_destroy();

redirectTo("index.php");
?>
<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;/pre&gt;
&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&gt;

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

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

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


&lt;/div&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&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;/a&gt;
&lt;/div&gt;
&lt;?php } ?&gt;
&lt;p style=&quot;text-align: left;&quot;&gt;

Advertisements

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s