Merge branch 'joey-testing' into 'master'
Splitted login and register pages See merge request !54
This commit was merged in pull request #58.
This commit is contained in:
@@ -5,9 +5,65 @@ include("../views/login_head.php");
|
||||
?>
|
||||
<body>
|
||||
<?php
|
||||
/*
|
||||
* This view adds login view
|
||||
*/
|
||||
session_start();
|
||||
|
||||
// Define variables and set to empty values
|
||||
$uname = $psw ="";
|
||||
$loginErr ="";
|
||||
|
||||
|
||||
// Trying to login
|
||||
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||
// Empty username or password field
|
||||
if (empty($_POST["uname"]) || empty($_POST["psw"])) {
|
||||
$loginErr = "Gebruikersnaam of wachtwoord is niet ingevuld";
|
||||
|
||||
}
|
||||
else {
|
||||
$uname=$_POST["uname"];
|
||||
$psw=$_POST["psw"];
|
||||
|
||||
// Protection against MySQL injections
|
||||
$uname = stripslashes($uname);
|
||||
$psw = stripslashes($psw);
|
||||
$uname = mysql_real_escape_string($uname);
|
||||
$psw = mysql_real_escape_string($psw);
|
||||
|
||||
// Database information
|
||||
$servername = "agile136.science.uva.nl";
|
||||
$username = "mhbp";
|
||||
$password = "qdtboXhCHJyL2szC";
|
||||
|
||||
// Creates connection
|
||||
$conn = new mysqli($servername, $username, $password);
|
||||
|
||||
// Selects database
|
||||
$db = mysql_select_db("company", $connection);
|
||||
|
||||
// Query for listing all accounts that meets the requirement of the login information
|
||||
$query = mysql_query("select * from login where password='$psw' AND username='$uname'", $connection);
|
||||
|
||||
// Checks if there's an account
|
||||
$count = mysql_num_rows($query);
|
||||
|
||||
// If there's an account, go to the profile page
|
||||
if($count == 1) {
|
||||
$_SESSION[$uname] = $uname;
|
||||
$_SESSION[$userID] = $userID;
|
||||
|
||||
header("location: myhyvesbookplus.nl/profile.php");
|
||||
}else {
|
||||
$loginErr = "Inloggegevens zijn niet correct";
|
||||
}
|
||||
|
||||
// Closing Connection
|
||||
mysql_close($connection);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* This view adds login view */
|
||||
include("../views/login-view.php");
|
||||
?>
|
||||
</body>
|
||||
|
||||
200
website/public/register.php
Normal file
200
website/public/register.php
Normal file
@@ -0,0 +1,200 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<?php
|
||||
include("../views/login_head.php");
|
||||
include_once("../queries/connect.php");
|
||||
|
||||
?>
|
||||
<body>
|
||||
<?php
|
||||
session_start();
|
||||
|
||||
// define variables and set to empty values
|
||||
$name = $surname = $bday = $username = $password = $confirmpassword = $streetname = $housenumber = $email = "";
|
||||
$genericErr = $nameErr = $surnameErr = $bdayErr = $usernameErr = $passwordErr = $confirmpasswordErr = $streetnameErr = $housenumberErr = $emailErr = "";
|
||||
$correct = true;
|
||||
|
||||
// Saves information of filling in the form
|
||||
if (isset($_POST["name"])) {
|
||||
$name = $_POST["name"];
|
||||
}
|
||||
|
||||
if (isset($_POST["surname"])) {
|
||||
$surname = $_POST["surname"];
|
||||
}
|
||||
|
||||
if (isset($_POST["bday"])) {
|
||||
$bday = $_POST["bday"];
|
||||
}
|
||||
|
||||
if (isset($_POST["username"])) {
|
||||
$username = $_POST["username"];
|
||||
}
|
||||
|
||||
if (isset($_POST["password"])) {
|
||||
$password = $_POST["password"];
|
||||
}
|
||||
|
||||
if (isset($_POST["streetname"])) {
|
||||
$streetname = $_POST["streetname"];
|
||||
}
|
||||
|
||||
if (isset($_POST["housenumber"])) {
|
||||
$housenumber = $_POST["housenumber"];
|
||||
}
|
||||
|
||||
if (isset($_POST["email"])) {
|
||||
$email = $_POST["email"];
|
||||
}
|
||||
|
||||
// Trying to register an account
|
||||
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||
if (empty($_POST["name"])) {
|
||||
$nameErr = "Naam is verplicht!";
|
||||
$correct = false;
|
||||
|
||||
} else {
|
||||
if (!preg_match("/^[a-zA-Z ]*$/",$name)) {
|
||||
$nameErr = "Alleen letters en spaties zijn toegestaan!";
|
||||
$correct = false;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($_POST["surname"])) {
|
||||
$surnameErr = "Achternaam is verplicht!";
|
||||
$correct = false;
|
||||
|
||||
} else {
|
||||
if (!preg_match("/^[a-zA-Z ]*$/",$surname)) {
|
||||
$surnameErr = "Alleen letters en spaties zijn toegestaan!";
|
||||
$correct = false;
|
||||
|
||||
}
|
||||
}
|
||||
if (empty($_POST["bday"])) {
|
||||
$bdayErr = "Geboortedatum is verplicht!";
|
||||
$correct = false;
|
||||
|
||||
}
|
||||
|
||||
if (empty($_POST["username"])) {
|
||||
$usernameErr = "Gebruikersnaam is verplicht!";
|
||||
$correct = false;
|
||||
|
||||
} else {
|
||||
if (strlen($username) < 6) {
|
||||
$usernameErr = "Gebruikersnaam moet minstens 6 karakters bevatten";
|
||||
$correct = false;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($_POST["password"])) {
|
||||
$passwordErr = "Wachtwoord is verplicht!";
|
||||
$correct = false;
|
||||
|
||||
} else {
|
||||
if (strlen($password) < 8) {
|
||||
$passwordErr = "Wachtwoord moet minstens 8 karakters bevatten";
|
||||
$correct = false;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($_POST["confirmpassword"])) {
|
||||
$confirmpasswordErr = "Herhaal wachtwoord!";
|
||||
$correct = false;
|
||||
|
||||
}
|
||||
|
||||
if ($_POST["password"]!= $_POST["confirmpassword"]) {
|
||||
$confirmpasswordErr = "Wachtwoorden matchen niet";
|
||||
$correct = false;
|
||||
|
||||
}
|
||||
|
||||
if (empty($_POST["streetname"])) {
|
||||
$streetnameErr = "Straatnaam is verplicht!";
|
||||
$correct = false;
|
||||
|
||||
} else {
|
||||
if (!preg_match("/^[a-zA-Z ]*$/",$streetname)) {
|
||||
$streetnameErr = "Alleen letters en spaties zijn toegestaan!";
|
||||
$correct = false;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($_POST["housenumber"])) {
|
||||
$housenumberErr = "Huisnummer is verplicht!";
|
||||
$correct = false;
|
||||
|
||||
}
|
||||
|
||||
if (empty($_POST["email"])) {
|
||||
$emailErr = "Email is verplicht!";
|
||||
$correct = false;
|
||||
|
||||
} else {
|
||||
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
|
||||
$emailErr = "Geldige email invullen!";
|
||||
$correct = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Checks if everything is filled in correctly
|
||||
if ($correct == false){
|
||||
$genericErr = "Bepaalde velden zijn verkeerd of niet ingevuld!";
|
||||
|
||||
} else {
|
||||
$servername = "agile136.science.uva.nl";
|
||||
$username = "mhbp";
|
||||
$password = "qdtboXhCHJyL2szC";
|
||||
|
||||
// Creates connection
|
||||
$conn = new mysqli($servername, $username, $password);
|
||||
|
||||
// Checks connection
|
||||
if ($conn->connect_error) {
|
||||
die("Connection failed: " . $conn->connect_error);
|
||||
}
|
||||
|
||||
// Query for inserting all the data in the database
|
||||
$sql = "INSERT INTO
|
||||
VALUES ($name, $surname, $bday, $username, $password,
|
||||
$confirmpassword, $streetname, $housenumber, $email)";
|
||||
|
||||
// Checks if able to insert into database
|
||||
if (mysqli_query($conn, $sql)) {
|
||||
echo "New record created successfully";
|
||||
} else {
|
||||
echo "Error: " . $sql . "<br>" . mysqli_error($conn);
|
||||
}
|
||||
|
||||
|
||||
|
||||
<?php
|
||||
/* Execute a prepared statement by binding PHP variables */
|
||||
$calories = 150;
|
||||
$colour = 'red';
|
||||
$sth = $dbh->prepare('SELECT name, colour, calories
|
||||
FROM fruit
|
||||
WHERE calories < :calories AND colour = :colour');
|
||||
$sth->bindParam(':calories', $calories, PDO::PARAM_INT);
|
||||
$sth->bindParam(':colour', $colour, PDO::PARAM_STR, 12);
|
||||
$sth->execute();
|
||||
?>
|
||||
|
||||
|
||||
|
||||
// Closing connection
|
||||
mysql_close($connection);
|
||||
}
|
||||
}
|
||||
|
||||
/* This view adds register view */
|
||||
include("../views/register-view.php");
|
||||
?>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,98 +1,117 @@
|
||||
::selection {
|
||||
background: #845663;
|
||||
color: white;
|
||||
background: #845663;
|
||||
color: white;
|
||||
}
|
||||
|
||||
::-moz-selection {
|
||||
background: #845663;
|
||||
color: white;
|
||||
background: #845663;
|
||||
color: white;
|
||||
}
|
||||
|
||||
a, a:link, a:visited, a:hover, a:active {
|
||||
color: inherit;
|
||||
text-decoration: none;
|
||||
color: inherit;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
a.button {
|
||||
background-color: #845663;
|
||||
border: 2px solid black;
|
||||
border-radius: 12px;
|
||||
color: white;
|
||||
cursor: pointer;
|
||||
height: 50%;
|
||||
margin: 8px 0;
|
||||
padding: 14px 20px;
|
||||
width: 25%;
|
||||
font-family: Arial;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
a[data-title]:hover:after, img[data-title]:hover:after, span[data-title]:hover:after,
|
||||
div[data-title]:hover:after{
|
||||
content: attr(data-title);
|
||||
padding: 4px 4px;
|
||||
color: #FFFFFF;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 100%;
|
||||
z-index: 20;
|
||||
white-space: nowrap;
|
||||
-moz-border-radius: 5px;
|
||||
-webkit-border-radius: 5px;
|
||||
border-radius: 5px;
|
||||
-moz-box-shadow: 0px 0px 4px #222;
|
||||
-webkit-box-shadow: 0px 0px 4px #222;
|
||||
box-shadow: 0px 0px 4px #222;
|
||||
background-color: #333;
|
||||
font-size: 15px;
|
||||
line-height: normal;
|
||||
font-family: Arial, sans-serif;
|
||||
content: attr(data-title);
|
||||
padding: 4px 4px;
|
||||
color: #FFFFFF;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 100%;
|
||||
z-index: 20;
|
||||
white-space: nowrap;
|
||||
-moz-border-radius: 5px;
|
||||
-webkit-border-radius: 5px;
|
||||
border-radius: 5px;
|
||||
-moz-box-shadow: 0px 0px 4px #222;
|
||||
-webkit-box-shadow: 0px 0px 4px #222;
|
||||
box-shadow: 0px 0px 4px #222;
|
||||
background-color: #333;
|
||||
font-size: 15px;
|
||||
line-height: normal;
|
||||
font-family: Arial, sans-serif;
|
||||
}
|
||||
|
||||
/* Add Zoom Animation */
|
||||
.animate {
|
||||
animation: animatezoom 0.6s
|
||||
-webkit-animation: animatezoom 0.6s;
|
||||
animation: animatezoom 0.6s
|
||||
-webkit-animation: animatezoom 0.6s;
|
||||
}
|
||||
|
||||
/* Body */
|
||||
body {
|
||||
height: 100%;
|
||||
height: 900px;
|
||||
|
||||
background-color: #B78996;
|
||||
color: #333;
|
||||
background-image: url(https://images2.pixlis.com/background-image-plaid-checkered-seamless-tileable-235ftm.png);
|
||||
background-size: contain;
|
||||
background-attachment: fixed;
|
||||
|
||||
font-family: Arial, sans-serif;
|
||||
/*background-color: #B78996;*/
|
||||
color: #333;
|
||||
|
||||
font-family: Arial, sans-serif;
|
||||
}
|
||||
|
||||
/* stijl voor alle buttons */
|
||||
button {
|
||||
background-color: #845663;
|
||||
border: 2px solid black;
|
||||
border-radius: 12px;
|
||||
color: white;
|
||||
cursor: pointer;
|
||||
height: 50%;
|
||||
margin: 8px 0;
|
||||
padding: 14px 20px;
|
||||
width: 25%;
|
||||
font-family: Arial;
|
||||
font-size: 16px;
|
||||
background-color: #845663;
|
||||
border: 2px solid black;
|
||||
border-radius: 12px;
|
||||
color: white;
|
||||
cursor: pointer;
|
||||
height: 50%;
|
||||
margin: 8px 0;
|
||||
padding: 14px 20px;
|
||||
width: 25%;
|
||||
font-family: Arial;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
/* The Close Button */
|
||||
.close {
|
||||
/* Position it in the top right corner outside of the modal */
|
||||
color: white;
|
||||
font-size: 100px;
|
||||
font-weight: bold;
|
||||
position: absolute;
|
||||
right: 25px;
|
||||
top: 0;
|
||||
color: white;
|
||||
font-size: 100px;
|
||||
font-weight: bold;
|
||||
position: absolute;
|
||||
right: 25px;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
/* Close button on hover */
|
||||
.close:hover,
|
||||
.close:focus {
|
||||
color: red;
|
||||
cursor: pointer;
|
||||
color: red;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
/* inlogform */
|
||||
form {
|
||||
background-color: #a87a87;
|
||||
/*background-color: #a87a87;*/
|
||||
border: 5px solid #325da3;
|
||||
background-color: #a87a87;
|
||||
border-radius: 12px;
|
||||
height: 50%;
|
||||
margin: auto;
|
||||
width: 55%;
|
||||
height: 57%;
|
||||
margin: 8px auto;
|
||||
width: 45%;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
/* inlog titel */
|
||||
@@ -142,14 +161,21 @@ label {
|
||||
|
||||
/* padding voor registreer container */
|
||||
.login_containerregister {
|
||||
padding: 16px;
|
||||
text-align: left;
|
||||
padding: 16px;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
/* padding voor login_containers */
|
||||
.login_containerlogin {
|
||||
padding: 16px;
|
||||
text-align: center;
|
||||
padding: 16px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/* padding voor foutmelding login */
|
||||
.login_containerfault {
|
||||
padding: 16px;
|
||||
text-align: center;
|
||||
color: red;
|
||||
}
|
||||
|
||||
/* The Modal (background) */
|
||||
@@ -175,12 +201,13 @@ label {
|
||||
margin: 5px auto; /* 15% from the top and centered */
|
||||
overflow-y: auto;
|
||||
width: 40%; /* Could be more or less, depending on screen size */
|
||||
height: 80%;
|
||||
height: 60%;
|
||||
|
||||
}
|
||||
|
||||
@keyframes animatezoom {
|
||||
from {transform: scale(0)}
|
||||
to {transform: scale(1)}
|
||||
from {transform: scale(0)}
|
||||
to {transform: scale(1)}
|
||||
}
|
||||
|
||||
/* datepicker */
|
||||
@@ -203,6 +230,6 @@ select {
|
||||
}
|
||||
|
||||
ul {
|
||||
font-family: Arial;
|
||||
font-size: 16px;
|
||||
font-family: Arial;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user