From 455705e2864ff712141d02589ea2be5996dfc5cb Mon Sep 17 00:00:00 2001 From: Joey Lai Date: Wed, 18 Jan 2017 15:53:10 +0100 Subject: [PATCH] Fixed login link --- website/public/login.php | 6 +++--- website/public/styles/index.css | 14 +++++++------- website/queries/register.php | 10 ++++++++-- website/views/login-view.php | 8 +++++--- website/views/register-view.php | 6 ++++-- 5 files changed, 27 insertions(+), 17 deletions(-) diff --git a/website/public/login.php b/website/public/login.php index 82570a6..09dce8c 100644 --- a/website/public/login.php +++ b/website/public/login.php @@ -15,21 +15,21 @@ // Trying to login if ($_SERVER["REQUEST_METHOD"] == "POST") { + $uname=strtolower($_POST["uname"]); // Empty username or password field if (empty($_POST["uname"]) || empty($_POST["psw"])) { $loginErr = "Gebruikersnaam of wachtwoord is niet ingevuld"; } else { - $uname=strtolower($_POST["uname"]); $psw=$_POST["psw"]; $hash=hashPassword()["password"]; $userid=hashPassword()["userID"]; - + // If there's an account, go to the profile page if(password_verify($psw.$uname, $hash)) { $_SESSION["userID"] = $userid; - header("location: /profile.php"); + header("location: profile.php"); } else { $loginErr = "Inloggegevens zijn niet correct"; diff --git a/website/public/styles/index.css b/website/public/styles/index.css index a368066..c7d482f 100644 --- a/website/public/styles/index.css +++ b/website/public/styles/index.css @@ -60,7 +60,7 @@ body { height: 900px; background-image: url(https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTEnqKdVtLbxjKuNsCSCxFRhTOpp3Gm0gsU8bMgA_MeUYyzrUFy); - background-size: contain; + background-size: cover; background-repeat: repeat-x; background-attachment: fixed; @@ -109,10 +109,10 @@ form { border: 5px solid #325da3; background-color: #a87a87; border-radius: 12px; - height: 57%; - margin: 8px auto; + height: 55%; + margin: 35px auto; width: 45%; - overflow: auto; + overflow-y:auto; } /* inlog titel */ @@ -135,14 +135,14 @@ input[type=text], input[type=password], input[type=email], input[type="date"] { box-sizing: border-box; display: inline-block; height: 50%; - padding: 12px 20px; - margin: 8px 0; + padding: 8px 20px; + margin: 4px 0; width: 50%; font-family: Arial; font-size: 16px; } -input[type=submit] { +button[type=submit] { background-color: #845663; border: 2px solid black; border-radius: 12px; diff --git a/website/queries/register.php b/website/queries/register.php index 9881872..893bb3a 100644 --- a/website/queries/register.php +++ b/website/queries/register.php @@ -18,12 +18,18 @@ function getExistingUsername() { function getExistingEmail() { $stmt = $GLOBALS["db"]->prepare(" - SELECT * FROM `user` WHERE `email` = :email + SELECT + `email` + FROM + `user` + WHERE + `email` LIKE :email "); $stmt->bindParam(":email", $_POST["email"]); $stmt->execute(); return $stmt->rowCount(); + } function registerAccount() { @@ -54,7 +60,7 @@ function registerAccount() { $stmt->bindParam(":username", $_POST["username"]); $stmt->bindParam(":password", $hash); $stmt->bindParam(":location", $_POST["location"]); - $stmt->bindParam(":email", $_POST["email"]); + $stmt->bindParam(":email", (strtolower($_POST["email"]))); $stmt->execute(); $stmt->rowCount(); diff --git a/website/views/login-view.php b/website/views/login-view.php index e70d96b..df29cbc 100644 --- a/website/views/login-view.php +++ b/website/views/login-view.php @@ -27,7 +27,7 @@ @@ -36,10 +36,12 @@
- + id="frm1_submit"> + Login +
diff --git a/website/views/register-view.php b/website/views/register-view.php index 3ccc978..b7efbc8 100644 --- a/website/views/register-view.php +++ b/website/views/register-view.php @@ -120,10 +120,12 @@
- + id="frm1_submit"> + Registreer uw account +