Made things look a little nicer

This commit is contained in:
William Miceli
2019-12-03 22:24:42 -05:00
parent dff8bd9306
commit 4139767a22
14 changed files with 77 additions and 70 deletions

View File

@@ -7,9 +7,9 @@ service mysql start
echo "[ INFO ] Starting PHP 7.2 Service" echo "[ INFO ] Starting PHP 7.2 Service"
service php7.2-fpm start service php7.2-fpm start
# Running friendBook database setup script # Running friendbook database setup script
echo "[ INFO ] Setting up friendBook database" echo "[ INFO ] Setting up friendbook database"
mysql -u root < /scripts/friendBook.sql mysql -u root < /scripts/friendbook.sql
echo "[ INFO ] Starting nginx" echo "[ INFO ] Starting nginx"
nginx -g "daemon off;" # Foreground nginx -g "daemon off;" # Foreground

View File

@@ -1,4 +1,4 @@
USE friendBook; USE friendbook;
CREATE TABLE login( CREATE TABLE login(
username varchar(25), username varchar(25),

View File

@@ -13,7 +13,7 @@ EOF
# Setting up the basics # Setting up the basics
mysql -u root << EOF mysql -u root << EOF
CREATE USER 'web'@'localhost' IDENTIFIED BY 'Password456'; CREATE USER 'web'@'localhost' IDENTIFIED BY 'Password456';
CREATE DATABASE friendBook; CREATE DATABASE friendbook;
GRANT ALL PRIVILEGES ON friendBook . * TO 'web'@'localhost'; GRANT ALL PRIVILEGES ON friendbook . * TO 'web'@'localhost';
FLUSH PRIVILEGES; FLUSH PRIVILEGES;
EOF EOF

4
var/www/common.php Normal file
View File

@@ -0,0 +1,4 @@
<?php
session_start();
require 'db_connection.php';
?>

View File

@@ -1,6 +1,6 @@
<?php <?php
$db_server = "localhost"; $db_server = "localhost";
$db_name = "friendBook"; $db_name = "friendbook";
$db_username = "web"; $db_username = "web";
$db_password = "Password456"; $db_password = "Password456";

View File

@@ -1,21 +1,17 @@
<?php <?php
session_start(); require 'common.php';
require 'db_connection.php';
?> ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head> <head>
<title>FriendBook Friends</title> <title>friendbook Friends</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/> <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<link rel="stylesheet" type="text/css" href="styling.css">
</head> </head>
<body> <body>
<style> <!--#include virtual="header.html" -->
body { <!--#include virtual="topNavBar.html" -->
background-color: #3B5998;
color: white;
}
</style>
<?php <?php
try{ try{
echo '<pre>'; echo '<pre>';

5
var/www/header.html Normal file
View File

@@ -0,0 +1,5 @@
<svg height="45" width="100%">
<a xlink:href="#">
<text x="45%" y="40" font-size="40" fill="white">friendbook</text>
</a>
</svg>

After

Width:  |  Height:  |  Size: 144 B

View File

@@ -1,7 +1,7 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head> <head>
<title>FriendBook</title> <title>friendbook</title>
<meta http-equiv="content-type" <meta http-equiv="content-type"
content="text/html; charset=utf-8"/> content="text/html; charset=utf-8"/>
</head> </head>
@@ -11,7 +11,7 @@
background-color: #3B5998; background-color: #3B5998;
} }
</style> </style>
<h2><font color="white">Friendbook</h2> <h2><font color="white">friendbook</h2>
<button type="button" onclick="window.location.href = '/friends.html'">See Friends</button> <button type="button" onclick="window.location.href = '/friends.html'">See Friends</button>
<br><br> <br><br>

View File

@@ -1,6 +1,5 @@
<?php <?php
session_start(); require 'common.php';
require 'db_connection.php';
try{ try{
if($_POST['login_username'] != '' && $_POST['login_password'] != ''){ if($_POST['login_username'] != '' && $_POST['login_password'] != ''){
@@ -15,17 +14,17 @@
$_SESSION['loggedInUser'] = $_POST['login_username']; $_SESSION['loggedInUser'] = $_POST['login_username'];
unset($_SESSION['loginError']); unset($_SESSION['loginError']);
// Move onto landing page // Move onto landing page
// header('Location: /landingPage.html'); // header('Location: /landingPage.html');
}else{ }else{
// No matching users found, send user error // No matching users found, send user error
$_SESSION['loginError'] = 'Invalid Username or Password'; $_SESSION['loginError'] = 'Invalid Username or Password';
// Return to login page // Return to login page
// header("Location: /login.php"); // header("Location: /login.php");
} }
}else{ }else{
// Return to login page, as credentials were not captured // Return to login page, as credentials were not captured
$_SESSION["loginError"] = "Username and Password are required, please try again"; $_SESSION["loginError"] = "Username and Password are required, please try again";
// header("Location: /login.php"); // header("Location: /login.php");
} }
}catch(PDOException $e){ }catch(PDOException $e){
echo "PDOException: ".$e->getMessage(); echo "PDOException: ".$e->getMessage();
@@ -37,16 +36,12 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head> <head>
<title>FriendBook Login</title> <title>friendbook Login</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/> <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<link rel="stylesheet" type="text/css" href="styling.css">
</head> </head>
<body> <body>
<style> <!--#include virtual="header.html" -->
body {
background-color: #3B5998;
color: white;
}
</style>
<div class="message"> <div class="message">
<p><?php if($_SESSION['loginError']!=""){ echo $_SESSION['loginError']; } ?></p> <p><?php if($_SESSION['loginError']!=""){ echo $_SESSION['loginError']; } ?></p>
</div> </div>

View File

@@ -1,27 +1,25 @@
<?php <?php
session_start(); require 'common.php';
unset($_SESSION['loggedInUser']);
?> ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head> <head>
<title>FriendBook Logout</title> <title>friendbook Logout</title>
<meta http-equiv="content-type" <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
content="text/html; charset=utf-8"/> <link rel="stylesheet" type="text/css" href="styling.css">
</head> </head>
<body> <body>
<!--#include virtual="header.html" -->
<?php <div class="message">
session_unset(); // remove all session variables <p>You have been logged out.</p>
session_destroy(); // destroy the session <p>Thank you for using friendbook!</p>
?> <br /><br />
<a href="/login.php" class="button">Login again?</a>
<style> </div>
body {
background-color: #3B5998;
}
</style>
<h2><font color="white">You have been successfully logged out.</h2>
<button type="button" onclick="window.location.href = 'friends.html'">Login again? (FIXME)</button>
</body> </body>
</html> </html>
<?php
$db_connection = null;
?>

View File

@@ -1,22 +1,16 @@
<?php <?php
session_start(); require 'common.php';
require 'db_connection.php';
?> ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head> <head>
<title>FriendBook Messages</title> <title>friendbook Messages</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/> <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<link rel="stylesheet" type="text/css" href="styling.css"> <link rel="stylesheet" type="text/css" href="styling.css">
</head> </head>
<body> <body>
<style> <!--#include virtual="header.html" -->
body {
background-color: #3B5998;
color: white;
}
</style>
<!--#include virtual="topNavBar.html" --> <!--#include virtual="topNavBar.html" -->
<?php <?php
try{ try{

View File

@@ -7,7 +7,7 @@ body
background-color: #3B5998; background-color: #3B5998;
} }
</style> </style>
<h2><font color="white">Friendbook</h2> <h2><font color="white">friendbook</h2>
<?php <?php

View File

@@ -1,16 +1,31 @@
body {
background-color: #3B5998;
color: white;
}
.button a {
/* font: bold 11px Arial;*/
text-decoration: none;
background-color: #EEEEEE;
color: #333333;
padding: 2px 6px 2px 6px;
border-top: 1px solid #CCCCCC;
border-right: 1px solid #333333;
border-bottom: 1px solid #333333;
border-left: 1px solid #CCCCCC;
}
.topNavBar { .topNavBar {
background-color: #333; background-color: rgb(236, 236, 236);
overflow: hidden; overflow: hidden;
} }
.topNavBar a { .topNavBar a {
float: left; float: left;
color: #f2f2f2; color: #363636;
text-align: center; text-align: center;
padding: 14px 16px; padding: 14px 16px;
text-decoration: none; text-decoration: none;
font-size: 17px; font-size: 17px;
} }
.topNavBar a:hover { .topNavBar a:hover {
background-color: #ddd; background-color: rgb(44, 48, 255);
color: black; color: rgb(255, 255, 255);
} }

View File

@@ -1,10 +1,10 @@
<div class="topNavBar"> <div class="topNavBar">
<a href="/friends.php">See Friends</a> <a href="/friends.php">See Friends</a>
<a href="messages.php">See Messages</a> <a href="/messages.php">See Messages</a>
<a href="search.php">Search</a> <a href="/search.php">Search</a>
<a href="sendMessage.php">Message Someone</a> <a href="/sendMessage.php">Message Someone</a>
<a href="findFriend.html">Find a New Friend</a> <a href="/findFriend.html">Find a New Friend</a>
<a href="pendingFriend.html">Check Pending Friends</a> <a href="/pendingFriend.html">Check Pending Friends</a>
<!--Maybe show the user's name here?--> <!--Maybe show the user's name here?-->
<a href="#" style="float:right">Logout</a> <a href="/logout.php" style="float:right">Logout</a>
</div> </div>