From b819e9f10f8fec2e85e634403570abbbc8a64c71 Mon Sep 17 00:00:00 2001 From: William Miceli <1-WilliamMiceli@git.williammiceli.systems> Date: Thu, 21 Nov 2019 18:25:56 -0500 Subject: [PATCH 01/70] Update Dockerfile --- Dockerfile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Dockerfile b/Dockerfile index b5f5408..72ff19b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -23,6 +23,9 @@ COPY /entrypoint.sh / # Copying in web files COPY /var/www/ /var/www/ +# Setting up the database tables +RUN mysql -u root friendbook < initialization.sql + # Expose Insecure Web, MySQL Server EXPOSE 80 3306 CMD ["/bin/sh", "/entrypoint.sh"] \ No newline at end of file From 69c610fe15eff7d25cef8fa77674aa8c7c2efced Mon Sep 17 00:00:00 2001 From: WilliamMiceli Date: Thu, 21 Nov 2019 18:33:32 -0500 Subject: [PATCH 02/70] Added Traefik labels just in case it's needed later; note about public hosting --- README.md | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 0e3750a..71edf03 100644 --- a/README.md +++ b/README.md @@ -13,5 +13,23 @@ - Will be using `mysql_secure_installation --use-default`, for now as I can't find what the defaults actually are. - [https://dev.mysql.com/doc/refman/5.7/en/mysql-secure-installation.html] - Use `nginx -s reload` to reload the web server's configurations +- I (William) will host an instance at [friends.proxy0.williammiceli.io] that is publically accessible for testing. If anyone wants me to change the version/image used, just let me know. -##hello +#### Traefik Configuration Labels + +` +traefik.enable: true +traefik.http.routers.CS4430-Project-router-http.entrypoints: http +traefik.http.routers.CS4430-Project-router-http.rule: Host(`friends.proxy0.williammiceli.io`) +traefik.http.routers.CS4430-Project-router-http.middlewares: CS4430-Project-redirectHttp +traefik.http.routers.CS4430-Project-router-http.service: CS4430-Project-service-http +traefik.http.routers.CS4430-Project-router-https.entrypoints: https +traefik.http.routers.CS4430-Project-router-https.rule: Host(`friends.proxy0.williammiceli.io`) +traefik.http.routers.CS4430-Project-router-https.tls: true +traefik.http.routers.CS4430-Project-router-https.tls.certresolver: letsencrypt +traefik.http.routers.CS4430-Project-router-https.service: CS4430-Project-service-http +traefik.http.middlewares.CS4430-Project-redirectHttp.redirectscheme.permanent: true +traefik.http.middlewares.CS4430-Project-redirectHttp.redirectscheme.scheme: https +traefik.http.services.CS4430-Project-service-http.loadbalancer.passhostheader: true +traefik.http.services.CS4430-Project-service-http.loadbalancer.server.port: "80" +` \ No newline at end of file From 41217d3746e2538ad2de1801b36cd46ec4d59408 Mon Sep 17 00:00:00 2001 From: WilliamMiceli Date: Thu, 21 Nov 2019 18:39:11 -0500 Subject: [PATCH 03/70] index.php no longer used --- etc/nginx/conf.d/cs4430.conf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/etc/nginx/conf.d/cs4430.conf b/etc/nginx/conf.d/cs4430.conf index 8e93695..4c0311c 100644 --- a/etc/nginx/conf.d/cs4430.conf +++ b/etc/nginx/conf.d/cs4430.conf @@ -3,14 +3,14 @@ server { listen [::]:80; root /var/www/; - index index.html index.php; + index index.html server_name _; access_log /var/log/nginx/access.log; error_log /var/log/nginx/error.log; location / { - try_files $uri $uri/ /index.php /index.html =404; + try_files $uri $uri/ /index.html =404; } location ~ \.php$ { From 3a1c990308633c2d683e36e32380f881460f259b Mon Sep 17 00:00:00 2001 From: WilliamMiceli Date: Thu, 21 Nov 2019 18:39:37 -0500 Subject: [PATCH 04/70] Merged langingPage.html into index.html --- var/www/index.html | 36 +++++++++++++++++++++++------------- var/www/landingPage.html | 21 --------------------- 2 files changed, 23 insertions(+), 34 deletions(-) delete mode 100644 var/www/landingPage.html diff --git a/var/www/index.html b/var/www/index.html index 0946be0..aef7256 100644 --- a/var/www/index.html +++ b/var/www/index.html @@ -1,16 +1,26 @@ - - + + - Today’s Date + FriendBook + content="text/html; charset=utf-8"/> - -

Today’s date (according to this web server) is - -

- - \ No newline at end of file + + +

Friendbook

+ + + + + + + + + + + + diff --git a/var/www/landingPage.html b/var/www/landingPage.html deleted file mode 100644 index dcc5955..0000000 --- a/var/www/landingPage.html +++ /dev/null @@ -1,21 +0,0 @@ - - - - -

Friendbook

- - - - - - - - - - - - From 91918c2f19e984d4a014f6029aafe27292f5e44b Mon Sep 17 00:00:00 2001 From: WilliamMiceli Date: Thu, 21 Nov 2019 18:40:02 -0500 Subject: [PATCH 05/70] Disabled SQL database initialization until it's ready --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 72ff19b..535e2df 100644 --- a/Dockerfile +++ b/Dockerfile @@ -24,7 +24,7 @@ COPY /entrypoint.sh / COPY /var/www/ /var/www/ # Setting up the database tables -RUN mysql -u root friendbook < initialization.sql +#RUN mysql -u root friendbook < initialization.sql # Expose Insecure Web, MySQL Server EXPOSE 80 3306 From 325e9a1ed225b6958d585b70f763d3f17d16b282 Mon Sep 17 00:00:00 2001 From: WilliamMiceli Date: Thu, 21 Nov 2019 18:48:02 -0500 Subject: [PATCH 06/70] Updated with page responsibilities --- README.md | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 71edf03..41e59da 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,24 @@ [https://www.sitepoint.com/mysql-3-getting-started-php/] [https://www.sitepoint.com/publishing-mysql-data-web/] -#### Notes +## Page Responsibilities + +### Bryan + +- "Search" `search.html` +- "Message Someone" `sendMessage.html` + +### Logan + +- "Find a New Friend" `findFriend.html` +- "Check Pending Friends" `pendingFriend.html` + +### William + +- "See Messages" `messages.html` +- "See Friends" `friends.html` + +## Notes - Can use `ps waux | grep nginx` to check if the NGINX service is running - MySQL's documentation sucks. @@ -15,7 +32,7 @@ - Use `nginx -s reload` to reload the web server's configurations - I (William) will host an instance at [friends.proxy0.williammiceli.io] that is publically accessible for testing. If anyone wants me to change the version/image used, just let me know. -#### Traefik Configuration Labels +### Traefik Configuration Labels ` traefik.enable: true From 12a7b164539760a3151b1826a85749e508e3afca Mon Sep 17 00:00:00 2001 From: WilliamMiceli Date: Thu, 21 Nov 2019 18:49:17 -0500 Subject: [PATCH 07/70] Fixed code block --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 41e59da..e0f22f4 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ ### Traefik Configuration Labels -` +``` traefik.enable: true traefik.http.routers.CS4430-Project-router-http.entrypoints: http traefik.http.routers.CS4430-Project-router-http.rule: Host(`friends.proxy0.williammiceli.io`) @@ -49,4 +49,4 @@ traefik.http.middlewares.CS4430-Project-redirectHttp.redirectscheme.permanent: t traefik.http.middlewares.CS4430-Project-redirectHttp.redirectscheme.scheme: https traefik.http.services.CS4430-Project-service-http.loadbalancer.passhostheader: true traefik.http.services.CS4430-Project-service-http.loadbalancer.server.port: "80" -` \ No newline at end of file +``` \ No newline at end of file From fc37a58fb50d550764a731d7fce84f60a0a9658a Mon Sep 17 00:00:00 2001 From: WilliamMiceli Date: Thu, 21 Nov 2019 18:50:05 -0500 Subject: [PATCH 08/70] Fixed link --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e0f22f4..313d880 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ - Will be using `mysql_secure_installation --use-default`, for now as I can't find what the defaults actually are. - [https://dev.mysql.com/doc/refman/5.7/en/mysql-secure-installation.html] - Use `nginx -s reload` to reload the web server's configurations -- I (William) will host an instance at [friends.proxy0.williammiceli.io] that is publically accessible for testing. If anyone wants me to change the version/image used, just let me know. +- I (William) will host an instance at [https://friends.proxy0.williammiceli.io/] that is publically accessible for testing. If anyone wants me to change the version/image used, just let me know. ### Traefik Configuration Labels From 1e17adea0ecae2a5cd4d75bd1085f73c9463d735 Mon Sep 17 00:00:00 2001 From: Logan McInnis Date: Thu, 21 Nov 2019 18:51:00 -0500 Subject: [PATCH 09/70] Update search.html --- var/www/search.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/var/www/search.html b/var/www/search.html index cd8391e..6754a05 100644 --- a/var/www/search.html +++ b/var/www/search.html @@ -9,7 +9,7 @@ body {

Who Would you like to search for

-Search By Number
+Search By Username
Search By Name
+

+ + + +"; +echo $message; +echo "
"; +?> + + + + + From 70373d14536a94c6b8d4480f40646f55a62a1a07 Mon Sep 17 00:00:00 2001 From: William Miceli Date: Mon, 25 Nov 2019 01:26:53 -0500 Subject: [PATCH 57/70] Fixed missing end tag; page works again --- var/www/phptest.php | 1 + 1 file changed, 1 insertion(+) diff --git a/var/www/phptest.php b/var/www/phptest.php index 507e96b..9ffb6a9 100644 --- a/var/www/phptest.php +++ b/var/www/phptest.php @@ -6,6 +6,7 @@ $password = "Password456"; // Current user $user = "William"; // Testing with until we have login working +?> From 235c55285d67c21df089bf2fcb8be7ee53bfc74a Mon Sep 17 00:00:00 2001 From: Bryan Date: Mon, 25 Nov 2019 03:17:21 -0500 Subject: [PATCH 58/70] fixing the search, now does it for full name or username, not complete just yet --- var/www/nameSearch.php | 8 +++++++ var/www/search.php | 47 +++++++++++++++++++++++--------------- var/www/usernameSearch.php | 7 ++++++ 3 files changed, 44 insertions(+), 18 deletions(-) create mode 100644 var/www/nameSearch.php create mode 100644 var/www/usernameSearch.php diff --git a/var/www/nameSearch.php b/var/www/nameSearch.php new file mode 100644 index 0000000..2a73f98 --- /dev/null +++ b/var/www/nameSearch.php @@ -0,0 +1,8 @@ + + + +First Name is
+Last Name is + + + diff --git a/var/www/search.php b/var/www/search.php index 7f6be88..a16288f 100644 --- a/var/www/search.php +++ b/var/www/search.php @@ -10,21 +10,24 @@ body {

Who would you like to search for

-
"> - Which Search: - value="type">Name - value="type">Username -

- Search Key:
-

- - + +Username:

+
+
+
+First Name:
+Last Name:
+ +
+ + + +" +?> + diff --git a/var/www/usernameSearch.php b/var/www/usernameSearch.php new file mode 100644 index 0000000..124f6a7 --- /dev/null +++ b/var/www/usernameSearch.php @@ -0,0 +1,7 @@ + + + +Username is + + + From b90e6961def7f7e56bcfe1317d2fee7625402d79 Mon Sep 17 00:00:00 2001 From: Bryan Date: Mon, 25 Nov 2019 03:25:08 -0500 Subject: [PATCH 59/70] Deleting the unused html files --- var/www/search.html | 25 ------------------------- var/www/sendMessage.html | 14 -------------- 2 files changed, 39 deletions(-) delete mode 100644 var/www/search.html delete mode 100644 var/www/sendMessage.html diff --git a/var/www/search.html b/var/www/search.html deleted file mode 100644 index 6754a05..0000000 --- a/var/www/search.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - -

Who Would you like to search for

- -Search By Username
-Search By Name
- - - -
-
- -
- - - - diff --git a/var/www/sendMessage.html b/var/www/sendMessage.html deleted file mode 100644 index dc9a9a2..0000000 --- a/var/www/sendMessage.html +++ /dev/null @@ -1,14 +0,0 @@ - - - - - -

Heres where you send your dumbass messages

- - - - From 3a7e7ced94066cf1aa1522801f2713fa8d8f3e51 Mon Sep 17 00:00:00 2001 From: Bryan Date: Mon, 25 Nov 2019 03:30:23 -0500 Subject: [PATCH 60/70] Cosmetic fix for the search site --- var/www/search.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/var/www/search.php b/var/www/search.php index a16288f..963b35f 100644 --- a/var/www/search.php +++ b/var/www/search.php @@ -7,7 +7,7 @@ body { } -

Who would you like to search for

+

Search by



+

Or

First Name:
Last Name:
From f1fcba3e83dfd4c15515e895203bc62b52cc1553 Mon Sep 17 00:00:00 2001 From: William Miceli Date: Mon, 25 Nov 2019 04:31:19 -0500 Subject: [PATCH 61/70] User authentication setup - first test --- var/www/login.php | 28 ++++++++++++++++++++++++++++ var/www/loginCheck.php | 39 +++++++++++++++++++++++++++++++++++++++ var/www/logout.php | 27 +++++++++++++++++++++++++++ var/www/phptest.php | 12 ++++++++++-- 4 files changed, 104 insertions(+), 2 deletions(-) create mode 100644 var/www/login.php create mode 100644 var/www/loginCheck.php create mode 100644 var/www/logout.php diff --git a/var/www/login.php b/var/www/login.php new file mode 100644 index 0000000..82554d2 --- /dev/null +++ b/var/www/login.php @@ -0,0 +1,28 @@ + + + + + + FriendBook Login + + + + +
+

Please Login

+ + User: +
+ Password: +
+ + + + diff --git a/var/www/loginCheck.php b/var/www/loginCheck.php new file mode 100644 index 0000000..f479258 --- /dev/null +++ b/var/www/loginCheck.php @@ -0,0 +1,39 @@ +setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); + echo "Connected successfully"; + if(count($_POST) > 0){ + $matchingUsers = $connection->query("SELECT COUNT(*) FROM login WHERE username = '".$_POST["Username"]."' and pword = '".$_POST["Password"]."'"); + if($matchingUsers > 0){ + // User has been authenticated; set user as logged in + $_SESSION["loggedInUser"] = "".$_POST["Username"].""; + $_SESSION["loginError"] = ""; + // Move onto landing page + header("Location: /landingPage.html"); + die(); + }else{ + // No matching users found, send user error + $_SESSION["loginError"] = "Invalid Username or Password"; + // Return to login page + header("Location: /login.php"); + die(); + } + }else{ + // Return to login page, as credentials were not captured + $_SESSION["loginError"] = "Login credentials not found, please try again"; + header("Location: /login.php"); + die(); + } +} +catch(PDOException $e){ + echo "Error: " . $e->getMessage(); +} +?> \ No newline at end of file diff --git a/var/www/logout.php b/var/www/logout.php new file mode 100644 index 0000000..3b7c9d9 --- /dev/null +++ b/var/www/logout.php @@ -0,0 +1,27 @@ + + + + + + FriendBook Logout + + + + + + + +

You have been successfully logged out.

+ + + diff --git a/var/www/phptest.php b/var/www/phptest.php index 9ffb6a9..4ba50ac 100644 --- a/var/www/phptest.php +++ b/var/www/phptest.php @@ -1,4 +1,6 @@ -

PHP Test Page - Connecting to MySQL

+

PHP Test Page

+ +

Connecting to MySQL

+

PHP Session Info

+ \ No newline at end of file From 1431c5273a81c393872a974ac9f0e05f604635cf Mon Sep 17 00:00:00 2001 From: William Miceli Date: Mon, 25 Nov 2019 05:57:33 -0500 Subject: [PATCH 62/70] Indentation --- var/www/login.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/var/www/login.php b/var/www/login.php index 82554d2..8d23141 100644 --- a/var/www/login.php +++ b/var/www/login.php @@ -1,5 +1,5 @@ From acc4dcb4eca39ed84271899e62128c7bd892c19a Mon Sep 17 00:00:00 2001 From: William Miceli Date: Mon, 25 Nov 2019 05:57:54 -0500 Subject: [PATCH 63/70] Indentation fix --- var/www/loginCheck.php | 61 +++++++++++++++++++++--------------------- 1 file changed, 31 insertions(+), 30 deletions(-) diff --git a/var/www/loginCheck.php b/var/www/loginCheck.php index f479258..982d862 100644 --- a/var/www/loginCheck.php +++ b/var/www/loginCheck.php @@ -1,39 +1,40 @@ setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); - echo "Connected successfully"; - if(count($_POST) > 0){ - $matchingUsers = $connection->query("SELECT COUNT(*) FROM login WHERE username = '".$_POST["Username"]."' and pword = '".$_POST["Password"]."'"); - if($matchingUsers > 0){ - // User has been authenticated; set user as logged in - $_SESSION["loggedInUser"] = "".$_POST["Username"].""; - $_SESSION["loginError"] = ""; - // Move onto landing page - header("Location: /landingPage.html"); - die(); + try{ + $connection = new PDO("mysql:host=$server;dbname=$database", $username, $password); + $connection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); + echo "Connected successfully"; + if(count($_POST) > 0){ + $matchingUsers = $connection->query("SELECT COUNT(*) FROM login WHERE username = '".$_POST["Username"]."' and pword = '".$_POST["Password"]."'"); + if($matchingUsers > 0){ + // User has been authenticated; set user as logged in + $_SESSION["loggedInUser"] = "".$_POST["Username"].""; + $_SESSION["loginError"] = ""; + // Move onto landing page + header("Location: /landingPage.html"); + die(); + }else{ + // No matching users found, send user error + $_SESSION["loginError"] = "Invalid Username or Password"; + // Return to login page + header("Location: /login.php"); + die(); + } }else{ - // No matching users found, send user error - $_SESSION["loginError"] = "Invalid Username or Password"; - // Return to login page + // Return to login page, as credentials were not captured + $_SESSION["loginError"] = "Login credentials not found, please try again"; header("Location: /login.php"); die(); } - }else{ - // Return to login page, as credentials were not captured - $_SESSION["loginError"] = "Login credentials not found, please try again"; - header("Location: /login.php"); - die(); } -} -catch(PDOException $e){ - echo "Error: " . $e->getMessage(); -} + catch(PDOException $e){ + echo "Error: " . $e->getMessage(); + } + $connection = null; ?> \ No newline at end of file From e975293caba8d28ed649d76c84863c4aaa67c460 Mon Sep 17 00:00:00 2001 From: William Miceli Date: Mon, 25 Nov 2019 06:06:27 -0500 Subject: [PATCH 64/70] Lots and lots of stuff... --- var/www/phptest.php | 80 ++++++++++++++++++++++++++------------------- 1 file changed, 47 insertions(+), 33 deletions(-) diff --git a/var/www/phptest.php b/var/www/phptest.php index 4ba50ac..7a3066f 100644 --- a/var/www/phptest.php +++ b/var/www/phptest.php @@ -1,13 +1,10 @@ @@ -15,35 +12,52 @@ $user = "William"; // Testing with until we have login working

PHP Test Page

- -

Connecting to MySQL

+

MySQL

+ +

Creating Connection

setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); - echo "Connected successfully"; - } - catch(PDOException $e){ - echo "Connection failed: " . $e->getMessage(); - } - - $sql = "SELECT messageID, date, message - FROM messages - WHERE recipient=$user"; - foreach($connection->query($sql) as $row){ - print $row['messageID'] . "\t"; - print $row['date'] . "\t"; - print $row['message'] . "\t"; - } - - $conn = null; + try{ + $connection = new PDO("mysql:host=$server;dbname=$database", $username, $password); + // set the PDO error mode to exception + $connection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); + echo "Connected successfully".PHP_EOL; + } + catch(PDOException $e){ + echo "Connection failed: ".$e->getMessage().PHP_EOL; + } ?> -

PHP Session Info

+

Creating and Executing Query

query($sql) as $row){ + print $row['messageID']."\t"; + print $row['date']."\t"; + print $row['message']."\t"; + } + } + catch(Exception $e){ + echo "Error: ".$e->getMessage().PHP_EOL; + } + ?> +

$sql

+ "; + print_r($sql); + echo ""; + ?> + +

$_SESSION

+ "; + print_r($_SESSION); + echo ""; ?> - \ No newline at end of file + + + \ No newline at end of file From 36beca341f82f7f89cc5068f2575535d67ceca0c Mon Sep 17 00:00:00 2001 From: Bryan Date: Mon, 25 Nov 2019 13:24:32 -0500 Subject: [PATCH 65/70] updating the searching --- etc/nginx/conf.d/cs4430.conf | 6 +++--- var/www/messageSender.php | 13 +++++++++++++ var/www/nameSearch.php | 26 ++++++++++++++++++++++++-- var/www/search.php | 29 ----------------------------- var/www/usernameSearch.php | 26 +++++++++++++++++++++++++- 5 files changed, 65 insertions(+), 35 deletions(-) create mode 100644 var/www/messageSender.php diff --git a/etc/nginx/conf.d/cs4430.conf b/etc/nginx/conf.d/cs4430.conf index 4c0311c..1bea391 100644 --- a/etc/nginx/conf.d/cs4430.conf +++ b/etc/nginx/conf.d/cs4430.conf @@ -3,18 +3,18 @@ server { listen [::]:80; root /var/www/; - index index.html + landingPage landingPage.html server_name _; access_log /var/log/nginx/access.log; error_log /var/log/nginx/error.log; location / { - try_files $uri $uri/ /index.html =404; + try_files $uri $uri/ /landingPage.html =404; } location ~ \.php$ { include snippets/fastcgi-php.conf; fastcgi_pass unix:/run/php/php7.2-fpm.sock; } -} \ No newline at end of file +} diff --git a/var/www/messageSender.php b/var/www/messageSender.php new file mode 100644 index 0000000..d177c09 --- /dev/null +++ b/var/www/messageSender.php @@ -0,0 +1,13 @@ + + + + + + + + + diff --git a/var/www/nameSearch.php b/var/www/nameSearch.php index 2a73f98..decdfef 100644 --- a/var/www/nameSearch.php +++ b/var/www/nameSearch.php @@ -1,8 +1,30 @@ -First Name is
-Last Name is + +connect_error) { + die("Connection failed: " . $conn->connect_error); +} +echo "Connected successfully"; + +$query = "Select * from contacts where fname = " + $fname + " and lnam = " + $lname; + +print $query; + +?> diff --git a/var/www/search.php b/var/www/search.php index 963b35f..262bfe0 100644 --- a/var/www/search.php +++ b/var/www/search.php @@ -9,35 +9,6 @@ body {

Search by

- -
Username:

diff --git a/var/www/usernameSearch.php b/var/www/usernameSearch.php index 124f6a7..183ad88 100644 --- a/var/www/usernameSearch.php +++ b/var/www/usernameSearch.php @@ -1,7 +1,31 @@ + -Username is +connect_error) { + die("Connection failed: " . $conn->connect_error); +} +echo "Connected successfully"; + +$query = "Select * from contacts where username = " + $username; + +print $query; +?> From 145146a56126b89963f877656be0c227e29b5fa3 Mon Sep 17 00:00:00 2001 From: WilliamMiceli Date: Mon, 25 Nov 2019 13:25:29 -0500 Subject: [PATCH 66/70] Trying to fix login issue --- var/www/loginCheck.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/var/www/loginCheck.php b/var/www/loginCheck.php index 982d862..1d98a38 100644 --- a/var/www/loginCheck.php +++ b/var/www/loginCheck.php @@ -10,7 +10,7 @@ $connection = new PDO("mysql:host=$server;dbname=$database", $username, $password); $connection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); echo "Connected successfully"; - if(count($_POST) > 0){ + if($_POST["Username"] != "" && $_POST["Password"] != ""){ $matchingUsers = $connection->query("SELECT COUNT(*) FROM login WHERE username = '".$_POST["Username"]."' and pword = '".$_POST["Password"]."'"); if($matchingUsers > 0){ // User has been authenticated; set user as logged in From e3b7fcc6468616339756acb5ac23edb41543df57 Mon Sep 17 00:00:00 2001 From: Bryan Date: Mon, 25 Nov 2019 13:28:38 -0500 Subject: [PATCH 67/70] fix the nginx conf file --- etc/nginx/conf.d/cs4430.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/nginx/conf.d/cs4430.conf b/etc/nginx/conf.d/cs4430.conf index 1bea391..817d0dd 100644 --- a/etc/nginx/conf.d/cs4430.conf +++ b/etc/nginx/conf.d/cs4430.conf @@ -3,7 +3,7 @@ server { listen [::]:80; root /var/www/; - landingPage landingPage.html + landingPage.html server_name _; access_log /var/log/nginx/access.log; From 49e5b074ab2a99c99b6ce3e70418c91b9c2a0071 Mon Sep 17 00:00:00 2001 From: WilliamMiceli Date: Mon, 25 Nov 2019 13:32:35 -0500 Subject: [PATCH 68/70] Added index directive --- etc/nginx/conf.d/cs4430.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/nginx/conf.d/cs4430.conf b/etc/nginx/conf.d/cs4430.conf index 817d0dd..4ea0071 100644 --- a/etc/nginx/conf.d/cs4430.conf +++ b/etc/nginx/conf.d/cs4430.conf @@ -3,7 +3,7 @@ server { listen [::]:80; root /var/www/; - landingPage.html + index landingPage.html server_name _; access_log /var/log/nginx/access.log; From fcf59fe3e3befe96f45ac4ee5476331add80658d Mon Sep 17 00:00:00 2001 From: Bryan Date: Mon, 25 Nov 2019 13:36:33 -0500 Subject: [PATCH 69/70] update the index page --- var/www/index.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/var/www/index.html b/var/www/index.html index aef7256..56eaff7 100644 --- a/var/www/index.html +++ b/var/www/index.html @@ -16,8 +16,8 @@ - - + + From a2e66af73cb53f0e1fcfe0509c5048305575a2c2 Mon Sep 17 00:00:00 2001 From: WilliamMiceli Date: Mon, 25 Nov 2019 13:40:24 -0500 Subject: [PATCH 70/70] Removed die(); as it might be messing with things. --- var/www/loginCheck.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/var/www/loginCheck.php b/var/www/loginCheck.php index 1d98a38..88f6624 100644 --- a/var/www/loginCheck.php +++ b/var/www/loginCheck.php @@ -18,19 +18,16 @@ $_SESSION["loginError"] = ""; // Move onto landing page header("Location: /landingPage.html"); - die(); }else{ // No matching users found, send user error $_SESSION["loginError"] = "Invalid Username or Password"; // Return to login page header("Location: /login.php"); - die(); } }else{ // Return to login page, as credentials were not captured $_SESSION["loginError"] = "Login credentials not found, please try again"; header("Location: /login.php"); - die(); } } catch(PDOException $e){