Marijn button #99
2
.gitignore
vendored
2
.gitignore
vendored
@@ -8,7 +8,7 @@
|
|||||||
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
|
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
|
||||||
|
|
||||||
|
|
||||||
|
.idea/*
|
||||||
# User-specific stuff:
|
# User-specific stuff:
|
||||||
.idea/workspace.xml
|
.idea/workspace.xml
|
||||||
.idea/tasks.xml
|
.idea/tasks.xml
|
||||||
|
|||||||
@@ -1,7 +0,0 @@
|
|||||||
<?xml version='1.0'?>
|
|
||||||
<MySQL_INIT>
|
|
||||||
<mysql_host>localhost</mysql_host>
|
|
||||||
<mysql_database>myhyvesbookplus</mysql_database>
|
|
||||||
<mysql_username>mhbp</mysql_username>
|
|
||||||
<mysql_password>qdtboXhCHJyL2szC</mysql_password>
|
|
||||||
</MySQL_INIT>
|
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
include_once("../queries/private_message.php");
|
session_start();
|
||||||
|
require_once("../../queries/connect.php");
|
||||||
|
require_once("../../queries/private_message.php");
|
||||||
|
|
||||||
if (isset($_POST["lastID"]) && $_POST["lastID"] != "") {
|
if (isset($_POST["lastID"]) && $_POST["lastID"] != "") {
|
||||||
|
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
include_once("../queries/private_message.php");
|
session_start();
|
||||||
|
require_once("../../queries/connect.php");
|
||||||
|
require_once("../../queries/private_message.php");
|
||||||
|
|
||||||
if (isset($_POST["destination"]) &&
|
if (isset($_POST["destination"]) &&
|
||||||
isset($_POST["content"])) {
|
isset($_POST["content"])) {
|
||||||
BIN
website/public/img/error404.jpg
Normal file
BIN
website/public/img/error404.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 33 KiB |
@@ -1,10 +1,12 @@
|
|||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
loadMessages();
|
loadMessages();
|
||||||
|
sayEmpty();
|
||||||
|
$(".chat-field").hide();
|
||||||
});
|
});
|
||||||
|
|
||||||
function loadMessages() {
|
function loadMessages() {
|
||||||
$.post(
|
$.post(
|
||||||
"loadMessages.php",
|
"API/loadMessages.php",
|
||||||
$("#lastIDForm").serialize()
|
$("#lastIDForm").serialize()
|
||||||
).done(function(data) {
|
).done(function(data) {
|
||||||
if (data && data != "[]") {
|
if (data && data != "[]") {
|
||||||
@@ -23,7 +25,7 @@ function loadMessages() {
|
|||||||
function sendMessage() {
|
function sendMessage() {
|
||||||
console.log($("#sendMessageForm").serialize());
|
console.log($("#sendMessageForm").serialize());
|
||||||
$.post(
|
$.post(
|
||||||
"sendMessage.php",
|
"API/sendMessage.php",
|
||||||
$("#sendMessageForm").serialize()
|
$("#sendMessageForm").serialize()
|
||||||
).done(function( data ) {
|
).done(function( data ) {
|
||||||
console.log(data);
|
console.log(data);
|
||||||
@@ -51,7 +53,14 @@ function addMessages(messages) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function switchUser(userID) {
|
function switchUser(userID) {
|
||||||
|
$(".chat-field").show();
|
||||||
$(".destinationID").val(userID);
|
$(".destinationID").val(userID);
|
||||||
$("#chat-history").html("");
|
$("#chat-history").html("");
|
||||||
$("#lastID").val("");
|
$("#lastID").val("");
|
||||||
|
$(".chat-left .friend-item").removeClass("active-friend-chat");
|
||||||
|
$(".chat-left #friend-item-" + userID).addClass("active-friend-chat");
|
||||||
|
}
|
||||||
|
|
||||||
|
function sayEmpty() {
|
||||||
|
$("#chat-history").html("Begin nu met chatten!");
|
||||||
}
|
}
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
<html>
|
<html>
|
||||||
<?php
|
<?php
|
||||||
include("../views/login_head.php");
|
include("../views/login_head.php");
|
||||||
include_once("../queries/connect.php");
|
require_once("../queries/connect.php");
|
||||||
include_once("../queries/login.php");
|
include_once("../queries/login.php");
|
||||||
?>
|
?>
|
||||||
<body>
|
<body>
|
||||||
@@ -15,19 +15,19 @@
|
|||||||
|
|
||||||
// Trying to login
|
// Trying to login
|
||||||
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||||
$uname=strtolower($_POST["uname"]);
|
|
||||||
// Empty username or password field
|
// Empty username or password field
|
||||||
if (empty($_POST["uname"]) || empty($_POST["psw"])) {
|
if (empty($_POST["uname"]) || empty($_POST["psw"])) {
|
||||||
$loginErr = "Gebruikersnaam of wachtwoord is niet ingevuld";
|
$loginErr = "Gebruikersnaam of wachtwoord is niet ingevuld";
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$psw=$_POST["psw"];
|
$uname = strtolower(test_input($_POST["uname"]));
|
||||||
$hash=hashPassword()["password"];
|
$psw = test_input($_POST["psw"]);
|
||||||
$userid=hashPassword()["userID"];
|
$hash = getUser()["password"];
|
||||||
|
$userid = getUser()["userID"];
|
||||||
|
|
||||||
// If there's an account, go to the profile page
|
// If there's an account, go to the profile page
|
||||||
if(password_verify($psw.$uname, $hash)) {
|
if(password_verify($psw, $hash)) {
|
||||||
$_SESSION["userID"] = $userid;
|
$_SESSION["userID"] = $userid;
|
||||||
header("location: profile.php");
|
header("location: profile.php");
|
||||||
|
|
||||||
|
|||||||
15
website/public/logout.php
Normal file
15
website/public/logout.php
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<?php
|
||||||
|
include("../views/login_head.php");
|
||||||
|
require_once("../queries/connect.php");
|
||||||
|
include_once("../queries/login.php");
|
||||||
|
?>
|
||||||
|
<body>
|
||||||
|
<?php
|
||||||
|
session_start();
|
||||||
|
unset($_SESSION["userID"]);
|
||||||
|
header("Location: login.php");
|
||||||
|
?>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -2,9 +2,9 @@
|
|||||||
<html>
|
<html>
|
||||||
<?php
|
<?php
|
||||||
include("../views/login_head.php");
|
include("../views/login_head.php");
|
||||||
include_once("../queries/connect.php");
|
require_once("../queries/connect.php");
|
||||||
include_once("../queries/register.php");
|
include_once("../queries/register.php");
|
||||||
|
include_once("../queries/checkInput.php");
|
||||||
?>
|
?>
|
||||||
<body>
|
<body>
|
||||||
<?php
|
<?php
|
||||||
@@ -15,149 +15,27 @@
|
|||||||
$genericErr = $nameErr = $surnameErr = $bdayErr = $usernameErr = $passwordErr = $confirmpasswordErr = $locationErr = $housenumberErr = $emailErr = "";
|
$genericErr = $nameErr = $surnameErr = $bdayErr = $usernameErr = $passwordErr = $confirmpasswordErr = $locationErr = $housenumberErr = $emailErr = "";
|
||||||
$correct = true;
|
$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["location"])) {
|
|
||||||
$location = $_POST["location"];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($_POST["housenumber"])) {
|
|
||||||
$housenumber = $_POST["housenumber"];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($_POST["email"])) {
|
|
||||||
$email = $_POST["email"];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Trying to register an account
|
// Trying to register an account
|
||||||
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||||
if (empty($_POST["name"])) {
|
checkInputChoice("name", "lettersAndSpace");
|
||||||
$nameErr = "Naam is verplicht!";
|
checkInputChoice("surname", "lettersAndSpace");
|
||||||
$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"])) {
|
if (empty($_POST["bday"])) {
|
||||||
$bdayErr = "Geboortedatum is verplicht!";
|
$bdayErr = "Geboortedatum is verplicht!";
|
||||||
$correct = false;
|
$correct = false;
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if (empty($_POST["username"])) {
|
|
||||||
$usernameErr = "Gebruikersnaam is verplicht!";
|
|
||||||
$correct = false;
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (strlen($username) < 6) {
|
$bday = test_input($_POST["bday"]);
|
||||||
$usernameErr = "Gebruikersnaam moet minstens 6 karakters bevatten";
|
|
||||||
$correct = false;
|
|
||||||
|
|
||||||
} else if (getExistingUsername() == 1){
|
|
||||||
$usernameErr = "Gebruikersnaam bestaat al";
|
|
||||||
$correct = false;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($_POST["password"])) {
|
checkInputChoice("username", "username");
|
||||||
$passwordErr = "Wachtwoord is verplicht!";
|
checkInputChoice("password", "longerEigth");
|
||||||
$correct = false;
|
checkInputChoice("confirmpassword", "");
|
||||||
|
matchPassword();
|
||||||
} else {
|
checkInputChoice("location", "lettersAndSpace");
|
||||||
if (strlen($password) < 8) {
|
checkInputChoice("email", "email");
|
||||||
$passwordErr = "Wachtwoord moet minstens 8 karakters bevatten";
|
registerCheck();
|
||||||
$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["location"])) {
|
|
||||||
$locationErr = "Straatnaam is verplicht!";
|
|
||||||
$correct = false;
|
|
||||||
|
|
||||||
} else {
|
|
||||||
if (!preg_match("/^[a-zA-Z ]*$/",$location)) {
|
|
||||||
$locationErr = "Alleen letters en spaties zijn toegestaan!";
|
|
||||||
$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;
|
|
||||||
|
|
||||||
} else if (getExistingEmail() == 1){
|
|
||||||
$emailErr = "Email bestaat al";
|
|
||||||
$correct = false;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Checks if everything is filled in correctly
|
|
||||||
if ($correct == false){
|
|
||||||
$genericErr = "Bepaalde velden zijn verkeerd of niet ingevuld!";
|
|
||||||
|
|
||||||
} else {
|
|
||||||
registerAccount();
|
|
||||||
header("location: login.php");
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* This view adds register view */
|
/* This view adds register view */
|
||||||
include("../views/register-view.php");
|
include("../views/register-view.php");
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
include("../views/main.php");
|
include("../views/main.php");
|
||||||
|
$notImplemented = new settingsMessage("angry", "Deze functie werkt nog niet :(");
|
||||||
|
|
||||||
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||||
switch ($_POST["form"]) {
|
switch ($_POST["form"]) {
|
||||||
@@ -24,16 +25,10 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
|||||||
$result = updatePassword();
|
$result = updatePassword();
|
||||||
break;
|
break;
|
||||||
case "email":
|
case "email":
|
||||||
$result = array (
|
$result = changeEmail();
|
||||||
"type" => "settings-message-angry",
|
|
||||||
"message" => "Deze functie werkt nog niet :("
|
|
||||||
);
|
|
||||||
break;
|
break;
|
||||||
case "picture":
|
case "picture":
|
||||||
$result = array (
|
$result = $notImplemented;
|
||||||
"type" => "settings-message-angry",
|
|
||||||
"message" => "Deze functie werkt nog niet :("
|
|
||||||
);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -89,3 +89,8 @@
|
|||||||
border-radius: 0 10px 10px 0;
|
border-radius: 0 10px 10px 0;
|
||||||
box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
|
box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.active-friend-chat {
|
||||||
|
background: aquamarine;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
@@ -1,22 +1,6 @@
|
|||||||
::selection {
|
|
||||||
background: #845663;
|
|
||||||
color: white;
|
|
||||||
}
|
|
||||||
|
|
||||||
::-moz-selection {
|
|
||||||
background: #845663;
|
|
||||||
color: white;
|
|
||||||
}
|
|
||||||
|
|
||||||
a, a:link, a:visited, a:hover, a:active {
|
|
||||||
color: inherit;
|
|
||||||
text-decoration: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
a.button {
|
a.button {
|
||||||
background-color: #845663;
|
background-color: #405550;
|
||||||
border: 2px solid black;
|
border-radius: 10px;
|
||||||
border-radius: 12px;
|
|
||||||
color: white;
|
color: white;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
height: 50%;
|
height: 50%;
|
||||||
@@ -27,64 +11,19 @@ a.button {
|
|||||||
font-size: 16px;
|
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Add Zoom Animation */
|
|
||||||
.animate {
|
|
||||||
animation: animatezoom 0.6s
|
|
||||||
-webkit-animation: animatezoom 0.6s;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Body */
|
/* Body */
|
||||||
body {
|
body {
|
||||||
height: 900px;
|
height: 900px;
|
||||||
|
background-color: #C8CABD;
|
||||||
background-image: url(https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTEnqKdVtLbxjKuNsCSCxFRhTOpp3Gm0gsU8bMgA_MeUYyzrUFy);
|
/*background-image: url(http://play.pokemonshowdown.com/fx/client-bg-shaymin.jpg);
|
||||||
background-size: cover;
|
background-size: cover;
|
||||||
background-repeat: repeat-x;
|
background-attachment: fixed;*/
|
||||||
background-attachment: fixed;
|
|
||||||
|
|
||||||
/*background-color: #B78996;*/
|
/*background-color: #B78996;*/
|
||||||
color: #333;
|
color: #333;
|
||||||
|
|
||||||
font-family: Arial, sans-serif;
|
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* The Close Button */
|
/* The Close Button */
|
||||||
.close {
|
.close {
|
||||||
/* Position it in the top right corner outside of the modal */
|
/* Position it in the top right corner outside of the modal */
|
||||||
@@ -106,20 +45,18 @@ button {
|
|||||||
/* inlogform */
|
/* inlogform */
|
||||||
form {
|
form {
|
||||||
/*background-color: #a87a87;*/
|
/*background-color: #a87a87;*/
|
||||||
border: 5px solid #325da3;
|
|
||||||
background-color: #a87a87;
|
|
||||||
border-radius: 12px;
|
border-radius: 12px;
|
||||||
height: 55%;
|
height: 75%;
|
||||||
margin: 35px auto;
|
margin: 10px auto;
|
||||||
width: 45%;
|
width: 70%;
|
||||||
overflow-y:auto;
|
overflow-y:auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* inlog titel */
|
/* inlog titel */
|
||||||
h1 {
|
h1 {
|
||||||
padding: 16px;
|
padding: 8px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
font-size: 2.2em;
|
font-size: 1.5em;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* registreer titel*/
|
/* registreer titel*/
|
||||||
@@ -130,30 +67,34 @@ h2 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
input[type=text], input[type=password], input[type=email], input[type="date"] {
|
input[type=text], input[type=password], input[type=email], input[type="date"] {
|
||||||
border-radius: 12px;
|
|
||||||
border: 5px solid #ccc;
|
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
|
border-color: #C8CABD;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
height: 50%;
|
height: 50%;
|
||||||
padding: 8px 20px;
|
padding: 8px 20px;
|
||||||
margin: 4px 0;
|
margin: 4px 0;
|
||||||
width: 50%;
|
width: 50%;
|
||||||
font-family: Arial;
|
|
||||||
font-size: 16px;
|
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
input[type=text], input[type=password], input[type=email], input[type="date"] {
|
||||||
|
border: 0px;
|
||||||
|
border-bottom: 4px solid lightgray;
|
||||||
|
border-radius: 0px;
|
||||||
|
}*/
|
||||||
|
|
||||||
button[type=submit] {
|
button[type=submit] {
|
||||||
background-color: #845663;
|
background-color: #C8CABD;
|
||||||
border: 2px solid black;
|
color: black ;
|
||||||
border-radius: 12px;
|
|
||||||
color: white;
|
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
height: 50%;
|
|
||||||
margin: 8px 0;
|
|
||||||
padding: 14px 20px;
|
|
||||||
width: 50%;
|
|
||||||
font-family: Arial;
|
font-family: Arial;
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
|
width: 50%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.error {
|
||||||
|
font-family: Arial;
|
||||||
|
font-size: 15px;
|
||||||
|
color: red;
|
||||||
}
|
}
|
||||||
|
|
||||||
label {
|
label {
|
||||||
@@ -179,52 +120,31 @@ label {
|
|||||||
color: red;
|
color: red;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The Modal (background) */
|
|
||||||
.modal {
|
|
||||||
background-color: rgb(0,0,0); /* Fallback color */
|
|
||||||
background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
|
|
||||||
display: none; /* Hidden by default */
|
|
||||||
height: 100%;
|
|
||||||
left: 0;
|
|
||||||
margin: auto;
|
|
||||||
overflow: auto; /* Enable scroll if needed */
|
|
||||||
padding-top: 60px;
|
|
||||||
position: fixed; /* Stay in place */
|
|
||||||
top: 0;
|
|
||||||
width: 100%; /* Full width */
|
|
||||||
z-index: 1; /* Sit on top */
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Modal Content/Box */
|
|
||||||
.modal-content {
|
|
||||||
background-color: #B78996;
|
|
||||||
border: 5px solid #325da3;
|
|
||||||
margin: 5px auto; /* 15% from the top and centered */
|
|
||||||
overflow-y: auto;
|
|
||||||
width: 40%; /* Could be more or less, depending on screen size */
|
|
||||||
height: 60%;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes animatezoom {
|
@keyframes animatezoom {
|
||||||
from {transform: scale(0)}
|
from {transform: scale(0)}
|
||||||
to {transform: scale(1)}
|
to {transform: scale(1)}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* datepicker */
|
/* White boxes (squares) */
|
||||||
select {
|
.platform {
|
||||||
border-radius: 12px;
|
background-color: #FFFFFF;
|
||||||
border: 5px solid #ccc;
|
/*background-image: url(http://www.planwallpaper.com/static/images/518071-background-hd_xO1TwRc.jpg);
|
||||||
box-sizing: border-box;
|
background-size: cover;
|
||||||
display: inline-block;
|
background-repeat: repeat-x;
|
||||||
height: 50%;
|
background-attachment: fixed;*/
|
||||||
padding: 12px 20px;
|
box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
|
||||||
margin: 8px 0;
|
height: 53%;
|
||||||
width: 18%;
|
margin: 34px auto;
|
||||||
font-family: Arial;
|
overflow-y: auto;
|
||||||
font-size: 16px;
|
padding: 20px;
|
||||||
|
width: 35%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*.platform {
|
||||||
|
width: 40%;
|
||||||
|
margin: 34px auto;
|
||||||
|
}*/
|
||||||
|
|
||||||
@-webkit-keyframes animatezoom {
|
@-webkit-keyframes animatezoom {
|
||||||
from {-webkit-transform: scale(0)}
|
from {-webkit-transform: scale(0)}
|
||||||
to {-webkit-transform: scale(1)}
|
to {-webkit-transform: scale(1)}
|
||||||
|
|||||||
@@ -30,9 +30,14 @@
|
|||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.friend-item:hover {
|
||||||
|
background: #845663;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
.menu button {
|
.menu button {
|
||||||
background: none;
|
background: none;
|
||||||
color: #333;
|
color: inherit;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
include_once("../queries/connect.php");
|
include_once("../queries/connect.php");
|
||||||
include_once("../queries/friendship.php");
|
include_once("../queries/friendship.php");
|
||||||
|
|
||||||
$friends = selectAllFriends($db, 666);
|
$friends = selectAllFriends(666);
|
||||||
while($friend = $friends->fetch(PDO::FETCH_ASSOC)) {
|
while($friend = $friends->fetch(PDO::FETCH_ASSOC)) {
|
||||||
echo $friend['username'].' '.$friend['onlinestatus'] . "<br />";
|
echo $friend['username'].' '.$friend['onlinestatus'] . "<br />";
|
||||||
}
|
}
|
||||||
|
|||||||
95
website/queries/checkInput.php
Normal file
95
website/queries/checkInput.php
Normal file
@@ -0,0 +1,95 @@
|
|||||||
|
<?php
|
||||||
|
function checkInputChoice($variable, $option){
|
||||||
|
if (empty($_POST[$variable])) {
|
||||||
|
$GLOBALS[$variable . "Err"] = "Verplicht!";
|
||||||
|
$GLOBALS["correct"] = false;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
$GLOBALS[$variable] = test_input($_POST[$variable]);
|
||||||
|
switch ($option) {
|
||||||
|
case "lettersAndSpace":
|
||||||
|
checkonly($variable);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "username";
|
||||||
|
username($variable);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "longerEigth";
|
||||||
|
longerEigth($variable);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "email";
|
||||||
|
validateEmail($variable);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkOnly($variable){
|
||||||
|
if (!preg_match("/^[a-zA-Z ]*$/",$GLOBALS[$variable])) {
|
||||||
|
$GLOBALS[$variable . "Err"] = "Alleen letters en spaties zijn toegestaan!";
|
||||||
|
$correct = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function username($variable){
|
||||||
|
if (strlen($GLOBALS[$variable]) < 6) {
|
||||||
|
$GLOBALS[$variable . "Err"] = "Gebruikersnaam moet minstens 6 karakters bevatten";
|
||||||
|
$correct = false;
|
||||||
|
} else if (getExistingUsername() == 1) {
|
||||||
|
$GLOBALS[$variable . "Err"] = "Gebruikersnaam bestaat al";
|
||||||
|
$correct = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function longerEigth($variable){
|
||||||
|
if (strlen($GLOBALS[$variable]) < 8) {
|
||||||
|
$GLOBALS[$variable . "Err"] = "Moet minstens 8 karakters bevatten";
|
||||||
|
$correct = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function validateEmail($variable){
|
||||||
|
if (!filter_var($GLOBALS[$variable], FILTER_VALIDATE_EMAIL)) {
|
||||||
|
$GLOBALS[$variable . "Err"] = "Geldige email invullen!";
|
||||||
|
$correct = false;
|
||||||
|
|
||||||
|
} else if (getExistingEmail() == 1){
|
||||||
|
$GLOBALS[$variable . "Err"] = "Email bestaat al";
|
||||||
|
$correct = false;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function matchPassword(){
|
||||||
|
if ($_POST["password"] != $_POST["confirmpassword"]) {
|
||||||
|
$GLOBALS["confirmpasswordErr"] = "Wachtwoorden matchen niet";
|
||||||
|
$GLOBALS["correct"] = false;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Checks if everything is filled in correctly
|
||||||
|
function registerCheck(){
|
||||||
|
if ($GLOBALS["correct"] == false){
|
||||||
|
$GLOBALS["genericErr"] = "Bepaalde velden zijn verkeerd of niet ingevuld!";
|
||||||
|
|
||||||
|
} else {
|
||||||
|
registerAccount();
|
||||||
|
header("location: login.php");
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function test_input($data) {
|
||||||
|
$data = trim($data);
|
||||||
|
$data = stripslashes($data);
|
||||||
|
$data = htmlspecialchars($data);
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
?>
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
require("connect.php");
|
|
||||||
|
|
||||||
function selectAllFriends($userID) {
|
function selectAllFriends($userID) {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = $GLOBALS["db"]->prepare("
|
||||||
SELECT
|
SELECT
|
||||||
|
`userID`,
|
||||||
`username`,
|
`username`,
|
||||||
IFNULL(
|
IFNULL(
|
||||||
`profilepicture`,
|
`profilepicture`,
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
function selectAllGroupsFromUser($db, $userID) {
|
function selectAllGroupsFromUser($userID) {
|
||||||
return $db->query("
|
return $GLOBALS["db"]->query("
|
||||||
SELECT
|
SELECT
|
||||||
`group_page`.`name`,
|
`group_page`.`name`,
|
||||||
`group_page`.`picture`
|
`group_page`.`picture`
|
||||||
@@ -15,7 +15,3 @@ function selectAllGroupsFromUser($db, $userID) {
|
|||||||
`group_page`.`status` != 0
|
`group_page`.`status` != 0
|
||||||
");
|
");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
?>
|
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
function selectGroupById($db, $groupID) {
|
function selectGroupById($groupID) {
|
||||||
return $db->query("
|
return $GLOBALS["db"]->query("
|
||||||
SELECT
|
SELECT
|
||||||
`group_page`.`name`,
|
`group_page`.`name`,
|
||||||
`group_page`.`picture`,
|
`group_page`.`picture`,
|
||||||
@@ -15,8 +15,8 @@ function selectGroupById($db, $groupID) {
|
|||||||
");
|
");
|
||||||
}
|
}
|
||||||
|
|
||||||
function select20GroupsFromN($db, $n) {
|
function select20GroupsFromN($n) {
|
||||||
return $db->query("
|
return $GLOBALS["db"]->query("
|
||||||
SELECT
|
SELECT
|
||||||
`group_page`.`groupID`,
|
`group_page`.`groupID`,
|
||||||
`group_page`.`name`,
|
`group_page`.`name`,
|
||||||
@@ -33,8 +33,8 @@ function select20GroupsFromN($db, $n) {
|
|||||||
");
|
");
|
||||||
}
|
}
|
||||||
|
|
||||||
function select20GroupsByStatusFromN($db, $n, $status) {
|
function select20GroupsByStatusFromN($n, $status) {
|
||||||
return $db->query("
|
return $GLOBALS["db"]->query("
|
||||||
SELECT
|
SELECT
|
||||||
`group_page`.`groupID`,
|
`group_page`.`groupID`,
|
||||||
`group_page`.`name`,
|
`group_page`.`name`,
|
||||||
@@ -53,8 +53,8 @@ function select20GroupsByStatusFromN($db, $n, $status) {
|
|||||||
");
|
");
|
||||||
}
|
}
|
||||||
|
|
||||||
function search20GroupsFromNByStatus($db, $n, $keyword, $status) {
|
function search20GroupsFromNByStatus($n, $keyword, $status) {
|
||||||
$q = $db->prepare("
|
$q = $GLOBALS["db"]->prepare("
|
||||||
SELECT
|
SELECT
|
||||||
`groupID`,
|
`groupID`,
|
||||||
`name`,
|
`name`,
|
||||||
@@ -80,8 +80,8 @@ function search20GroupsFromNByStatus($db, $n, $keyword, $status) {
|
|||||||
return $q;
|
return $q;
|
||||||
}
|
}
|
||||||
|
|
||||||
function changeGroupStatusByID($db, $id, $status) {
|
function changeGroupStatusByID($id, $status) {
|
||||||
$q = $db->query("
|
$q = $GLOBALS["db"]->query("
|
||||||
UPDATE
|
UPDATE
|
||||||
`group_page`
|
`group_page`
|
||||||
SET
|
SET
|
||||||
@@ -92,8 +92,3 @@ function changeGroupStatusByID($db, $id, $status) {
|
|||||||
|
|
||||||
return $q;
|
return $q;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
|||||||
@@ -4,14 +4,18 @@ function getHeaderInfo() {
|
|||||||
SELECT
|
SELECT
|
||||||
`fname`,
|
`fname`,
|
||||||
`lname`,
|
`lname`,
|
||||||
`profilepicture`
|
IFNULL(
|
||||||
|
`profilepicture`,
|
||||||
|
'img/notbad.jpg'
|
||||||
|
) AS profilepicture
|
||||||
FROM
|
FROM
|
||||||
`user`
|
`user`
|
||||||
WHERE
|
WHERE
|
||||||
`userID` = :userID
|
`userID` = :userID
|
||||||
");
|
");
|
||||||
|
|
||||||
$stmt->bindParam(":userID", $_SESSION["userID"]);
|
$stmt->bindParam(":userID", $_SESSION["userID"]);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
return $stmt->fetch();
|
|
||||||
|
|
||||||
|
return $stmt->fetch();
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
function hashPassword() {
|
function getUser() {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = $GLOBALS["db"]->prepare("
|
||||||
SELECT
|
SELECT
|
||||||
`password`,
|
`password`,
|
||||||
@@ -15,5 +15,3 @@ function hashPassword() {
|
|||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
return $stmt->fetch(PDO::FETCH_ASSOC);
|
return $stmt->fetch(PDO::FETCH_ASSOC);
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
|
||||||
|
|||||||
@@ -1,14 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
include_once("connect.php");
|
|
||||||
|
|
||||||
session_start();
|
|
||||||
|
|
||||||
function getOldChatMessages($user2ID) {
|
function getOldChatMessages($user2ID) {
|
||||||
$db = $GLOBALS["db"];
|
|
||||||
$user1ID = $_SESSION["userID"];
|
$user1ID = $_SESSION["userID"];
|
||||||
|
|
||||||
$stmt = $db->prepare("
|
$stmt = $GLOBALS["db"]->prepare("
|
||||||
SELECT
|
SELECT
|
||||||
*
|
*
|
||||||
FROM
|
FROM
|
||||||
@@ -31,8 +26,7 @@ function getOldChatMessages($user2ID) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function sendMessage($destination, $content) {
|
function sendMessage($destination, $content) {
|
||||||
$db = $GLOBALS["db"];
|
$stmt = $GLOBALS["db"]->prepare("
|
||||||
$stmt = $db->prepare("
|
|
||||||
INSERT INTO
|
INSERT INTO
|
||||||
`private_message`
|
`private_message`
|
||||||
(
|
(
|
||||||
@@ -56,10 +50,7 @@ function sendMessage($destination, $content) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getNewChatMessages($lastID, $destination) {
|
function getNewChatMessages($lastID, $destination) {
|
||||||
$db = $GLOBALS["db"];
|
$stmt = $GLOBALS["db"]->prepare("
|
||||||
$origin = $_SESSION["userID"];
|
|
||||||
|
|
||||||
$stmt = $db->prepare("
|
|
||||||
SELECT
|
SELECT
|
||||||
*
|
*
|
||||||
FROM
|
FROM
|
||||||
@@ -75,7 +66,7 @@ function getNewChatMessages($lastID, $destination) {
|
|||||||
`messageID` ASC
|
`messageID` ASC
|
||||||
");
|
");
|
||||||
|
|
||||||
$stmt->bindParam(':user1', $origin);
|
$stmt->bindParam(':user1', $_SESSION["userID"]);
|
||||||
$stmt->bindParam(':user2', $destination);
|
$stmt->bindParam(':user2', $destination);
|
||||||
$stmt->bindParam(':lastID', $lastID);
|
$stmt->bindParam(':lastID', $lastID);
|
||||||
|
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ function registerAccount() {
|
|||||||
:email
|
:email
|
||||||
)");
|
)");
|
||||||
|
|
||||||
$hash=password_hash($_POST["password"].(strtolower($_POST["username"])), PASSWORD_DEFAULT);
|
$hash=password_hash($_POST["password"], PASSWORD_DEFAULT);
|
||||||
|
|
||||||
$stmt->bindParam(":fname", $_POST["name"]);
|
$stmt->bindParam(":fname", $_POST["name"]);
|
||||||
$stmt->bindParam(":lname", $_POST["surname"]);
|
$stmt->bindParam(":lname", $_POST["surname"]);
|
||||||
|
|||||||
@@ -1,5 +1,42 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
class settingsMessage {
|
||||||
|
private $class;
|
||||||
|
private $message;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* settingsMessage constructor.
|
||||||
|
* @param string $type Happy or angry
|
||||||
|
* @param string $message The message to display
|
||||||
|
*/
|
||||||
|
public function __construct($type, $message) {
|
||||||
|
$this->message = $message;
|
||||||
|
switch ($type) {
|
||||||
|
case "happy":
|
||||||
|
$this->class = "settings-message-happy";
|
||||||
|
break;
|
||||||
|
case "angry":
|
||||||
|
$this->class = "settings-message-angry";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$this->class = "settings-message";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getClass() {
|
||||||
|
return $this->class;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getMessage() {
|
||||||
|
return $this->message;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the settings form the database.
|
||||||
|
* @return mixed Setting as an array.
|
||||||
|
*/
|
||||||
function getSettings() {
|
function getSettings() {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = $GLOBALS["db"]->prepare("
|
||||||
SELECT
|
SELECT
|
||||||
@@ -59,40 +96,28 @@ function updateSettings() {
|
|||||||
|
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
|
|
||||||
return array (
|
return new settingsMessage("happy", "Instellingen zijn opgeslagen.");
|
||||||
"type" => "settings-message-happy",
|
|
||||||
"message" => "Instellingen zijn opgeslagen."
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function updatePassword() {
|
function updatePassword() {
|
||||||
$user = getPasswordHash();
|
$user = getPasswordHash();
|
||||||
if (password_verify($_POST["password-old"].strtolower($user["username"]), $user["password"])) {
|
if (password_verify($_POST["password-old"], $user["password"])) {
|
||||||
if ($_POST["password-new"] == $_POST["password-confirm"] && (strlen($_POST["password-new"]) >= 8)) {
|
if ($_POST["password-new"] == $_POST["password-confirm"] && (strlen($_POST["password-new"]) >= 8)) {
|
||||||
if (changePassword($user)) {
|
if (changePassword()) {
|
||||||
return array ("type" => "settings-message-happy",
|
return new settingsMessage("happy", "Wachtwoord gewijzigd.");
|
||||||
"message" => "Wachtwoord gewijzigd.");
|
|
||||||
} else {
|
} else {
|
||||||
return array (
|
return new settingsMessage("angry", "Er is iets mis gegaan.");
|
||||||
"type" => "settings-message-angry",
|
|
||||||
"message" => "Er is iets mis gegaan.");
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return array (
|
return new settingsMessage("angry", "Wachtwoorden komen niet oveen.");
|
||||||
"type" => "settings-message-angry",
|
|
||||||
"message" => "Wachtwoorden komen niet oveeen."
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return array(
|
return new settingsMessage("angry", "Oud wachtwoord niet correct.");
|
||||||
"type" => "settings-message-angry",
|
|
||||||
"message" => "Oud wachtwoord niet correct."
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function changePassword($user) {
|
function changePassword() {
|
||||||
$stmt =$GLOBALS["db"]->prepare("
|
$stmt = $GLOBALS["db"]->prepare("
|
||||||
UPDATE
|
UPDATE
|
||||||
`user`
|
`user`
|
||||||
SET
|
SET
|
||||||
@@ -101,9 +126,62 @@ function changePassword($user) {
|
|||||||
`userID` = :userID
|
`userID` = :userID
|
||||||
");
|
");
|
||||||
|
|
||||||
$hashed_password = password_hash($_POST["password-new"].strtolower($user["username"]), PASSWORD_DEFAULT);
|
$hashed_password = password_hash($_POST["password-new"], PASSWORD_DEFAULT);
|
||||||
$stmt->bindParam(":new_password", $hashed_password);
|
$stmt->bindParam(":new_password", $hashed_password);
|
||||||
$stmt->bindParam(":userID", $_SESSION["userID"]);
|
$stmt->bindParam(":userID", $_SESSION["userID"]);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
return $stmt->rowCount();
|
return $stmt->rowCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function changeEmail() {
|
||||||
|
|
||||||
|
if ($_POST["email"] == $_POST["email-confirm"]) {
|
||||||
|
$email = strtolower($_POST["email"]);
|
||||||
|
if (filter_var($email, FILTER_VALIDATE_EMAIL)) {
|
||||||
|
//check if email exists
|
||||||
|
if (emailIsAvailableInDatabase($email)) {
|
||||||
|
if (doChangeEmail($email)) {
|
||||||
|
return new settingsMessage("happy", "Emailadres is veranderd.");
|
||||||
|
} else {
|
||||||
|
return new settingsMessage("angry", "Er is iets mis gegaan.");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return new settingsMessage("angry", "Emailadres bestaat al.");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return new settingsMessage("angry", "Geef een geldig emailadres.");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return new settingsMessage("angry", "Emailadressen komen niet overeen.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function emailIsAvailableInDatabase($email) {
|
||||||
|
$stmt = $GLOBALS["db"]->prepare("
|
||||||
|
SELECT
|
||||||
|
`email`
|
||||||
|
FROM
|
||||||
|
`user`
|
||||||
|
WHERE
|
||||||
|
`email` = :email
|
||||||
|
");
|
||||||
|
|
||||||
|
$stmt->bindParam(":email", $email);
|
||||||
|
$stmt->execute();
|
||||||
|
return !$stmt->rowCount();
|
||||||
|
}
|
||||||
|
|
||||||
|
function doChangeEmail($email) {
|
||||||
|
$stmt = $GLOBALS["db"]->prepare("
|
||||||
|
UPDATE
|
||||||
|
`user`
|
||||||
|
SET
|
||||||
|
`email` = :email
|
||||||
|
WHERE
|
||||||
|
`userID` = :userID
|
||||||
|
");
|
||||||
|
$stmt->bindParam(":email", $email);
|
||||||
|
$stmt->bindParam(":userID", $_SESSION["userID"]);
|
||||||
|
$stmt->execute();
|
||||||
|
return $stmt->rowCount();
|
||||||
|
}
|
||||||
@@ -86,8 +86,8 @@ function selectAllUserPosts($userID) {
|
|||||||
return $stmt;
|
return $stmt;
|
||||||
}
|
}
|
||||||
|
|
||||||
function select20UsersFromN($db, $n) {
|
function select20UsersFromN($n) {
|
||||||
return $db->query("
|
return $GLOBALS["db"]->query("
|
||||||
SELECT
|
SELECT
|
||||||
`userID`,
|
`userID`,
|
||||||
`username`,
|
`username`,
|
||||||
@@ -103,8 +103,8 @@ function select20UsersFromN($db, $n) {
|
|||||||
");
|
");
|
||||||
}
|
}
|
||||||
|
|
||||||
function search20UsersFromN($db, $n, $keyword) {
|
function search20UsersFromN($n, $keyword) {
|
||||||
$q = $db->prepare("
|
$q = $GLOBALS["db"]->prepare("
|
||||||
SELECT
|
SELECT
|
||||||
`userID`,
|
`userID`,
|
||||||
`username`,
|
`username`,
|
||||||
@@ -127,8 +127,8 @@ function search20UsersFromN($db, $n, $keyword) {
|
|||||||
return $q;
|
return $q;
|
||||||
}
|
}
|
||||||
|
|
||||||
function search20UsersFromNByStatus($db, $n, $keyword, $status) {
|
function search20UsersFromNByStatus($n, $keyword, $status) {
|
||||||
$q = $db->prepare("
|
$q = $GLOBALS["db"]->prepare("
|
||||||
SELECT
|
SELECT
|
||||||
`userID`,
|
`userID`,
|
||||||
`username`,
|
`username`,
|
||||||
@@ -155,8 +155,8 @@ function search20UsersFromNByStatus($db, $n, $keyword, $status) {
|
|||||||
return $q;
|
return $q;
|
||||||
}
|
}
|
||||||
|
|
||||||
function changeUserStatusByID($db, $id, $status) {
|
function changeUserStatusByID($id, $status) {
|
||||||
$q = $db->query("
|
$q = $GLOBALS["db"]->query("
|
||||||
UPDATE
|
UPDATE
|
||||||
`user`
|
`user`
|
||||||
SET
|
SET
|
||||||
|
|||||||
@@ -61,9 +61,9 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($_POST["actions"]) && !empty($_POST["userID"])) {
|
if (!empty($_POST["actions"]) && !empty($_POST["userID"])) {
|
||||||
changeUserStatusByID($db, $_POST["userID"], $_POST["actions"]);
|
changeUserStatusByID($_POST["userID"], $_POST["actions"]);
|
||||||
} elseif (!empty($_POST["actions"]) && !empty($_POST["groupID"])) {
|
} elseif (!empty($_POST["actions"]) && !empty($_POST["groupID"])) {
|
||||||
changeGroupStatusByID($db, $_POST["groupID"], $_POST["actions"]);
|
changeGroupStatusByID($_POST["groupID"], $_POST["actions"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -183,7 +183,7 @@ function test_input($data) {
|
|||||||
<!-- Table construction via php PDO. -->
|
<!-- Table construction via php PDO. -->
|
||||||
<?php
|
<?php
|
||||||
if ($pagetype == 'user') {
|
if ($pagetype == 'user') {
|
||||||
$q = search20UsersFromNByStatus($db, $listnr, $search, $status);
|
$q = search20UsersFromNByStatus($listnr, $search, $status);
|
||||||
|
|
||||||
while($user = $q->fetch(PDO::FETCH_ASSOC)) {
|
while($user = $q->fetch(PDO::FETCH_ASSOC)) {
|
||||||
$userID = $user['userID'];
|
$userID = $user['userID'];
|
||||||
@@ -218,7 +218,7 @@ function test_input($data) {
|
|||||||
");
|
");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$q = search20GroupsFromNByStatus($db, $listnr, $search, $groupstatus);
|
$q = search20GroupsFromNByStatus($listnr, $search, $groupstatus);
|
||||||
|
|
||||||
while ($group = $q->fetch(PDO::FETCH_ASSOC)) {
|
while ($group = $q->fetch(PDO::FETCH_ASSOC)) {
|
||||||
$groupID = $group['groupID'];
|
$groupID = $group['groupID'];
|
||||||
|
|||||||
@@ -6,11 +6,8 @@
|
|||||||
<?php
|
<?php
|
||||||
include_once("../queries/friendship.php");
|
include_once("../queries/friendship.php");
|
||||||
|
|
||||||
if (empty($_SESSION["userID"]))
|
|
||||||
$_SESSION["userID"] = 2;
|
|
||||||
|
|
||||||
// Get all the friends of a user.
|
// Get all the friends of a user.
|
||||||
$friends = selectAllFriends($db, $_SESSION["userID"]);
|
$friends = selectAllFriends($_SESSION["userID"]);
|
||||||
$i = 0;
|
$i = 0;
|
||||||
|
|
||||||
// Print all the users.
|
// Print all the users.
|
||||||
@@ -28,7 +25,7 @@
|
|||||||
|
|
||||||
// Echo the friend.
|
// Echo the friend.
|
||||||
echo "
|
echo "
|
||||||
<li class='friend-item' onclick='switchUser(\"$userID\")'>
|
<li class='friend-item' id='friend-item-$userID' onclick='switchUser(\"$userID\")'>
|
||||||
<div class='friend'>
|
<div class='friend'>
|
||||||
<img alt='PF' class='profile-picture' src='$pf'/>
|
<img alt='PF' class='profile-picture' src='$pf'/>
|
||||||
$username
|
$username
|
||||||
@@ -38,12 +35,6 @@
|
|||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</ul>
|
</ul>
|
||||||
<!-- <a href="#">-->
|
|
||||||
<!-- <div class="chat-conversation">-->
|
|
||||||
<!-- <img class="profile-picture" src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTDnuRSeeyPve7KwDvJJ6OBzj3gyghwLcE2z9kZeYBOyZavh3mw">-->
|
|
||||||
<!-- Rudolf Leslo-->
|
|
||||||
<!-- </div>-->
|
|
||||||
<!-- </a>-->
|
|
||||||
</nav>
|
</nav>
|
||||||
<div class="chat-right right">
|
<div class="chat-right right">
|
||||||
<div id="chat-history" class="chat-history platform">
|
<div id="chat-history" class="chat-history platform">
|
||||||
@@ -74,7 +65,7 @@
|
|||||||
<input type="text"
|
<input type="text"
|
||||||
name="content"
|
name="content"
|
||||||
id="newContent"
|
id="newContent"
|
||||||
placeholder="Reageer..."
|
placeholder="Schrijf een bericht..."
|
||||||
autofocus
|
autofocus
|
||||||
required
|
required
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -18,3 +18,7 @@
|
|||||||
include_once("../queries/connect.php");
|
include_once("../queries/connect.php");
|
||||||
|
|
||||||
session_start();
|
session_start();
|
||||||
|
|
||||||
|
if(!isset($_SESSION["userID"])){
|
||||||
|
header("location:login.php");
|
||||||
|
}
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
<?php
|
<?php
|
||||||
session_start();
|
|
||||||
include_once ("../queries/header.php");
|
include_once ("../queries/header.php");
|
||||||
|
|
||||||
$userinfo = getHeaderInfo();
|
$userinfo = getHeaderInfo();
|
||||||
@@ -21,7 +20,7 @@ $userinfo = getHeaderInfo();
|
|||||||
</div>
|
</div>
|
||||||
<div class="right profile-menu">
|
<div class="right profile-menu">
|
||||||
<div id="profile-menu-popup">
|
<div id="profile-menu-popup">
|
||||||
<a href="index.php"><span style="color: red;" class="fa fa-sign-out" data-title="Uitloggen"></span></a> |
|
<a href="logout.php"><span style="color: red;" class="fa fa-sign-out" data-title="Uitloggen"></span></a> |
|
||||||
<a href="settings.php"><span style="color: blue;" class="fa fa-cog" data-title="Instellingen"></span></a> |
|
<a href="settings.php"><span style="color: blue;" class="fa fa-cog" data-title="Instellingen"></span></a> |
|
||||||
<a href="profile.php"><span style="color: green;" class="fa fa-user" data-title="Profiel"></span></a>
|
<a href="profile.php"><span style="color: green;" class="fa fa-user" data-title="Profiel"></span></a>
|
||||||
</div>
|
</div>
|
||||||
@@ -29,7 +28,7 @@ $userinfo = getHeaderInfo();
|
|||||||
<div id="hello-loop">
|
<div id="hello-loop">
|
||||||
Hallo
|
Hallo
|
||||||
</div>
|
</div>
|
||||||
<?=$userinfo["fname"]?> <?=$userinfo["lname"]?>
|
<?=$userinfo["fname"]?>
|
||||||
</div>
|
</div>
|
||||||
<img id="own-profile-picture" class="profile-picture" src="<?=$userinfo["profilepicture"]?>"/>
|
<img id="own-profile-picture" class="profile-picture" src="<?=$userinfo["profilepicture"]?>"/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -3,12 +3,12 @@
|
|||||||
src="img/top-logo.png"
|
src="img/top-logo.png"
|
||||||
alt="MyHyvesbook+">
|
alt="MyHyvesbook+">
|
||||||
</div>
|
</div>
|
||||||
|
<div class="platform">
|
||||||
<!-- Login content -->
|
<h1>Welkom bij MyHyvesbook+</h1>
|
||||||
<form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>"
|
<!-- Login content -->
|
||||||
|
<form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>"
|
||||||
return= $correct
|
return= $correct
|
||||||
method="post">
|
method="post">
|
||||||
<h1>Welkom bij MyHyvesbook+</h1>
|
|
||||||
|
|
||||||
<!-- Login name -->
|
<!-- Login name -->
|
||||||
<div class="login_containerlogin">
|
<div class="login_containerlogin">
|
||||||
@@ -43,9 +43,9 @@
|
|||||||
Login
|
Login
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
<!-- Button for going to the register screen -->
|
||||||
<!-- Button for going to the register screen -->
|
<div class="login_containerlogin">
|
||||||
<div class="login_containerlogin">
|
<a href="https://myhyvesbookplus.nl/register.php" class="button">Registreer een account</a>
|
||||||
<a href="https://myhyvesbookplus.nl/~joey/public/register.php" class="button">Registreer een account</a>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<title>MyHyvesbook+</title>
|
<title>MyHyvesbook+</title>
|
||||||
|
<link rel="stylesheet"
|
||||||
|
type="text/css"
|
||||||
|
href="styles/main.css">
|
||||||
<link rel="stylesheet"
|
<link rel="stylesheet"
|
||||||
type="text/css"
|
type="text/css"
|
||||||
href="styles/index.css">
|
href="styles/index.css">
|
||||||
|
|||||||
@@ -9,9 +9,6 @@
|
|||||||
// Load file.
|
// Load file.
|
||||||
include_once("../queries/friendship.php");
|
include_once("../queries/friendship.php");
|
||||||
|
|
||||||
if (empty($_SESSION["userID"]))
|
|
||||||
$_SESSION["userID"] = 2;
|
|
||||||
|
|
||||||
// Get all the friends of a user.
|
// Get all the friends of a user.
|
||||||
$friends = selectAllFriends($_SESSION["userID"]);
|
$friends = selectAllFriends($_SESSION["userID"]);
|
||||||
$i = 0;
|
$i = 0;
|
||||||
@@ -69,7 +66,7 @@
|
|||||||
include_once("../queries/group_member.php");
|
include_once("../queries/group_member.php");
|
||||||
|
|
||||||
// Get all the friends of a user.
|
// Get all the friends of a user.
|
||||||
$groups = selectAllGroupsFromUser($db, $_SESSION["userID"]);
|
$groups = selectAllGroupsFromUser($_SESSION["userID"]);
|
||||||
$i = 0;
|
$i = 0;
|
||||||
|
|
||||||
// Print all the users.
|
// Print all the users.
|
||||||
|
|||||||
@@ -4,11 +4,12 @@
|
|||||||
alt="MyHyvesbook+">
|
alt="MyHyvesbook+">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Register Content -->
|
<div class="platform">
|
||||||
<form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>"
|
<h1>Registreer uw account</h1>
|
||||||
|
<!-- Register Content -->
|
||||||
|
<form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>"
|
||||||
return= $correct
|
return= $correct
|
||||||
method="post">
|
method="post">
|
||||||
<h2>Registreer uw account</h2>
|
|
||||||
|
|
||||||
<!-- Error message -->
|
<!-- Error message -->
|
||||||
<div class="login_containerfault"><?php echo $genericErr;?></span></div>
|
<div class="login_containerfault"><?php echo $genericErr;?></span></div>
|
||||||
@@ -22,7 +23,7 @@
|
|||||||
value="<?php echo $name ?>"
|
value="<?php echo $name ?>"
|
||||||
title="Mag alleen letters bevatten"
|
title="Mag alleen letters bevatten"
|
||||||
>
|
>
|
||||||
<span class="error">* <?php echo $nameErr;?></span>
|
*<span class="error"><?php echo $nameErr;?></span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Register surname -->
|
<!-- Register surname -->
|
||||||
@@ -34,7 +35,7 @@
|
|||||||
value="<?php echo $surname ?>"
|
value="<?php echo $surname ?>"
|
||||||
title="Mag alleen letters bevatten"
|
title="Mag alleen letters bevatten"
|
||||||
>
|
>
|
||||||
<span class="error">* <?php echo $surnameErr;?></span>
|
*<span class="error"> <?php echo $surnameErr;?></span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Register birthday -->
|
<!-- Register birthday -->
|
||||||
@@ -46,7 +47,7 @@
|
|||||||
id="bday"
|
id="bday"
|
||||||
placeholder="01/01/1900"
|
placeholder="01/01/1900"
|
||||||
>
|
>
|
||||||
<span class="error">* <?php echo $bdayErr;?></span>
|
*<span class="error"> <?php echo $bdayErr;?></span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Register username -->
|
<!-- Register username -->
|
||||||
@@ -58,12 +59,12 @@
|
|||||||
value="<?php echo $username ?>"
|
value="<?php echo $username ?>"
|
||||||
title="Moet minimaal 6 karakters bevatten"
|
title="Moet minimaal 6 karakters bevatten"
|
||||||
>
|
>
|
||||||
<span class="error">* <?php echo $usernameErr;?></span>
|
*<span class="error"> <?php echo $usernameErr;?></span>
|
||||||
</div>
|
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
<li>Minstens 6 karakters</li>
|
<li>Minstens 6 karakters</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<!-- Register password -->
|
<!-- Register password -->
|
||||||
<div class="login_containerregister">
|
<div class="login_containerregister">
|
||||||
@@ -74,13 +75,11 @@
|
|||||||
value="<?php echo $password ?>"
|
value="<?php echo $password ?>"
|
||||||
id="password"
|
id="password"
|
||||||
>
|
>
|
||||||
<span class="error">* <?php echo $passwordErr;?></span>
|
*<span class="error"> <?php echo $passwordErr;?></span>
|
||||||
</div>
|
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
<li>Minstens 8 karakters</li>
|
<li>Minstens 8 karakters</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
</div>
|
||||||
<!-- Repeat password -->
|
<!-- Repeat password -->
|
||||||
<div class="login_containerregister">
|
<div class="login_containerregister">
|
||||||
<label><b>Herhaal wachtwoord</b></label>
|
<label><b>Herhaal wachtwoord</b></label>
|
||||||
@@ -91,7 +90,7 @@
|
|||||||
id="confirmpassword"
|
id="confirmpassword"
|
||||||
title="Herhaal wachtwoord"
|
title="Herhaal wachtwoord"
|
||||||
>
|
>
|
||||||
<span class="error">* <?php echo $confirmpasswordErr;?></span>
|
*<span class="error"> <?php echo $confirmpasswordErr;?></span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Register location -->
|
<!-- Register location -->
|
||||||
@@ -103,19 +102,19 @@
|
|||||||
value="<?php echo $location ?>"
|
value="<?php echo $location ?>"
|
||||||
pattern="[A-Za-z]{1,}"
|
pattern="[A-Za-z]{1,}"
|
||||||
title="Mag alleen letters bevatten">
|
title="Mag alleen letters bevatten">
|
||||||
<span class="error">* <?php echo $locationErr;?></span>
|
*<span class="error"> <?php echo $locationErr;?></span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Register email -->
|
<!-- Register email -->
|
||||||
<div class="login_containerregister">
|
<div class="login_containerregister">
|
||||||
<label><b>Email</b></label>
|
<label><b>Email</b></label>
|
||||||
<input type="email"
|
<input type="text"
|
||||||
placeholder="Voer uw email in"
|
placeholder="Voer uw email in"
|
||||||
name="email"
|
name="email"
|
||||||
value="<?php echo $email ?>"
|
value="<?php echo $email ?>"
|
||||||
id="email"
|
id="email"
|
||||||
title="Voer een geldige email in">
|
title="Voer een geldige email in">
|
||||||
<span class="error">* <?php echo $emailErr;?></span>
|
*<span class="error"> <?php echo $emailErr;?></span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Button for registering -->
|
<!-- Button for registering -->
|
||||||
@@ -127,9 +126,10 @@
|
|||||||
Registreer uw account
|
Registreer uw account
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<!-- Button for going back to login screen -->
|
<!-- Button for going back to login screen -->
|
||||||
<div class="login_containerlogin">
|
<div class="login_containerlogin">
|
||||||
<a href="https://myhyvesbookplus.nl/~joey/public/login.php" class="button">Login met een account</a>
|
<a href="https://myhyvesbookplus.nl/login.php" class="button">Login met een account</a>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -6,9 +6,9 @@ $settings = getSettings();
|
|||||||
<div class="settings">
|
<div class="settings">
|
||||||
<?php
|
<?php
|
||||||
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||||
echo "<div class='platform settings-message ${result["type"]}'>
|
echo "<div class='platform settings-message ". $result->getClass()."'>".
|
||||||
${result["message"]}
|
$result->getMessage().
|
||||||
</div>";
|
"</div>";
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<form class="settings-profile platform" method="post">
|
<form class="settings-profile platform" method="post">
|
||||||
|
|||||||
Reference in New Issue
Block a user