Marijn button #99

Merged
11166932 merged 152 commits from marijn-button into master 2017-01-23 13:25:08 +01:00
52 changed files with 2206 additions and 925 deletions
Showing only changes of commit 46b47d5f8d - Show all commits

2
.gitignore vendored
View File

@@ -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

View File

@@ -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>

12
website/public/.htaccess Normal file
View File

@@ -0,0 +1,12 @@
Options +FollowSymLinks
RewriteEngine On
ErrorDocument 404 /error404.jpg
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
# Resolve .php file for extensionless php urls
RewriteRule ^([^/.]+)$ $1.php [L]
RewriteRule ^profile/([A-z0-9]+)$ profile.php?username=$1 [NC]

View File

@@ -0,0 +1,13 @@
<?php
session_start();
require_once("../../queries/connect.php");
require_once("../../queries/private_message.php");
require_once("../../queries/checkInput.php");
if (isset($_POST["lastID"]) && $_POST["lastID"] != "") {
echo getNewChatMessages(test_input($_POST["lastID"]), test_input($_POST["destination"]));
} else {
echo getOldChatMessages(test_input($_POST["destination"]));
}

View File

@@ -0,0 +1,8 @@
<?php
session_start();
require_once ("../../queries/connect.php");
require_once ("../../queries/friendship.php");
echo selectAllFriendRequests();

View File

@@ -0,0 +1,17 @@
<?php
session_start();
require_once("../../queries/connect.php");
require_once("../../queries/private_message.php");
require_once("../../queries/checkInput.php");
if (!empty(test_input($_POST["destination"])) &&
!empty(test_input($_POST["content"]))) {
if (sendMessage(test_input($_POST["destination"]), test_input($_POST["content"]))) {
echo 1;
} else {
echo 0;
}
} else {
echo 0;
}

View File

@@ -5,6 +5,7 @@
<style> <style>
@import url("styles/chat.css"); @import url("styles/chat.css");
</style> </style>
<script src="js/chat.js"></script>
</head> </head>
<body> <body>
<?php <?php

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

View File

@@ -0,0 +1,44 @@
window.onload = function() {
changeFilter();
};
function checkAll(allbox) {
var checkboxes = document.getElementsByClassName('checkbox-list');
for (var i = 0; i < checkboxes.length; i++) {
if (checkboxes[i].type == 'checkbox') {
checkboxes[i].checked = allbox.checked;
}
}
}
function checkCheckAll(allbox) {
var checkboxes = document.getElementsByClassName('checkbox-list');
var checked = true;
for (var i = 0; i < checkboxes.length; i++) {
if (checkboxes[i].type == 'checkbox') {
if (checkboxes[i].checked == false) {
checked = false;
break;
}
}
}
allbox.checked = checked;
}
function changeFilter() {
if (document.getElementById('group').checked) {
document.getElementById('admin-filter').style.display = 'none';
document.getElementById('admin-groupfilter').style.display = 'inline-block';
document.getElementById('admin-batchactions').style.display = 'none';
document.getElementById('admin-groupbatchactions').style.display = 'inline-block';
} else {
document.getElementById('admin-filter').style.display = 'inline-block';
document.getElementById('admin-groupfilter').style.display = 'none';
document.getElementById('admin-batchactions').style.display = 'inline-block';
document.getElementById('admin-groupbatchactions').style.display = 'none';
}
}

62
website/public/js/chat.js Normal file
View File

@@ -0,0 +1,62 @@
$(document).ready(function() {
loadMessages();
sayEmpty();
$(".chat-field").hide();
});
function loadMessages() {
$.post(
"API/loadMessages.php",
$("#lastIDForm").serialize()
).done(function(data) {
if (data && data != "[]") {
messages = JSON.parse(data);
addMessages(messages);
$("#lastID").val(messages[messages.length - 1].messageID);
$("#chat-history").scrollTop($("#chat-history")[0].scrollHeight);
}
});
setTimeout(loadMessages, 1000);
}
function sendMessage() {
$.post(
"API/sendMessage.php",
$("#sendMessageForm").serialize()
);
$("#newContent").val("");
}
function addMessages(messages) {
for(i in messages) {
if (messages[i].destination == $(".destinationID").val()) {
type = "chat-message-self";
} else {
type = "chat-message-other";
}
$("#chat-history").append('\
<div class="chat-message"> \
<div class="' + type + '">\
' + messages[i].content + '\
</div> \
</div>\
');
}
}
function switchUser(userID) {
$(".chat-field").show();
$(".destinationID").val(userID);
$("#chat-history").html("");
$("#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!");
}

View File

@@ -1,7 +1,33 @@
$(document).ready(function() { $(document).ready(function() {
// Hide notification center.
$("#profile-menu-popup").hide(); $("#profile-menu-popup").hide();
// $("#own-profile-picture").click(function() {
// $("#profile-menu-popup").toggle();
// $("#profile-hello-popup").toggle();
// });
$("#own-profile-picture").click(function() { $("#own-profile-picture").click(function() {
$("#profile-menu-popup").toggle(); if($("#notification-center").css('right') == "-256px") {
$("#profile-hello-popup").toggle(); $(".content").animate({
marginRight: "256px"
}, 500);
$(".chat-right").animate({
width: "100%"
}, 500);
$("#notification-center").animate({
right: "0px"
}, 500);
} else {
$(".chat-right").animate({
width: "100%"
}, 500);
$(".content").animate({
marginRight: "0px"
}, 500);
$("#notification-center").animate({
right: "-256px"
}, 500);
}
}); });
}); });

View File

@@ -6,7 +6,7 @@ $(document).ready(function() {
$("#more-friends-click").click(function() { $("#more-friends-click").click(function() {
// Show only friends // Show only friends
$("#groups-menu-section").slideUp(); $("#groups-menu-section").slideUp();
$("#friends-menu-section a").show(); $("#friends-menu-section li").show();
// Change buttons // Change buttons
$("#more-friends-click").hide(); $("#more-friends-click").hide();
@@ -17,7 +17,7 @@ $(document).ready(function() {
$("#more-groups-click").click(function() { $("#more-groups-click").click(function() {
// Show only groups // Show only groups
$("#friends-menu-section").slideUp(); $("#friends-menu-section").slideUp();
$("#groups-menu-section a").show(); $("#groups-menu-section li").show();
// Change buttons // Change buttons
$("#more-groups-click").hide(); $("#more-groups-click").hide();

View File

@@ -0,0 +1,34 @@
function showNotifications(notifications, id) {
$("#friendrequestslist").html("");
for (i in notifications) {
$("#friendrequestslist").append(" \
<li class='friend-item $extraItem'> \
<form action='profile.php' method='get'> \
<button type='submit' \
name='username' \
value='"+ notifications[i].username +"'> \
<div class='friend'> \
<img alt='PF' class='profile-picture' src='"+ notifications[i].profilepicture +"'/> \
"+ notifications[i].username +" \
</div> \
</button> \
</form> \
</li> \
");
}
}
function loadNotifications() {
$.post(
"API/loadNotifications.php"
).done(function(data) {
if (data && data != "[]") {
showNotifications(JSON.parse(data), "friendrequestslist");
}
});
setTimeout(loadNotifications, 10000);
}
loadNotifications();

View File

@@ -0,0 +1,8 @@
function checkLoggedIn() {
if (confirm("You are already logged in!\nDo you want to logout?\nPress ok to logout.") == true) {
window.location.href = "logout.php";
} else {
window.location.href = "profile.php";
}
document.getElementById("demo").innerHTML = x;
}

View File

@@ -2,13 +2,20 @@
<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");
include_once("../queries/checkInput.php");
?> ?>
<body> <body>
<?php <?php
session_start(); session_start();
if(isset($_SESSION["userID"])){
echo "<script>
window.onload=checkLoggedIn();
</script>";
}
// Define variables and set to empty values // Define variables and set to empty values
$uname = $psw =""; $uname = $psw ="";
$loginErr =""; $loginErr ="";
@@ -21,15 +28,15 @@
} }
else { else {
$uname=strtolower($_POST["uname"]); $uname = strtolower(test_input($_POST["uname"]));
$psw=$_POST["psw"]; $psw = test_input($_POST["psw"]);
$hash=hashPassword()["password"]; $hash = getUser()["password"];
$userid=hashPassword()["userID"]; $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");
} else { } else {
$loginErr = "Inloggegevens zijn niet correct"; $loginErr = "Inloggegevens zijn niet correct";

15
website/public/logout.php Normal file
View 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>

View File

@@ -2,12 +2,28 @@
<html> <html>
<head> <head>
<?php include("../views/head.php"); ?> <?php include("../views/head.php"); ?>
<script src="/js/masonry.js"></script>
<style> <style>
@import url("styles/profile.css"); @import url("styles/profile.css");
</style> </style>
</head> </head>
<body> <body>
<?php <?php
include("../queries/user.php");
include("../queries/friendship.php");
include("../queries/nicetime.php");
if(empty($_GET["username"])) {
$userID = $_SESSION["userID"];
} else {
$userID = getUserID($_GET["username"]);
}
$user = selectUser($userID);
$profile_friends = selectAllFriends($userID);
$profile_groups = selectAllUserGroups($userID);
$posts = selectAllUserPosts($userID);
/* /*
* This view adds the main layout over the screen. * This view adds the main layout over the screen.
* Header, menu, footer. * Header, menu, footer.

View File

@@ -2,162 +2,42 @@
<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
session_start(); session_start();
if(isset($_SESSION["userID"])){
header("location: profile.php");
}
// define variables and set to empty values // define variables and set to empty values
$name = $surname = $bday = $username = $password = $confirmpassword = $location = $housenumber = $email = ""; $name = $surname = $bday = $username = $password = $confirmpassword = $location = $housenumber = $email = "";
$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", "longerEight");
$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");
?> ?>

View File

@@ -1,7 +1,11 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<?php include("../views/head.php"); ?> <?php
include_once("../queries/user.php");
include_once("../queries/group_page.php");
include("../views/head.php");
?>
<style> <style>
@import url("styles/search.css"); @import url("styles/search.css");
</style> </style>

View File

@@ -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"]) {
@@ -21,19 +22,14 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
$result = updateSettings(); $result = updateSettings();
break; break;
case "password": case "password":
$result = updatePassword(); $result = changePassword();
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 ( updateProfilePicture();
"type" => "settings-message-angry", $result = new settingsMessage("happy", "Deze melding doet nog niks nuttigs.");
"message" => "Deze functie werkt nog niet :("
);
break; break;
} }
} }

View File

@@ -6,22 +6,26 @@
.admin-title { .admin-title {
margin: 10px; margin: 10px;
padding-bottom: 5px; padding-bottom: 5px;
border-bottom: 4px solid #845663; border-bottom: 4px solid #FBC02D;
} }
.admin-panel input[type="radio"], input[type="checkbox"] { .admin-panel input[type="radio"], input[type="checkbox"] {
height: auto; height: auto;
} }
.admin-actions { .admin-batchactions, .admin-groupbatchactions {
display: inline-block; display: inline-block;
padding: 8px; padding: 8px;
vertical-align: top; vertical-align: top;
border-radius: 10px; border-radius: 10px;
border: 4px solid #845663; border: 4px solid #FBC02D;
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);
} }
.admin-searchform {
display: inline-block;
}
.admin-searchbar { .admin-searchbar {
display: inline-block; display: inline-block;
margin: 10px; margin: 10px;
@@ -32,17 +36,38 @@
margin-bottom: 10px; margin-bottom: 10px;
} }
.admin-filter { .admin-filter, .admin-filtertype, .admin-groupfilter {
display: inline-block; display: inline-block;
margin: 10px; margin: 10px;
vertical-align: top; vertical-align: top;
margin-right: 100px; margin-right: 50px;
margin-left: 50px;
}
.admin-filter, .admin-groupfilter {
width: 120px;
} }
.admin-users { .admin-users {
margin: 10px; margin: 10px;
} }
.admin-userheading {
width: auto;
float: left;
}
.admin-pageui {
text-align: right;
float: right;
width: auto;
margin-bottom: 20px;
}
.usertitle {
width: 150px;
}
.usertable { .usertable {
width: 100%; width: 100%;
} }

View File

@@ -83,9 +83,14 @@
.chat-field input[type="submit"] { .chat-field input[type="submit"] {
width: auto; width: auto;
float: right; float: right;
background-color: #845663; background-color: #FBC02D;
color: white; color: white;
padding: 5px 10px; padding: 5px 10px;
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;
} }

View File

@@ -8,21 +8,23 @@ header {
width: 100%; width: 100%;
color: white; color: white;
background-color: rgba(132,86,99, 0.98); background-color: #FBC02D;
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);
} }
#header-logo {
padding-left: 42px;
}
#header-logo, #header-logo img { #header-logo, #header-logo img {
height: 80px; height: 80px;
vertical-align: middle; vertical-align: middle;
line-height: 80px; line-height: 80px;
padding-left: 5px;
} }
#header-search { #header-search {
padding-left: 48px; padding-left: 42px;
} }
@@ -33,32 +35,12 @@ header {
header div { header div {
display: inline-block; display: inline-block;
} }
#open-chat {
font-size: 32px;
line-height: 80px;
margin-right: 50px;
}
.profile-menu {
font-size: 21px;
}
.profile-menu img { .profile-menu img {
padding: 8px; padding: 8px;
height: 64px; height: 64px;
width: 64px; width: 64px;
} }
#own-profile-picture, #profile-menu-popup span { #own-profile-picture {
cursor: pointer; cursor: pointer;
} }
#profile-menu-popup {
padding: 5px;
background: white;
color: #666;
border-radius: 3px;
}

View File

@@ -1,23 +1,7 @@
::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: #C8CABD;
border: 2px solid black; border-radius: 10px;
border-radius: 12px; color: black;
color: white;
cursor: pointer; cursor: pointer;
height: 50%; height: 50%;
margin: 8px 0; margin: 8px 0;
@@ -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(http://play.pokemonshowdown.com/fx/client-bg-shaymin.jpg);
background-size: cover;
background-attachment: fixed;*/
background-image: url(https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTEnqKdVtLbxjKuNsCSCxFRhTOpp3Gm0gsU8bMgA_MeUYyzrUFy); /*background-color: #EEE;*/
background-size: contain;
background-repeat: repeat-x;
background-attachment: fixed;
/*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: 57%; height: 80%;
margin: 8px auto; margin: auto;
width: 45%; width: 70%;
overflow: 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*/
@@ -129,37 +66,67 @@ h2 {
font-size: 2.0em; font-size: 2.0em;
} }
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: 60%;
padding: 12px 20px; padding: 8px 20px;
margin: 8px 0; margin: 4px 0;
width: 50%; width: 70%;
}
/*
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] {
background-color: #C8CABD;
color: black ;
cursor: pointer;
font-family: Arial; font-family: Arial;
font-size: 16px; font-size: 16px;
width: 50%;
} }
input[type=submit] { .error {
background-color: #845663;
border: 2px solid black;
border-radius: 12px;
color: white;
cursor: pointer;
height: 50%;
margin: 8px 0;
padding: 14px 20px;
width: 50%;
font-family: Arial; font-family: Arial;
font-size: 16px; font-size: 15px;
color: red;
} }
label { label {
display: block; display: block;
} }
.left-arrow {
display: inline-block;
position: relative;
background-color: #C8CABD;
height: 30px;
width: 90px;
padding: 3px 3px 3px 0px;
text-align: center;
border-radius: 0px 10px 10px 0px;
font-size: 24px;
}
.left-arrow:after {
content: '';
display: block;
position: absolute;
right: 100%;
top: 0;
bottom: 0;
border-top: 15px solid transparent;
border-right: 20px solid #C8CABD;
border-bottom: 15px solid transparent;
border-left: 0px solid transparent;
}
/* padding voor registreer container */ /* padding voor registreer container */
.login_containerregister { .login_containerregister {
padding: 16px; padding: 16px;
@@ -168,7 +135,7 @@ label {
/* padding voor login_containers */ /* padding voor login_containers */
.login_containerlogin { .login_containerlogin {
padding: 16px; padding:25px;
text-align: center; text-align: center;
} }
@@ -179,52 +146,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: 550px;
width: 18%; margin: 34px auto;
font-family: Arial; overflow-y: auto;
font-size: 16px; padding: 20px;
width: 50%;
} }
/*.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)}

View File

@@ -18,7 +18,7 @@ html {
body { body {
height: 100%; height: 100%;
background-color: #B78996; background-color: #EEE;
color: #333; color: #333;
font-family: Arial, sans-serif; font-family: Arial, sans-serif;
} }
@@ -37,11 +37,12 @@ h3 {
} }
h4 { h4 {
font-size: 1.6em; font-size: 1.2em;
} }
h5 { h5 {
font-size: 1.4em; font-size: 1.0em;
color: #666;
} }
ul { ul {
@@ -54,12 +55,12 @@ p {
/* Selection colors */ /* Selection colors */
::selection { ::selection {
background: #845663; background: #FBC02D;
color: white; color: white;
} }
::-moz-selection { ::-moz-selection {
background: #845663; background: #FBC02D;
color: white; color: white;
} }
@@ -75,7 +76,7 @@ p {
.platform { .platform {
padding: 20px; padding: 20px;
margin-bottom: 10px; margin-bottom: 10px;
border-radius: 10px; border-radius: 5px;
background-color: #FFFFFF; background-color: #FFFFFF;
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);
} }
@@ -143,7 +144,7 @@ button, input, select {
cursor: pointer; cursor: pointer;
border: none; border: none;
font-size: 16px; font-size: 16px;
border-radius: 7px; transition-duration: 250ms;
} }
/* All textinput and sections */ /* All textinput and sections */
@@ -151,19 +152,53 @@ textarea, input, select {
padding: 0 5px; padding: 0 5px;
background: white; background: white;
color: #333333; color: #333333;
border: 1px solid #845663; border-radius: 5px;
border-radius: 7px; border-bottom: 1px solid #4CAF50;
font-size: 16px; font-size: 16px;
outline: none;
transition-duration: 250ms;
}
textarea {
padding: 5px;
resize: none;
}
textarea:hover, input:hover, select:hover {
border-radius: 10px;
}
textarea:focus, input:focus, select:focus {
border-radius: 10px;
box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
} }
/* All buttons */ /* All buttons */
button, button,
input[type="submit"], input[type="submit"],
input[type="reset"] { input[type="reset"] {
background-color: #845663; background-color: #FBC02D;
color: white; color: white;
padding: 0 10px; padding: 0 10px;
border: none; border: none;
border-radius: 5px;
}
button:focus,
input[type="submit"]:focus,
input[type="reset"]:focus {
outline: none;
}
button:active,
input[type="submit"]:active,
input[type="reset"]:active {
outline: none;
box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24)
}
input[type="radio"] {
border-radius: 100%;
} }
/* Tables */ /* Tables */
@@ -190,19 +225,17 @@ img[data-title]:hover:after,
span[data-title]:hover:after, span[data-title]:hover:after,
div[data-title]:hover:after { div[data-title]:hover:after {
content: attr(data-title); content: attr(data-title);
padding: 4px 4px; padding: 7px 7px;
color: #FFFFFF; color: #FFFFFF;
position: absolute; position: absolute;
left: 0; left: 0;
top: 100%; top: 150%;
z-index: 20; z-index: 200;
white-space: nowrap; white-space: nowrap;
-moz-border-radius: 5px; -moz-border-radius: 3px;
-webkit-border-radius: 5px; -webkit-border-radius: 3px;
border-radius: 5px; border-radius: 3px;
-moz-box-shadow: 0 0 4px #222; box-shadow: 0 14px 28px rgba(0,0,0,0.25), 0 10px 10px rgba(0,0,0,0.22);
-webkit-box-shadow: 0 0 4px #222;
box-shadow: 0 0 4px #222;
background-color: #333; background-color: #333;
font-size: 15px; font-size: 15px;
line-height: normal; line-height: normal;

View File

@@ -1,12 +1,19 @@
.menu { .menu {
position: fixed; position: fixed;
z-index: 50; z-index: 50;
overflow-y: auto;
left: 0; left: 0;
top: 80px; top: 80px;
height: calc(100% - 80px); height: calc(100% - 80px);
width: 256px; width: 256px;
background-color: #EEE;
/*box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);*/
}
.menu section {
margin: 0 5px 10px 5px;
background-color: white; background-color: white;
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);
} }
@@ -25,3 +32,39 @@
font-size: 14px; font-size: 14px;
cursor: pointer; cursor: pointer;
} }
.friend-item, .group-item {
cursor: pointer;
transition-duration: 250ms;
}
.friend-item:hover, .group-item:hover {
background: #FBC02D;
color: white;
}
.menu button {
background: none;
color: inherit;
width: 100%;
height: 100%;
padding: 0;
text-align: left;
}
#notification-center {
left: auto;
width: 256px;
right: -256px;
}
#quick-links {
text-align: center;
box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
}
#quick-links i {
color: #4CAF50;
font-size: 42px;
padding: 7px;
}

View File

@@ -10,9 +10,12 @@
margin: 0 20px 20px 0; margin: 0 20px 20px 0;
} }
.profile-box .profile-username { .profile-box h1.profile-username {
padding-top: 50px; padding-top: 50px;
} }
.profile-box h5.profile-username {
padding: 0 0 10px 0;
}
div.posts { div.posts {
padding-top: 20px; padding-top: 20px;
@@ -25,6 +28,15 @@ div.posts div.post {
margin: 20px 0 0 0; margin: 20px 0 0 0;
padding: 10px; padding: 10px;
width: calc(100% - 40px); width: calc(100% - 40px);
cursor: pointer;
transition-duration: 250ms;
}
div.posts div.post:hover {
/*margin: 15px 0 0 -5px;*/
/*padding: 15px;*/
/*z-index: 20;*/
box-shadow: 0 10px 20px rgba(0,0,0,0.19), 0 6px 6px rgba(0,0,0,0.23);
} }
div.posts div.post img { div.posts div.post img {
@@ -37,23 +49,18 @@ div.posts .post p.subscript {
font-size: 8pt; font-size: 8pt;
} }
/*.posts {*/ div.posts .post form input, div.posts .post form textarea {
/*z-index: -1;*/ width: calc(100% - 15px);
/*margin-right: 0;*/ }
/*width: calc(100% + 15px);*/
/*}*/
/*.post-box {*/ div.posts .post form input[type="submit"] {
/*display: inline-flex;*/ width: 100%;
/*margin: 20px 15px 0 0;*/ }
/*padding: 25px;*/
/*background-color: #FFFFFF;*/
/*}*/
/*!* fullscreen *!*/ div.posts .post form textarea.newpost {
/*.post-box {*/ margin: 15px 0 15px 0;
/*width: calc(25% - 69px);*/ height: 100px;
/*}*/ }
@media only screen and (max-width: 1500px) { @media only screen and (max-width: 1500px) {
.post-box { .post-box {
@@ -68,14 +75,6 @@ div.posts .post p.subscript {
} }
} }
.post {
width: 100%;
}
.post img {
width: 100%;
}
.post .post-date { .post .post-date {
float: right; float: right;
color: #aaaaaa; color: #aaaaaa;
@@ -86,11 +85,12 @@ div.posts .post p.subscript {
float: right; float: right;
padding: 10px; padding: 10px;
border-radius: 5px; border-radius: 5px;
background-color: #845663; background-color: #4CAF50;
color: #FFFFFF; color: #FFFFFF;
transition-duration: 250ms; transition-duration: 250ms;
cursor: pointer;
} }
.profile-button:hover { .profile-button:hover {
background-color: #B78996; box-shadow: 0 10px 20px rgba(0,0,0,0.19), 0 6px 6px rgba(0,0,0,0.23);
} }

View File

@@ -9,4 +9,9 @@
#search-friends-output { #search-friends-output {
margin-right: 10px; margin-right: 10px;
}
.searchleft, .searchright {
display: inline-block;
vertical-align: top;
} }

View File

@@ -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 />";
} }

View File

@@ -0,0 +1,105 @@
<?php
/**
* Function for checking inputfields
* @param variable $variable Give name of the inputfield.
* @param string $option Give the name of the option.
* @return sets correct to false and gives value to error message if it doesn't pass the checks.
*/
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 "longerEight";
longerEight($variable);
break;
case "email";
validateEmail($variable);
break;
default:
break;
}
}
}
/* Checks for only letters and spaces. */
function checkOnly($variable){
if (!preg_match("/^[a-zA-Z ]*$/",$GLOBALS[$variable])) {
$GLOBALS[$variable . "Err"] = "Alleen letters en spaties zijn toegestaan!";
$correct = false;
}
}
/* checks if username exist and if its longer than 6 characters. */
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;
}
}
/* checks if an input is longer that 8 characters. */
function longerEight($variable){
if (strlen($GLOBALS[$variable]) < 8) {
$GLOBALS[$variable . "Err"] = "Moet minstens 8 karakters bevatten";
$correct = false;
}
}
/* checks if an input is a valid email. */
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;
}
}
/* checks if two passwords matches. */
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");
}
}
/* removes weird characters of an input. */
function test_input($data) {
$data = trim($data);
$data = stripslashes($data);
$data = htmlspecialchars($data);
return $data;
}
?>

View File

@@ -1,25 +1,63 @@
<?php <?php
function selectAllFriends($db, $userID) { function selectAllFriends($userID) {
return $db->query(" $stmt = $GLOBALS["db"]->prepare("
SELECT SELECT
`user`.`username`, `userID`,
`user`.`profilepicture`, `username`,
`user`.`onlinestatus`, IFNULL(
`user`.`role` `profilepicture`,
FROM '../img/notbad.jpg'
`user` ) AS profilepicture,
INNER JOIN `onlinestatus`,
`friendship` `role`
WHERE FROM
`friendship`.`user1ID` = $userID AND `user`
`friendship`.`user2ID` = `user`.`userID` OR INNER JOIN
`friendship`.`user2ID` = $userID AND `friendship`
`friendship`.`user1ID` = `user`.`userID` AND
`user`.`role` != 3 WHERE
(`friendship`.`user1ID` = :userID AND
`friendship`.`user2ID` = `user`.`userID` OR
`friendship`.`user2ID` = :userID AND
`friendship`.`user1ID` = `user`.`userID`) AND
`role` != 5 AND
`status` = 1
"); ");
$stmt->bindParam(':userID', $userID, PDO::PARAM_INT);
$stmt->execute();
return $stmt;
} }
function selectAllFriendRequests() {
$stmt = $GLOBALS["db"]->prepare("
SELECT
`userID`,
`username`,
IFNULL(
`profilepicture`,
'../img/notbad.jpg'
) AS profilepicture,
`onlinestatus`,
`role`
FROM
`user`
INNER JOIN
`friendship`
WHERE
(`friendship`.`user1ID` = :userID AND
`friendship`.`user2ID` = `user`.`userID` OR
`friendship`.`user2ID` = :userID AND
`friendship`.`user1ID` = `user`.`userID`) AND
`role` != 5 AND
`status` = 0
");
$stmt->bindParam(':userID', $_SESSION["userID"], PDO::PARAM_INT);
$stmt->execute();
?> return json_encode($stmt->fetchAll());
}

View File

@@ -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
"); ");
} }
?>

View File

@@ -1,7 +1,7 @@
<?php <?php
function selectGroupById($db, $groupID) { function selectGroupById($groupID) {
return $db->query(" $q = $GLOBALS["db"]->prepare("
SELECT SELECT
`group_page`.`name`, `group_page`.`name`,
`group_page`.`picture`, `group_page`.`picture`,
@@ -11,12 +11,16 @@ function selectGroupById($db, $groupID) {
FROM FROM
`group_page` `group_page`
WHERE WHERE
`group_page`.`groupID` = $groupID `group_page`.`groupID` = :groupID
"); ");
$q->bindParam(':groupID', $groupID);
$q->execute();
return $q;
} }
function select20GroupsFromN($db, $n) { function select20GroupsFromN($n) {
return $db->query(" $q = $GLOBALS["db"]->prepare("
SELECT SELECT
`group_page`.`groupID`, `group_page`.`groupID`,
`group_page`.`name`, `group_page`.`name`,
@@ -29,12 +33,16 @@ function select20GroupsFromN($db, $n) {
ORDER BY ORDER BY
`group_page`.`name` ASC `group_page`.`name` ASC
LIMIT LIMIT
$n, 20 :n, 20
"); ");
$q->bindParam(':n', $n);
$q->execute();
return $q;
} }
function select20GroupsByStatusFromN($db, $n, $status) { function select20GroupsByStatusFromN($n, $status) {
return $db->query(" $q = $GLOBALS["db"]->prepare("
SELECT SELECT
`group_page`.`groupID`, `group_page`.`groupID`,
`group_page`.`name`, `group_page`.`name`,
@@ -45,12 +53,145 @@ function select20GroupsByStatusFromN($db, $n, $status) {
FROM FROM
`group_page` `group_page`
WHERE WHERE
`group_page`.`status` = $status `group_page`.`status` = :status
ORDER BY ORDER BY
`group_page`.`name` ASC `group_page`.`name` ASC
LIMIT LIMIT
$n, 20 :n, 20
"); ");
$q->bindParam(':status', $status);
$q->bindParam(':n', $n);
$q->execute();
return $q;
} }
function search20GroupsFromNByStatus($n, $keyword, $status) {
$q = $GLOBALS["db"]->prepare("
SELECT
`groupID`,
`name`,
`status`,
`description`
FROM
`group_page`
WHERE
`name` LIKE :keyword AND
FIND_IN_SET (`status`, :statuses)
ORDER BY
`name`
LIMIT
:n, 20
");
$keyword = "%$keyword%";
$q->bindParam(':keyword', $keyword);
$q->bindParam(':n', $n, PDO::PARAM_INT);
$statuses = implode(',', $status);
$q->bindParam(':statuses', $statuses);
$q->execute();
return $q;
}
function searchSomeGroupsByStatus($n, $m, $keyword, $status) {
$q = $GLOBALS['db']->prepare("
SELECT
`groupID`,
`name`,
`status`,
`description`
FROM
`group_page`
WHERE
`name` LIKE :keyword AND
FIND_IN_SET (`status`, :statuses)
ORDER BY
`name`
LIMIT
:n, :m
");
$keyword = "%$keyword%";
$q->bindParam(':keyword', $keyword);
$q->bindParam(':n', $n, PDO::PARAM_INT);
$q->bindParam(':m', $m, PDO::PARAM_INT);
$statuses = implode(',', $status);
$q->bindParam(':statuses', $statuses);
$q->execute();
return $q;
}
function countSomeGroupsByStatus($keyword, $status) {
$q = $GLOBALS['db']->prepare("
SELECT
COUNT(*)
FROM
`group_page`
WHERE
`name` LIKE :keyword AND
FIND_IN_SET (`status`, :statuses)
ORDER BY
`name`
");
$keyword = "%$keyword%";
$q->bindParam(':keyword', $keyword);
$statuses = implode(',', $status);
$q->bindParam(':statuses', $statuses);
$q->execute();
return $q;
}
function changeGroupStatusByID($id, $status) {
$q = $GLOBALS["db"]->query("
UPDATE
`group_page`
SET
`status` = $status
WHERE
`groupID` = $id
");
return $q;
}
function changeMultipleGroupStatusByID($ids, $status) {
$q = $GLOBALS['db']->prepare("
UPDATE
`group_page`
SET
`status` = :status
WHERE
FIND_IN_SET (`groupID`, :ids)
");
$ids = implode(',', $ids);
$q->bindParam(':ids', $ids);
$q->bindParam(':status', $status);
$q->execute();
return $q;
}
function searchSomeGroups($n, $m, $search) {
$stmt = $GLOBALS["db"]->prepare("
SELECT
`name`,
`picture`
FROM
`group_page`
WHERE
`name` LIKE :keyword
ORDER BY
`name`
LIMIT
:n, :m
");
$search = "%$search%";
$stmt->bindParam(':keyword', $search);
$stmt->bindParam(':n', $n, PDO::PARAM_INT);
$stmt->bindParam(':m', $m, PDO::PARAM_INT);
$stmt->execute();
return $stmt;
}
?> ?>

View File

@@ -0,0 +1,21 @@
<?php
function getHeaderInfo() {
$stmt = $GLOBALS["db"]->prepare("
SELECT
`fname`,
`lname`,
IFNULL(
`profilepicture`,
'img/notbad.jpg'
) AS profilepicture
FROM
`user`
WHERE
`userID` = :userID
");
$stmt->bindParam(":userID", $_SESSION["userID"]);
$stmt->execute();
return $stmt->fetch();
}

View File

@@ -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);
} }
?>

View File

@@ -0,0 +1,39 @@
<?php
function nicetime($date) {
if(empty($date)) {
return "No date provided";
}
$single_periods = array("seconde", "minuut", "uur", "dag", "week", "maand", "jaar", "decennium");
$multiple_periods = array("seconden", "minuten", "uur", "dagen", "weken", "maanden", "jaar", "decennia");
$lengths = array("60", "60", "24", "7", "4.35", "12", "10", "0");
$now = time();
$unix_date = strtotime($date);
if(empty($unix_date)) {
return "Bad date";
}
if($now > $unix_date) {
$difference = $now - $unix_date;
$tense = "geleden";
} else {
$difference = $unix_date - $now;
$tense = "vanaf nu";
}
for($i = 0; $difference >= $lengths[$i] && $i < count($lengths) - 1; $i++) {
$difference /= $lengths[$i];
}
$difference = round($difference);
if($difference != 1) {
$period = $multiple_periods[$i];
} else {
$period = $single_periods[$i];
}
return "$difference $period $tense";
}

View File

@@ -0,0 +1,76 @@
<?php
function getOldChatMessages($user2ID) {
$user1ID = $_SESSION["userID"];
$stmt = $GLOBALS["db"]->prepare("
SELECT
*
FROM
`private_message`
WHERE
`origin` = :user1 AND
`destination` = :user2 OR
`origin` = :user2 AND
`destination` = :user1
ORDER BY
`messageID` ASC
");
$stmt->bindParam(":user1", $user1ID);
$stmt->bindParam(":user2", $user2ID);
$stmt->execute();
return json_encode($stmt->fetchAll());
}
function sendMessage($destination, $content) {
$stmt = $GLOBALS["db"]->prepare("
INSERT INTO
`private_message`
(
`origin`,
`destination`,
`content`
)
VALUES
(
:origin,
:destination,
:content
)
");
return $stmt->execute(array(
"origin" => $_SESSION["userID"],
"destination" => $destination,
"content" => $content
));
}
function getNewChatMessages($lastID, $destination) {
$stmt = $GLOBALS["db"]->prepare("
SELECT
*
FROM
`private_message`
WHERE
(
`origin` = :user1 AND
`destination` = :user2 OR
`origin` = :user2 AND
`destination` = :user1) AND
`messageID` > :lastID
ORDER BY
`messageID` ASC
");
$stmt->bindParam(':user1', $_SESSION["userID"]);
$stmt->bindParam(':user2', $destination);
$stmt->bindParam(':lastID', $lastID);
$stmt->execute();
return json_encode($stmt->fetchAll());
}

View File

@@ -18,12 +18,18 @@ function getExistingUsername() {
function getExistingEmail() { function getExistingEmail() {
$stmt = $GLOBALS["db"]->prepare(" $stmt = $GLOBALS["db"]->prepare("
SELECT * FROM `user` WHERE `email` = :email SELECT
`email`
FROM
`user`
WHERE
`email` LIKE :email
"); ");
$stmt->bindParam(":email", $_POST["email"]); $stmt->bindParam(":email", $_POST["email"]);
$stmt->execute(); $stmt->execute();
return $stmt->rowCount(); return $stmt->rowCount();
} }
function registerAccount() { function registerAccount() {
@@ -46,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"]);
@@ -54,7 +60,7 @@ function registerAccount() {
$stmt->bindParam(":username", $_POST["username"]); $stmt->bindParam(":username", $_POST["username"]);
$stmt->bindParam(":password", $hash); $stmt->bindParam(":password", $hash);
$stmt->bindParam(":location", $_POST["location"]); $stmt->bindParam(":location", $_POST["location"]);
$stmt->bindParam(":email", $_POST["email"]); $stmt->bindParam(":email", (strtolower($_POST["email"])));
$stmt->execute(); $stmt->execute();
$stmt->rowCount(); $stmt->rowCount();

View File

@@ -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
@@ -50,49 +87,36 @@ function updateSettings() {
`userID` = :userID `userID` = :userID
"); ");
$stmt->bindParam(":fname", $_POST["fname"]); $stmt->bindValue(":fname", test_input($_POST["fname"]));
$stmt->bindParam(":lname", $_POST["lname"]); $stmt->bindValue(":lname", test_input($_POST["lname"]));
$stmt->bindParam(":location", $_POST["location"]); $stmt->bindValue(":location", test_input($_POST["location"]));
$stmt->bindParam(":bday", $_POST["bday"]); $stmt->bindValue(":bday", test_input($_POST["bday"]));
$stmt->bindParam(":bio", $_POST["bio"]); $stmt->bindValue(":bio", test_input($_POST["bio"]));
$stmt->bindParam(":userID", $_SESSION["userID"]); $stmt->bindValue(":userID", $_SESSION["userID"]);
$stmt->execute(); $stmt->execute();
return array ( return new settingsMessage("happy", "Instellingen zijn opgeslagen.");
"type" => "settings-message-happy",
"message" => "Instellingen zijn opgeslagen."
);
} }
function updatePassword() { function changePassword() {
$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 (doChangePassword()) {
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 doChangePassword() {
$stmt =$GLOBALS["db"]->prepare(" $stmt = $GLOBALS["db"]->prepare("
UPDATE UPDATE
`user` `user`
SET SET
@@ -101,9 +125,90 @@ 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();
}
function updateProfilePicture() {
$profilePictureDir = "/var/www/html/public/";
$relativePath = "uploads/profilepictures/" . $_SESSION["userID"] . "_" . basename($_FILES["pp"]["name"]);
// removeOldProfilePicture();
move_uploaded_file($_FILES['pp']['tmp_name'], $profilePictureDir . $relativePath);
setProfilePictureToDatabase("../" . $relativePath);
}
//function removeOldProfilePicture() {
//
// unlink("/var/www/html/public/uploads/profilepictures/" . $_SESSION["userID"] . "_*");
//}
function setProfilePictureToDatabase($url) {
$stmt = $GLOBALS["db"]->prepare("
UPDATE
`user`
SET
`profilepicture` = :profilePicture
WHERE
`userID` = :userID
");
$stmt->bindParam(":profilePicture", $url);
$stmt->bindParam(":userID", $_SESSION["userID"]);
$stmt->execute();
} }

303
website/queries/user.php Normal file
View File

@@ -0,0 +1,303 @@
<?php
require("connect.php");
function getUserID($username) {
$stmt = $GLOBALS["db"]->prepare("
SELECT
`userID`
FROM
`user`
WHERE
LOWER(`username`) = LOWER(:username)
");
$stmt->bindParam(':username', $username, PDO::PARAM_STR);
$stmt->execute();
return $stmt->fetch()["userID"];
}
function selectUser($userID) {
$stmt = $GLOBALS["db"]->prepare("
SELECT
`username`,
IFNULL(
`profilepicture`,
'../img/notbad.jpg'
) AS profilepicture,
`bio`,
`role`,
`onlinestatus`,
`loggedin`,
`fname`,
`lname`
FROM
`user`
WHERE
`userID` = :userID
");
$stmt->bindParam(':userID', $userID, PDO::PARAM_INT);
$stmt->execute();
return $stmt->fetch();
}
function selectAllUserGroups($userID) {
$stmt = $GLOBALS["db"]->prepare("
SELECT
`group_page`.`groupID`,
`name`,
`picture`,
`userID`
FROM
`group_page`
INNER JOIN
`group_member`
ON
`group_page`.`groupID` = `group_member`.`groupID`
WHERE
`userID` = :userID AND
`role` = 1
");
$stmt->bindParam(':userID', $userID, PDO::PARAM_INT);
$stmt->execute();
return $stmt;
}
function selectAllUserPosts($userID) {
$stmt = $GLOBALS["db"]->prepare("
SELECT
`postID`,
`author`,
`title`,
`content`,
`creationdate`
FROM
`post`
WHERE
`author` = :userID AND
`groupID` IS NULL
ORDER BY
`creationdate` DESC
");
$stmt->bindParam(':userID', $userID, PDO::PARAM_INT);
$stmt->execute();
return $stmt;
}
function select20UsersFromN($n) {
$q = $GLOBALS["db"]->prepare("
SELECT
`userID`,
`username`,
`role`,
`bancomment`
FROM
`user`
ORDER BY
`role`,
`username`
LIMIT
:n, 20
");
$q->bindParam(':n', $n);
$q->execute();
return $q;
}
function search20UsersFromN($n, $keyword) {
$q = $GLOBALS["db"]->prepare("
SELECT
`userID`,
`username`,
`role`,
`bancomment`
FROM
`user`
WHERE
`username` LIKE :keyword
ORDER BY
`username`
LIMIT
:n, 20
");
$keyword = "%$keyword%";
$q->bindParam(':keyword', $keyword);
$q->bindParam(':n', $n, PDO::PARAM_INT);
$q->execute();
return $q;
}
function search20UsersFromNByStatus($n, $keyword, $status) {
$q = $GLOBALS["db"]->prepare("
SELECT
`userID`,
`username`,
`role`,
`bancomment`
FROM
`user`
WHERE
`username` LIKE :keyword AND
FIND_IN_SET (`role`, :statuses)
ORDER BY
`role`,
`username`
LIMIT
:n, 20
");
$keyword = "%$keyword%";
$q->bindParam(':keyword', $keyword);
$q->bindParam(':n', $n, PDO::PARAM_INT);
$statuses = implode(',', $status);
$q->bindParam(':statuses', $statuses);
$q->execute();
return $q;
}
function searchSomeUsersByStatus($n, $m, $keyword, $status) {
$q = $GLOBALS["db"]->prepare("
SELECT
`userID`,
`username`,
`role`,
`bancomment`
FROM
`user`
WHERE
`username` LIKE :keyword AND
FIND_IN_SET (`role`, :statuses)
ORDER BY
`role`,
`username`
LIMIT
:n, :m
");
$keyword = "%$keyword%";
$q->bindParam(':keyword', $keyword);
$q->bindParam(':n', $n, PDO::PARAM_INT);
$q->bindParam(':m', $m, PDO::PARAM_INT);
$statuses = implode(',', $status);
$q->bindParam(':statuses', $statuses);
$q->execute();
return $q;
}
function countSomeUsersByStatus($keyword, $status) {
$q = $GLOBALS["db"]->prepare("
SELECT
COUNT(*)
FROM
`user`
WHERE
`username` LIKE :keyword AND
FIND_IN_SET (`role`, :statuses)
ORDER BY
`role`,
`username`
");
$keyword = "%$keyword%";
$q->bindParam(':keyword', $keyword);
$statuses = implode(',', $status);
$q->bindParam(':statuses', $statuses);
$q->execute();
return $q;
}
function changeUserStatusByID($id, $status) {
$q = $GLOBALS["db"]->prepare("
UPDATE
`user`
SET
`role` = :status
WHERE
`userID` = :id
");
$q->bindParam(':status', $status);
$q->bindParam(':id', $id);
$q->execute();
return $q;
}
function changeMultipleUserStatusByID($ids, $status) {
$q = $GLOBALS["db"]->prepare("
UPDATE
`user`
SET
`role` = :status
WHERE
FIND_IN_SET (`userID`, :ids)
");
$ids = implode(',', $ids);
$q->bindParam(':ids', $ids);
$q->bindParam(':status', $status);
$q->execute();
return $q;
}
function selectRandomNotFriendUser($userID) {
$stmt = $GLOBALS["db"]->prepare("
SELECT
`user`.`username`
FROM
`user`
WHERE
`userID` NOT IN (SELECT
`user1ID`
FROM
`friendship`
WHERE `user1ID` = :userID) OR
`userID` NOT IN (SELECT
`user2ID`
FROM
`friendship`
WHERE `user2ID` = :userID)
ORDER BY
RAND()
LIMIT
1
");
$stmt->bindParam(':userID', $userID, PDO::PARAM_INT);
$stmt->execute();
return $stmt->fetch();
}
function searchSomeUsers($n, $m, $search) {
$stmt = $GLOBALS["db"]->prepare("
SELECT
`username`,
`profilepicture`,
`fname`,
`lname`
FROM
`user`
WHERE
`username` LIKE :keyword OR
`fname` LIKE :keyword OR
`lname` LIKE :keyword
ORDER BY
`fname`,
`lname`,
`username`
LIMIT
:n, :m
");
$search = "%$search%";
$stmt->bindParam(':keyword', $search);
$stmt->bindParam(':n', $n, PDO::PARAM_INT);
$stmt->bindParam(':m', $m, PDO::PARAM_INT);
$stmt->execute();
return $stmt;
}

View File

@@ -1,98 +1,312 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<title>Admin Panel</title> <title>Admin Panel</title>
<script type="text/javascript"> <script src="/js/admin.js" charset="utf-8"></script>
function checkAll(allbox) { <?php
var checkboxes = document.getElementsByName('check1'); include_once("../queries/user.php");
include_once("../queries/group_page.php");
?>
</head>
<body>
for (var i = 0; i < checkboxes.length; i++) { <!-- function test_input taken from http://www.w3schools.com/php/php_form_validation.asp -->
if (checkboxes[i].type == 'checkbox') { <?php
checkboxes[i].checked = allbox.checked; $search = "";
} $currentpage = 1;
} $perpage = 20;
} $status = $groupstatus = array();
</script> $pagetype = "user";
</head>
<body> if (isset($_GET["search"])) {
<div class="content"> $search = test_input($_GET["search"]);
<div class="platform admin-panel"> }
<div class="admin-title">
<h1>User Management Panel</h1> if (isset($_GET["pagetype"])) {
</div> <br> $pagetype = test_input($_GET["pagetype"]);
<form action="admin.php" method="post"> }
<div class="admin-options">
<form action="admin.php" method="post"> if (isset($_GET["status"])) {
<div class="admin-searchbar"> $status = $_GET["status"];
<h2>Search</h2> }
<input type="text" name="search" class="admin-searchinput"> <br>
<input type="submit" value="Search"> if (isset($_GET["groupstatus"])) {
</div> $groupstatus = $_GET["groupstatus"];
<div class="admin-filter"> }
<h2>Show users:</h2>
<input type="checkbox" name="status" value="Active"> Active <br>
<input type="checkbox" name="status" value="Muted"> Muted <br> if ($_SERVER["REQUEST_METHOD"] == "POST") {
<input type="checkbox" name="status" value="Banned"> Banned if (isset($_POST["actions"]) && isset($_POST["userID"])) {
</div> changeUserStatusByID($_POST["userID"], $_POST["actions"]);
}
if (isset($_POST["actions"]) && isset($_POST["groupID"])) {
changeGroupStatusByID($_POST["groupID"], $_POST["actions"]);
}
if (isset($_POST["batchactions"]) && isset($_POST["checkbox-user"])) {
changeMultipleUserStatusByID($_POST["checkbox-user"], $_POST["batchactions"]);
}
if (isset($_POST["groupbatchactions"]) && isset($_POST["checkbox-group"])) {
changeMultipleGroupStatusByID($_POST["checkbox-group"], $_POST["groupbatchactions"]);
}
if (isset($_POST["pageselect"])) {
$currentpage = $_POST["pageselect"];
}
}
$listn = ($currentpage-1) * $perpage;
$listm = $currentpage * $perpage;
?>
<div class="content">
<div class="platform admin-panel">
<div class="admin-title">
<h1>User Management Panel</h1>
</div> <br>
<div class="admin-options">
<form class="admin-searchform"
action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>"
method="get">
<div class="admin-searchbar">
<h2>Search</h2>
<input type="text"
name="search"
class="admin-searchinput"
value="<?php echo $search;?>"> <br>
<input type="submit" value="Search">
</div>
<div class="admin-filter" id="admin-filter">
<h2>Show:</h2>
<input type="checkbox" name="status[]" id="normal" value="1"
<?php if (in_array("1", $status)) echo "checked";?>>
<label for="normal">Normal</label><br>
<input type="checkbox" name="status[]" id="frozen" value="2"
<?php if (in_array("2", $status)) echo "checked";?>>
<label for="frozen">Frozen</label><br>
<input type="checkbox" name="status[]" id="banned" value="3"
<?php if (in_array("3", $status)) echo "checked";?>>
<label for="banned">Banned</label><br>
<input type="checkbox" name="status[]" id="admin" value="5"
<?php if (in_array("5", $status)) echo "checked";?>>
<label for="admin">Admin</label><br>
<input type="checkbox" name="status[]" id="unvalidated" value="0"
<?php if (in_array("0", $status)) echo "checked";?>>
<label for="unvalidated">Unvalidated</label><br>
<input type="checkbox" name="status[]" id="owner" value="42"
<?php if (in_array("42", $status)) echo "checked";?>>
<label for="owner">Owner</label>
</div>
<div class="admin-groupfilter" id="admin-groupfilter">
<h2>Show:</h2>
<input type="checkbox" name="groupstatus[]" id="hidden" value="0"
<?php if (in_array("0", $groupstatus)) echo "checked";?>>
<label for="hidden">Hidden</label><br>
<input type="checkbox" name="groupstatus[]" id="public" value="1"
<?php if (in_array("1", $groupstatus)) echo "checked";?>>
<label for="public">Public</label><br>
<input type="checkbox" name="groupstatus[]" id="membersonly" value="2"
<?php if (in_array("2", $groupstatus)) echo "checked";?>>
<label for="membersonly">Members-only</label><br>
</div>
<div class="admin-filtertype">
<h2>Page Type:</h2>
<input type="radio" name="pagetype" id="user" value="user"
<?php if (isset($pagetype) && $pagetype=="user") echo "checked";?>
onchange="changeFilter()">
<label for="user">Users</label><br>
<input type="radio" name="pagetype" id="group" value="group"
<?php if (isset($pagetype) && $pagetype=="group") echo "checked";?>
onchange="changeFilter()">
<label for="group">Groups</label>
</div>
</form>
<div class="admin-batchactions" id="admin-batchactions">
<h2>Batch Actions: </h2>
<form class="admin-batchform"
id="admin-batchform"
action="<?php htmlspecialchars(basename($_SERVER['REQUEST_URI'])) ?>"
method="post">
<input type="radio" name="batchactions" id="freeze" value="2">
<label for="freeze">Freeze</label><br>
<input type="radio" name="batchactions" id="ban" value="3">
<label for="ban">Ban</label><br>
<input type="radio" name="batchactions" id="restore" value="1">
<label for="restore">Restore</label><br><br>
<input type="submit" value="Confirm">
</form> </form>
<div class="admin-actions"> </div>
<h2>Batch Actions: </h2>
<input type="radio" name="actions" value="mute"> Mute <br> <div class="admin-groupbatchactions" id="admin-groupbatchactions">
<input type="radio" name="actions" value="ban"> Ban <br> <h2>Batch Actions: </h2>
<input type="radio" name="actions" value="unban"> Unban <br> <br> <form class="admin-groupbatchform"
<input type="submit" value="Confirm"> id="admin-groupbatchform"
</div> action="<?php htmlspecialchars(basename($_SERVER['REQUEST_URI'])) ?>"
</div> method="post">
<br> <input type="radio" name="groupbatchactions" id="hide" value="0">
<div class="admin-users"> <label for="hide">Hide</label><br>
<h2>Users:</h2> <input type="radio" name="groupbatchactions" id="public" value="1">
<table class="usertable"> <label for="public">Public</label><br>
<tr> <input type="radio" name="groupbatchactions" id="membersonly" value="2">
<th class="table-checkbox"> <label for="membersonly">Member</label><br><br>
<input type="checkbox" name="checkall" onchange="checkAll(this)"> <input type="submit" value="Confirm">
</th> </form>
<th class="table-username">User</th> </div>
<th class="table-status">Status</th>
<th class="table-comment">Comment</th>
<th class="table-action">Action</th>
</tr>
<tr>
<td><input type="checkbox" name="check1"></td>
<td>John Smith</td>
<td>Banned</td>
<td>unregulated time travel</td>
<td>
<form class="admin-useraction" action="index.html" method="post">
<select class="action" name="actions">
<option value="mute">Mute</option>
<option value="ban">Ban</option>
<option value="unban">Unban</option>
</select>
<input type="submit" value="Confirm">
</form>
</td>
</tr>
<tr>
<td><input type="checkbox" name="check1"></td>
<td>poey jokeaim</td>
<td>Banned</td>
<td>l33t h4xx</td>
<td>
<form class="admin-useraction" action="index.html" method="post">
<select class="action" name="actions">
<option value="mute">Mute</option>
<option value="ban">Ban</option>
<option value="unban">Unban</option>
</select>
<input type="submit" value="Confirm">
</form>
</td>
</tr>
</table>
</div>
</form>
</div> </div>
</div> <br>
</body>
<div class="admin-users">
<div class="admin-usertitle">
<div class="admin-userheading">
<h2>Users:</h2>
</div>
<div class="admin-pageui">
<?php
if ($pagetype == "user") {
$pages = countSomeUsersByStatus($search, $status);
} else {
$pages = countSomeGroupsByStatus($search, $groupstatus);
}
$countresults = $pages->fetchColumn();
$mincount = min($listm, $countresults);
$minlist = min($listn + 1, $countresults);
?>
<p class="pagenumber">Current page:</p>
<form class="admin-pageselector"
action="<?php htmlspecialchars(basename($_SERVER['REQUEST_URI'])) ?>"
method="post">
<select class="admin-pageselect"
name="pageselect"
onchange="this.form.submit()"
value="">
<?php
for ($i=1; $i <= ceil($countresults / $perpage); $i++) {
if ($currentpage == $i) {
echo "<option value='$i' selected>$i</option>";
} else {
echo "<option value='$i'>$i</option>";
}
}
?>
</select>
</form>
<p class="entriesshown">
<?php
echo "Showing results $minlist to $mincount out of $countresults";
?>
</div>
</div> <br>
<table class="usertable">
<tr>
<th class="table-checkbox">
<input type="checkbox" id="checkall" name="checkall" onchange="checkAll(this)">
</th>
<th class="table-username">User</th>
<th class="table-status">Status</th>
<th class="table-comment">Comment</th>
<th class="table-action">Action</th>
</tr>
<!-- Table construction via php PDO. -->
<?php
$listn = ($currentpage-1) * $perpage;
$listm = $currentpage * $perpage;
if ($pagetype == 'user') {
$q = searchSomeUsersByStatus($listn, $listm, $search, $status);
while($user = $q->fetch(PDO::FETCH_ASSOC)) {
$userID = $user['userID'];
$username = $user['username'];
$role = $user['role'];
$bancomment = $user['bancomment'];
$thispage = htmlspecialchars(basename($_SERVER['REQUEST_URI']));
$function = "checkCheckAll(document.getElementById('checkall'))";
echo("
<tr>
<td><input type='checkbox'
name='checkbox-user[]'
class='checkbox-list'
value='$userID'
form='admin-batchform'
onchange=" . "$function" . ">
</td>
<td>$username</td>
<td>$role</td>
<td>$bancomment</td>
<td>
<form class='admin-useraction'
action='$thispage'
method='post'>
<select class='action' name='actions'>
<option value='2'>Freeze</option>
<option value='3'>Ban</option>
<option value='1'>Restore</option>
</select>
<input type='hidden' name='userID' value='$userID'>
<input type='submit' value='Confirm'>
</form>
</td>
</tr>
");
}
} else {
$q = searchSomeGroupsByStatus($listn, $listm, $search, $groupstatus);
while ($group = $q->fetch(PDO::FETCH_ASSOC)) {
$groupID = $group['groupID'];
$name = $group['name'];
$role = $group['status'];
$description = $group['description'];
$thispage = htmlspecialchars(basename($_SERVER['REQUEST_URI']));
$function = "checkCheckAll(document.getElementById('checkall'))";
echo("
<tr>
<td><input type='checkbox'
name='checkbox-group[]'
class='checkbox-list'
value='$groupID'
form='admin-groupbatchform'
onchange=" . "$function" . ">
</td>
<td>$name</td>
<td>$role</td>
<td>$description</td>
<td>
<form class='admin-groupaction'
action='$thispage'
method='post'>
<select class='action' name='actions'>
<option value='0'>Hide</option>
<option value='1'>Public</option>
<option value='2'>Members</option>
</select>
<input type='hidden' name='groupID' value='$groupID'>
<input type='submit' value='Confirm'>
</form>
</td>
</tr>
");
}
}
?>
</table>
</div>
</div>
</div>
</body>
</html> </html>

View File

@@ -1,52 +1,74 @@
<div class="content"> <div class="content">
<div class="chat"> <div class="chat">
<nav class="chat-left left platform chat-recent"> <nav class="nav-list chat-left left platform chat-recent">
<h5>Chats</h5> <h5>Chats</h5>
<a href="#"> <ul>
<div class="chat-conversation"> <?php
<img class="profile-picture" src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTDnuRSeeyPve7KwDvJJ6OBzj3gyghwLcE2z9kZeYBOyZavh3mw"> include_once("../queries/friendship.php");
Rudolf Leslo
</div> // Get all the friends of a user.
</a> $friends = selectAllFriends($_SESSION["userID"]);
$i = 0;
// Print all the users.
while($friend = $friends->fetch(PDO::FETCH_ASSOC)) {
$i ++;
// Set default values of a friend.
$username = $friend["username"];
$userID = $friend["userID"];
$pf = "img/notbad.jpg";
// Change values if needed.
if (!empty($friend["profilepicture"]))
$pf = $friend["profilepicture"];
// Echo the friend.
echo "
<li class='friend-item' id='friend-item-$userID' onclick='switchUser(\"$userID\")'>
<div class='friend'>
<img alt='PF' class='profile-picture' src='$pf'/>
$username
</div>
</li>
";
}
?>
</ul>
</nav> </nav>
<div class="chat-right right"> <div class="chat-right">
<div class="chat-history platform"> <div id="chat-history" class="chat-history platform">
<div class="chat-message">
<div class="chat-message-self">Hi!</div>
</div>
<div class="chat-message">
<div class="chat-message-other">Hi!</div>
</div>
<div class="chat-message">
<div class="chat-message-self">How it's going?</div>
</div>
<div class="chat-message">
<div class="chat-message-self">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</div>
</div>
<div class="chat-message">
<div class="chat-message-other">Hi!</div>
</div>
<div class="chat-message">
<div class="chat-message-other">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</div>
</div>
<div class="chat-message">
<div class="chat-message-other">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</div>
</div>
<div class="chat-message">
<div class="chat-message-self">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</div>
</div>
</div> </div>
<form id="lastIDForm">
<input type="hidden"
id="lastID"
name="lastID"
value=""
/>
<input type="hidden"
name="destination"
class="destinationID"
value=""
/>
</form>
<div class="chat-field"> <div class="chat-field">
<form method="post"> <form id="sendMessageForm" action="javascript:sendMessage();">
<input type="hidden"
name="destination"
class="destinationID"
value=""
/>
<input type="submit" <input type="submit"
value="Verstuur" value="Verstuur"
> />
<span> <span>
<input type="text" <input type="text"
name="message" name="content"
placeholder="Reageer..." id="newContent"
placeholder="Schrijf een bericht..."
autofocus
required required
> />
</span> </span>
</form> </form>
</div> </div>

View File

@@ -4,7 +4,7 @@
<script src="js/jquery.js"></script> <script src="js/jquery.js"></script>
<script src="js/header.js"></script> <script src="js/header.js"></script>
<script src="js/menu.js"></script> <script src="js/menu.js"></script>
<script src="js/masonry.js"></script> <script src="js/notifications.js"></script>
<style> <style>
/* Add your css files here. */ /* Add your css files here. */
@import url("styles/main.css"); @import url("styles/main.css");
@@ -15,6 +15,11 @@
</style> </style>
<?php <?php
include_once("../queries/connect.php"); require_once ("../queries/checkInput.php");
require_once ("../queries/connect.php");
?> session_start();
if(!isset($_SESSION["userID"])){
header("location:login.php");
}

View File

@@ -1,6 +1,11 @@
<?php
include_once ("../queries/header.php");
$userinfo = getHeaderInfo();
?>
<header> <header>
<div id="header-logo"> <div id="header-logo">
<a href="profile.php"><img src="img/top-logo.png" alt="MyHyvesbook+" /></a> <a href="profile.php"><img src="/img/top-logo.png" alt="MyHyvesbook+" /></a>
</div> </div>
<div id="header-search"> <div id="header-search">
<form action="search.php" method="get"> <form action="search.php" method="get">
@@ -14,18 +19,14 @@
</form> </form>
</div> </div>
<div class="right profile-menu"> <div class="right profile-menu">
<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="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>
</div>
<div id="profile-hello-popup"> <div id="profile-hello-popup">
<div id="hello-loop"> <div id="hello-loop">
Hallo Hallo
</div> </div>
Bart <?=$userinfo["fname"]?>
</div> </div>
<img id="own-profile-picture" class="profile-picture" src="data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAkGBwgHBgkIBwgKCgkLDRYPDQwMDRsUFRAWIB0iIiAdHx8kKDQsJCYxJx8fLT0tMTU3Ojo6Iys/RD84QzQ5OjcBCgoKDQwNGg8PGjclHyU3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3N//AABEIAHkAeQMBIgACEQEDEQH/xAAcAAABBQEBAQAAAAAAAAAAAAACAQMEBQYHAAj/xAA/EAABAwMBBAcFBwIEBwAAAAABAAIDBAURIQYSMVETMkFhcYGRFCJyobEHFTNCUsHRQ5IkgrLhNDVEU1RidP/EABkBAAIDAQAAAAAAAAAAAAAAAAABAgQFA//EACYRAAMAAQMEAQQDAAAAAAAAAAABAgMRIUEEEhMxUSIygaEUYdH/2gAMAwEAAhEDEQA/AOn4RAJAjASA8Bqi3e1KAjAQAAaiDUTi1jS5xDWtGSScABck2++1QtkktmysjS4ZbLXYzryj5/F6c0N6DS1OrTTQ0zOkqZooWdrpHho9Sob75Z46f2h91oWw53ekNQzdzyzlfLNzqK6tkMtfUVFQ4nrTyF5PqVAG43rMJ88IT1G5PsVm69jXsIc1wy1wOQRzXiF8pWbau92R7DbLnVwsb/SMm9H/AGnRdz+y7bg7UUslLc5ovvSIbwa1m50rP1DXXB4oFobghCQniEJCBDJCFOkISEAN5Xt5KQkwgBWhOAJGhG0IAUBGAvBQNo7qyx2Ktub273s8Rc1p/M7gB6kIA499s+11dNdTs/RyOhoogDMGnBncef8A6jl2+i53aqKouVYIKGF0kp4uAzher5Kq83OarqX79RUSlzjz8Pp4Bdz2F2borLbIhGzNQ9gdI88SVwy5O1bey3gw9z39HN5diLm1g6aAgY6wKp7js2aPO80E8sld/udPPPCegDSR1Wk4HmqWHZTdPT1D2yz8RkaDwCqeXImXfBjaOKjZqq6EySNMenutxqom5WbP1tPWUsz4aiF4kje06tP+/Lku4ybPue8mbG73cSs7thshS1dG50Y3JwPcOTjxwpR1Nd31EMnST2/SbT7Ndsm7W2d7qoxMuVM7dnij0BH5Xgcjr6LWkr5l+zi8ybMbYwTTkime/wBmqfhcePkcH1X0zoRkHIPAhaBltaHigKIjCQoENlJhGUiYChONCFqcakAQWa+04xs2Cu7pGF+IhutA/MXDC04wol7ohcrVVUZxmaJzGkjgSND6oGj5f2OAqNraGNwBaXk48ASuy1l3r4ZHU9piidIzAe+cHcauQ7M2utoNtaGKaItMNd7O88NRkFdou9kmr48U9QYjnJIGqp5/aNLpdXLTM5FtLtVS1zRcn210B7IWu+R4Lcm4b1u9rHU3c5WZodlBS1U8wY55ldkuleXbgzn3Tx9VfPia2yyxN6oaQAFXptvYtTOxg5LntLX15dT3qGjpydGmAOz68VLNTc27orauOtaX7u+xu7u+XYrKfZqG5U0AlgidHG7fYeGvfz4DQo6PZptAyRz5Xua4l26ToO4d3ck62H2aN/6cUvTvZ77cGsOCJCWkdhAyvqykJdSQlxJcY25JGMnC+cKrZioum3hpGEtjqKvdL8ZAaQCT819JNG6AB2DC0oacrQxsqap6ikaICnDqgcpnIEhJhEQhTANqcCBqcakAYXjwXmpSgaMDtNaGUVTW3GNoL3zNqeGo3d3eA/t+ZV7bSySna7PFW9ZStqmbriAcEajI1WUsM7m04jkwHRvdGR3tcWn6KnljtbZpYciqUuUW1WS2CTo25cGnA5rKPv8AdhRyxx2qLOoYOk4jv00+auq6rnjdkUs87OUQHocqN7XVbmRa4W4zgPmHzwq73LsTqg9lameood6phEOujAcjy7lNu0jGU5x4YVRSTVstS1gt/QgdaRkoLAPDiiu8wDB0h97U4JUf6Fa0ZG2Ko+lvMtXJFloc58b3DhoG6LfjiqjZ6iZRW+Bg1fuAvceJKtmcVpYo7J0MjqMnfWoedEJRISuhXE7EmERQpgE1G1NtTjUgHAiCEJQgATxWJvbhQXd7I27rJCHjA7eJHrr5rcEZWW2loWV75o3jVpBaeRwuOb7S1033DMFb0p3dNRk68E3U25lS9kgIO7rw492Vk6mS5WuXOHVEYOoA1QO21mZ7ggcABjUbpB81ScmisnaausqG0LHYdu40wdMrPy1or7pT0ziSHyNZgHsJ1Koqy8Vt2kw1m40k5x/HNXFgoTTVcM0hJeJGnJ5ZCSSl7kabo6ZCN0cE+zgm+1OjgtQx2LlCcpSUmUxClAiJQoAUJxpTQRtSAeaUuVWV15obeP8AETt3/wBDdT6BVNXtZER/g4nSO5v91qhV6bJEklyaqPEhOOqBqqapjd7XMJeJcfTs+Sp7XtJUxXASVjs07/dcxowGjmFsXxQVkTZGkPaRlr28lG4qpOmLLM0ZOuoyfejAyOfaqWooqV3vS0sWeTmLbz26ZudwCQdyqamldnEkLwfhVSpa9mjFzXpmYpbbDJI3oomRtHENGFNqaZsMZLAQR3q5p6GTBLInnPYGqworK50jZaxuGjUMP5lzWOqexK8sQtyTSU8vscJkJMgYC7PgiY9rtOB5FNbRV4t9qlfnE0oLImjv7fJYCivNwoWlrJS9p/LL72FoN0vRkNrk6MV4LIW/a8gbtwh3tdJItNO8FaShr6Wuj36WZsnMDiPELomRJRSLyRMCFcLpS24N9ocd93VjY0lzvJZ24Xa6V+WU0LqaE6dYBx8Sru/0u9FBMxpLgd3TjqoMNtrJBllO/wDzDH1Ve8lKtEjR6fpcN4++6KCK0zuJMjmAnicklTIrPggul4cmq+jtFcRgta3xcFIjslUevJEPMn9lHuys6PF0c86/kpordTtxvtc/4yrWhq5KEBsOOj/R2KfFYh/VqCfhapcdoo28Wuf8Tj+yam29RVn6aVol+gYLzSyYEuY3eoUoVtKRpUx/3LzKGkbwp4/NuU62GFvVjYPBoXZKuSjbxa/SmMOrqVo1qGnubqoVTeo2AiCGR7v1OGArb3RwACQkIafyKbxp7zr+TGVdRLVS9JO455dgUR9PC/jEwnnurdSRxyDD2NcO8ZUR1BRvPvU8fkMLg8Ne9S/PXY9NHBiXUFN/2Gc+CbFFBE8SQB0Ug4OjeQVuPuyiGvszPPJTMlroX6dAB8JIS8V/JL+X0z9x+kUluu8rZWwVpDgdGyYwQe/+VeZKq67Z+IxOdTyuaQCQH6hRPvRn/kx/3LtDtLSir1CwNp4noUuxe185q4LXcnCRjxuQzHrBw4AntGO3iuiZxknQDtK4VY/+e0H/ANLfqtRtd+NU/F+6vZcSd7GXGRqdzf1F+tVNkTV8G8Dq1rt4jyChy7Y2aLO7LNIR2MiP74XNIuLfJTIusPEqS6eeSDz1wbaTbmmH4VBUu+Itb/KYdtxO78K3RjHHemzj0Cycv4zkQ/L4qfhhcEfLb5NFJtdd36sbTRjmGE/UqNJtJenf9bujh7sTB9Qq8fuo0nVHmmon4E7r5LB1+uxA3q+o4a6gfQIPve6k733jVAZ4dKobvyfEPqik/Cb8X8JuZXBFU3ySJL3d86XCoGuMF6Sm2iu8Lzivkec9V4DgfVR5uu/wH0Kqv6p+MfQoUy+AdNcmlm2qvUjSG1EcfwRNz88r1LtncKaTcq446lvYT7jvUafJUY6zPP8AdNu/4iXwCj44+BrJXvU2jdtKOpYYpqaaF7mkA5Dm8OYXIfaz+oepWgHXb4P/ANJVAkscz6OiyU1uf//Z" /> <img id="own-profile-picture" class="profile-picture" src="<?=$userinfo["profilepicture"]?>"/>
</div> </div>
<a href="chat.php"><div class="right fa fa-comments-o" id="open-chat" data-title="Prive chats"></div></a>
</header> </header>
<?php include("notification-center.php"); ?>

View File

@@ -1,49 +1,51 @@
<div> <div>
<img style="width:50%;margin-left:25%" <img style="width:50%;margin-left:25%"
src="img/top-logo.png" src="/img/top-logo.png"
alt="MyHyvesbook+"> alt="MyHyvesbook+">
</div> </div>
<div class="platform">
<!-- Login content -->
<form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>"
return= $correct
method="post">
<h1>Welkom bij MyHyvesbook+</h1> <h1>Welkom bij MyHyvesbook+</h1>
<!-- Login content -->
<form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>"
return= $correct
method="post">
<!-- Login name --> <!-- Login name -->
<div class="login_containerlogin">
<label><b>Gebruikersnaam</b></label>
<input type="text"
placeholder="Voer uw gebruikersnaam in"
name="uname"
value="<?php echo $uname ?>"
title="Moet 6 of meer karakters bevatten"
>
</div>
<!-- Login password -->
<div class="login_containerlogin">
<label><b>Wachtwoord</b></label>
<input type="password"
placeholder="Voer uw wachtwoord in"
name="psw"
title="Moet minstens 8 karakters lang zijn"
>
</div>
<!-- Error message -->
<div class="login_containerfault"><span><?php echo $loginErr; ?></span></div>
<!-- Button for logging in -->
<div class="login_containerlogin">
<button type="submit"
value="Login"
name="submit"
id="frm1_submit">
Login
</button>
</div>
</form>
<!-- Button for going to the register screen -->
<div class="login_containerlogin"> <div class="login_containerlogin">
<label><b>Gebruikersnaam</b></label> <a href="https://myhyvesbookplus.nl/register" class="button">Registreer een account</a>
<input type="text"
placeholder="Voer uw gebruikersnaam in"
name="uname"
value="<?php echo $uname ?>"
title="Moet 6 of meer karakters bevatten"
>
</div> </div>
<!-- Login password -->
<div class="login_containerlogin">
<label><b>Wachtwoord</b></label>
<input type="password"
placeholder="Voer uw wachtwoord in"
name="psw"
title="Moet minimaal 1 cijfer, hoofdletter en kleine letter bevatten en minstens 8 karakters lang zijn"
>
</div>
<!-- Error message -->
<div class="login_containerfault"><span><?php echo $loginErr; ?></span></div>
<!-- Button for logging in -->
<div class="login_containerlogin">
<input type="submit"
value="Login"
name="submit"
id="frm1_submit" />
</div>
</form>
<!-- Button for going to the register screen -->
<div class="login_containerlogin">
<a href="https://myhyvesbookplus.nl/~joey/public/register.php" class="button">Registreer een account</a>
</div> </div>

View File

@@ -1,8 +1,12 @@
<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">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script src="jqeury.js"></script>
<script src="registerAndLogin.js"></script>
</head> </head>

View File

@@ -1,5 +1,5 @@
<nav class="menu"> <nav class="menu">
<section id="friends-menu-section"> <section id="friends-menu-section platform">
<h4> <h4>
Vrienden Vrienden
</h4> </h4>
@@ -7,13 +7,11 @@
<?php <?php
// Load file. // Load file.
include_once("../queries/friendship.php"); require_once("../queries/friendship.php");
require_once("../queries/user.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.
@@ -29,28 +27,50 @@
if (!empty($friend["profilepicture"])) if (!empty($friend["profilepicture"]))
$pf = $friend["profilepicture"]; $pf = $friend["profilepicture"];
if ($i > 1) if ($i > 5)
$extraItem = "extra-menu-items"; $extraItem = "extra-menu-items";
// Echo the friend. // Echo the friend.
echo " echo "
<a href='#' class='$extraItem'> <li class='friend-item $extraItem'>
<li class='friend-item'> <form action='profile.php' method='get'>
<div class='friend'> <button type='submit'
<img alt='PF' class='profile-picture' src='$pf'/> name='username'
$username value='$username'>
</div> <div class='friend'>
</li> <img alt='PF' class='profile-picture' src='$pf'/>
</a> $username
</div>
</button>
</form>
</li>
"; ";
} }
if ($i > 1) {
$i -= 1; $randomUser = selectRandomNotFriendUser($_SESSION["userID"])["username"];
echo "
<li class='friend-item'>
<form action='/profile' method='get'>
<button type='submit'
name='username'
value='$randomUser'>
<div class='friend'>
Klik hier voor een nieuw vriendje :)
</div>
</button>
</form>
</li>
";
if ($i > 5) {
$i -= 5;
echo " echo "
<li class='more-item' id='more-friends-click'> <li class='more-item' id='more-friends-click'>
En nog $i anderen... En nog $i anderen...
</li>"; </li>
";
} }
?> ?>
</ul> </ul>
</section> </section>
@@ -65,7 +85,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.
@@ -86,17 +106,28 @@
// Echo the friend. // Echo the friend.
echo " echo "
<a href='#' class='$extraItem'> <li class='group-item'>
<li class='group-item'> <form action='group.php' method='get'>
<div class='group'> <button type='submit'
<img alt='PF' class='group-picture' src='$picture'/> name='groupname'
$name value='$name'>
</div> <div class='group'>
</li> <img alt='PF' class='group-picture' src='$picture'/>
</a> $name
</div>
</button>
</form>
</li>
"; ";
} }
if ($i > 3) {
if ($i == 0) {
echo "<li class='group-item'>
<div class='group'>
Je hoort nergens bij.
</div>
</li>";
} else if ($i > 3) {
$i -= 3; $i -= 3;
echo " echo "
<li class='more-item' id='more-groups-click'> <li class='more-item' id='more-groups-click'>

View File

@@ -0,0 +1,16 @@
<nav class="menu" id="notification-center">
<section id="quick-links">
<a href="chat.php"><i class="fa fa-comments-o" data-title="Prive chats"></i></a>
<a href="settings.php"><i class="fa fa-cog" data-title="Instellingen"></i></a>
<a href="profile.php"><i class="fa fa-user" data-title="Profiel"></i></a>
<a href="logout.php"><i class="fa fa-sign-out" data-title="Uitloggen"></i></a>
</section>
<section id="notifocationCenter">
<h4>
Vriendchapsverzoeken
</h4>
<ul class="nav-list" id="friendrequestslist">
</ul>
</section>
</nav>

View File

@@ -1,113 +1,69 @@
<div class="content"> <div class="content">
<div class="profile-box platform"> <div class="profile-box platform">
<img class="left profile-picture" src="http://i.imgur.com/afjEUx2.jpg"> <img class="left profile-picture" src="<?php echo $user["profilepicture"] ?>">
<div class="profile-button"> <div class="profile-button">
<p><img src="img/add-friend.png"> Als vriend toevoegen</p> <p><img src="/img/add-friend.png"> Als vriend toevoegen</p>
</div> </div>
<h1 class="profile-username">[gebruikersnaam]</h1> <h1 class="profile-username"><?=$user["username"]?></h1>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec dictum turpis quam, eu ultrices sapien hendrerit tincidunt. Nunc aliquam neque turpis, id porta quam iaculis id. Sed suscipit, nisl a fermentum congue, nunc augue finibus lectus, id varius nunc purus nec dolor. Integer laoreet tellus sit amet sapien auctor congue. Mauris laoreet eu elit vel rhoncus. Nam et tortor arcu. Maecenas sit amet leo quis tellus varius gravida. Sed quis fermentum odio, sed dictum nulla. Donec aliquam rutrum orci cursus tempus. Quisque sit amet ipsum eget velit aliquam facilisis ultricies quis ligula. Nunc nisi lacus, luctus non bibendum quis, sagittis sit amet odio.</p> <h5 class="profile-username"><?= $user["fname"]?> <?=$user["lname"]?></h5>
<p><?=$user["bio"]?></p>
</div> </div>
<div class="item-box left platform"> <div class="item-box left platform">
<h2>Vrienden</h2> <h2>Vrienden</h2>
<p> <p>
<a href="#" data-title="[gebruikersnaam]"><img class="profile-picture" src="http://i.imgur.com/afjEUx2.jpg" alt="[gebruikersnaam]'s profielfoto"></a> <?php
<a href="#" data-title="[gebruikersnaam]"><img class="profile-picture" src="http://i.imgur.com/afjEUx2.jpg" alt="[gebruikersnaam]'s profielfoto"></a> while($friend = $profile_friends->fetch()) {
<a href="#" data-title="[gebruikersnaam]"><img class="profile-picture" src="http://i.imgur.com/afjEUx2.jpg" alt="[gebruikersnaam]'s profielfoto"></a> echo "<a href='/profile/${friend["username"]}/' data-title='${friend["username"]}'><img class='profile-picture' src='${friend["profilepicture"]}' alt='${friend["username"]}'s profielfoto></a>";
<a href="#" data-title="[gebruikersnaam]"><img class="profile-picture" src="http://i.imgur.com/afjEUx2.jpg" alt="[gebruikersnaam]'s profielfoto"></a> }
<a href="#" data-title="[gebruikersnaam]"><img class="profile-picture" src="http://i.imgur.com/afjEUx2.jpg" alt="[gebruikersnaam]'s profielfoto"></a>
<a href="#vrienden">...en nog 25 anderen!</a>
if($profile_friends->rowCount() === 0) {
echo "<p>Deze gebruiker heeft nog geen vrienden gemaakt.</p>";
}
?>
</p> </p>
</div> </div>
<div class="item-box right platform"> <div class="item-box right platform">
<h2>Groepen</h2> <h2>Groepen</h2>
<p> <p>
<a href="#" data-title="[groepsnaam]"><img class="group-picture" src="http://i.imgur.com/ztYhYro.png" alt="[groepsnaam]'s logo"></a> <?php
<a href="#" data-title="[groepsnaam]"><img class="group-picture" src="http://i.imgur.com/ztYhYro.png" alt="[groepsnaam]'s logo"></a> while($group = $profile_groups->fetch()) {
<a href="#" data-title="[groepsnaam]"><img class="group-picture" src="http://i.imgur.com/ztYhYro.png" alt="[groepsnaam]'s logo"></a> echo "<a href='/group/${group["name"]}/' data-title='${group["name"]}'><img class='group-picture' src='${group["picture"]}' alt='${group["name"]}s logo'></a>";
<a href="#" data-title="[groepsnaam]"><img class="group-picture" src="http://i.imgur.com/ztYhYro.png" alt="[groepsnaam]'s logo"></a> }
<a href="#" data-title="[groepsnaam]"><img class="group-picture" src="http://i.imgur.com/ztYhYro.png" alt="[groepsnaam]'s logo"></a>
<a href="#groepen">...en nog 6 anderen!</a> if($profile_groups->rowCount() === 0) {
echo "<p>Deze gebruiker is nog geen lid van een groep.</p>";
}
?>
</p> </p>
</div> </div>
<div class="posts"> <div class="posts">
<div class="post platform"> <?php
<h2>Lorem</h2> if ($_SESSION["userID"] === $userID) {
<p>Lorem ipsum dolor sit amet, consectetur.</p> ?>
<p class="subscript">Enkele minuten geleden geplaatst</p> <div class="post platform">
</div> <form>
<div class="post platform"> <input type="text" class="newpost" placeholder="Titel">
<h2>Image</h2> <textarea class="newpost">Schrijf een berichtje...</textarea>
<img src="http://i.imgur.com/ypIQKjE.jpg" alt="Olympic Mountains, Washington"> <input type="submit" value="Plaats!">
<p class="subscript">Gisteren geplaatst</p> </form>
</div> </div>
<div class="post platform"> <?php
<h2>Ipsum</h2> }
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Rem nihil alias amet dolores fuga totam sequi a cupiditate ipsa voluptas id facilis nobis.</p>
<p class="subscript">Maandag geplaatst</p>
</div>
<div class="post platform">
<h2>Dolor</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit.</p>
<p class="subscript">4 Januari geplaatst</p>
</div>
<div class="post platform">
<h2>Sit</h2>
<p>Lorem ipsum dolor sit.</p>
<p class="subscript">4 Januari geplaatst</p>
</div>
<div class="post platform">
<h2>Image</h2>
<img src="https://i.redditmedia.com/EBWWiEojgkRrdn89R7qF7tBZjJszJaIqgkWUH23s11A.jpg?w=576&s=ba4fe1f02485cb2327305924ef869a66" alt="Nunobiki Falls, Kobe Japan">
<p class="subscript">4 Januari geplaatst</p>
</div>
<div class="post platform">
<h2>Amet</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Minima asperiores eveniet vero velit eligendi aliquid in.</p>
<p class="subscript">4 Januari geplaatst</p>
</div>
<div class="post platform">
<h2>Consectetur</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Error aliquid reprehenderit expedita odio beatae est.</p>
<p class="subscript">4 Januari geplaatst</p>
</div>
<div class="post platform">
<h2>Adipisicing</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quaerat architecto quis tenetur fugiat veniam iste molestiae fuga labore!</p>
<p class="subscript">4 Januari geplaatst</p>
</div>
<div class="post platform">
<h2>Elit</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Rem ut debitis dolorum earum expedita eveniet voluptatem quibusdam facere eos numquam commodi ad iusto laboriosam rerum aliquam.</p>
<p class="subscript">4 Januari geplaatst</p>
</div>
<div class="post platform">
<h2>Geen error</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Doloribus dolorem maxime minima animi cum.</p>
<p class="subscript">4 Januari geplaatst</p>
</div>
<div class="post platform">
<h2>Image</h2>
<img src="https://i.reddituploads.com/82c1c4dd0cfb4a4aa1cfa16f93f5dbfa?fit=max&h=1536&w=1536&s=dd629d407f3646ee6e3adb4da78c93f2" alt="Oregon cliffs are no joke.">
<p class="subscript">4 Januari geplaatst</p>
</div>
<div class="post platform">
<h2>Aliquid</h2>
<p>Lorem ipsum dolor sit amet, consectetur.</p>
<p class="subscript">4 Januari geplaatst</p>
</div>
<div class="post platform">
<h2>Odit</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Odit accusamus tempore at porro officia rerum est impedit ea ipsa tenetur. Labore libero hic error sunt laborum expedita.</p>
<p class="subscript">4 Januari geplaatst</p>
</div>
<div class="post platform">
<h2>Accusamus</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Nobis quaerat suscipit ad.</p>
<p class="subscript">4 Januari geplaatst</p>
</div>
</div>
while($post = $posts->fetch()) {
$nicetime = nicetime($post["creationdate"]);
echo "
<div class='post platform'>
<h2>${post["title"]}</h2>
<p>${post["content"]}</p>
<p class=\"subscript\">${nicetime} geplaatst.</p>
</div>
";
}
?>
</div>
</div> </div>

View File

@@ -1,133 +1,134 @@
<div> <div>
<img style="width:50%;margin-left:25%" <img style="width:50%;margin-left:25%"
src="img/top-logo.png" src="/img/top-logo.png"
alt="MyHyvesbook+"> alt="MyHyvesbook+">
</div> </div>
<!-- Register Content --> <div class="platform">
<form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>" <h1>Registreer uw account</h1>
return= $correct <!-- Register Content -->
method="post"> <form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>"
<h2>Registreer uw account</h2> return= $correct
method="post">
<!-- Error message --> <!-- Error message -->
<div class="login_containerfault"><?php echo $genericErr;?></span></div> <div class="login_containerfault"><?php echo $genericErr;?></span></div>
<!-- Register name --> <!-- Register name -->
<div class="login_containerregister"> <div class="login_containerregister">
<label><b>Naam</b></label> <label><b>Naam</b></label>
<input type="text" <input type="text"
placeholder="Voer uw naam in" placeholder="Voer uw naam in"
name="name" name="name"
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>
<!-- Register surname -->
<div class="login_containerregister">
<label><b>Achternaam</b></label>
<input type="text"
placeholder="Voer uw achternaam in"
name="surname"
value="<?php echo $surname ?>"
title="Mag alleen letters bevatten"
>
*<span class="error"> <?php echo $surnameErr;?></span>
</div>
<!-- Register birthday -->
<div class="login_containerregister">
<label><b>Geboortedatum</b></label>
<input type="date"
name="bday"
value="<?php echo $bday ?>"
id="bday"
placeholder="01/01/1900"
>
*<span class="error"> <?php echo $bdayErr;?></span>
</div>
<!-- Register username -->
<div class="login_containerregister">
<label><b>Gebruikersnaam</b></label>
<input type="text"
placeholder="Voer uw gebruikersnaam in"
name="username"
value="<?php echo $username ?>"
title="Moet minimaal 6 karakters bevatten"
>
*<span class="error"> <?php echo $usernameErr;?></span>
<ul>
<li>Minstens 6 karakters</li>
</ul>
</div>
<!-- Register password -->
<div class="login_containerregister">
<label><b>Wachtwoord</b></label>
<input type="password"
placeholder="Voer uw wachtwoord in"
name="password"
value="<?php echo $password ?>"
id="password"
>
*<span class="error"> <?php echo $passwordErr;?></span>
<ul>
<li>Minstens 8 karakters</li>
</ul>
</div>
<!-- Repeat password -->
<div class="login_containerregister">
<label><b>Herhaal wachtwoord</b></label>
<input type="password"
placeholder="Herhaal wachtwoord"
name="confirmpassword"
value="<?php echo $confirmpassword ?>"
id="confirmpassword"
title="Herhaal wachtwoord"
>
*<span class="error"> <?php echo $confirmpasswordErr;?></span>
</div>
<!-- Register location -->
<div class="login_containerregister">
<label><b>Woonplaats</b></label>
<input type="text"
placeholder="Voer uw woonplaats in"
name="location"
value="<?php echo $location ?>"
pattern="[A-Za-z]{1,}"
title="Mag alleen letters bevatten">
*<span class="error"> <?php echo $locationErr;?></span>
</div>
<!-- Register email -->
<div class="login_containerregister">
<label><b>Email</b></label>
<input type="text"
placeholder="Voer uw email in"
name="email"
value="<?php echo $email ?>"
id="email"
title="Voer een geldige email in">
*<span class="error"> <?php echo $emailErr;?></span>
</div>
<!-- Button for registering -->
<div class="login_containerregister">
<button type="submit"
value="Registreer uw account"
name="Submit"
id="frm1_submit">
Registreer
</button>
</div>
</form>
<div class="login_containerlogin">
<!-- Button for going back to login screen -->
<a href="https://myhyvesbookplus.nl/login.php" class="left-arrow">Login</a>
</div> </div>
<!-- Register surname -->
<div class="login_containerregister">
<label><b>Achternaam</b></label>
<input type="text"
placeholder="Voer uw achternaam in"
name="surname"
value="<?php echo $surname ?>"
title="Mag alleen letters bevatten"
>
<span class="error">* <?php echo $surnameErr;?></span>
</div>
<!-- Register birthday -->
<div class="login_containerregister">
<label><b>Geboortedatum</b></label>
<input type="date"
name="bday"
value="<?php echo $bday ?>"
id="bday"
placeholder="01/01/1900"
>
<span class="error">* <?php echo $bdayErr;?></span>
</div>
<!-- Register username -->
<div class="login_containerregister">
<label><b>Gebruikersnaam</b></label>
<input type="text"
placeholder="Voer uw gebruikersnaam in"
name="username"
value="<?php echo $username ?>"
title="Moet minimaal 6 karakters bevatten"
>
<span class="error">* <?php echo $usernameErr;?></span>
</div>
<ul>
<li>Minstens 6 karakters</li>
</ul>
<!-- Register password -->
<div class="login_containerregister">
<label><b>Wachtwoord</b></label>
<input type="password"
placeholder="Voer uw wachtwoord in"
name="password"
value="<?php echo $password ?>"
id="password"
>
<span class="error">* <?php echo $passwordErr;?></span>
</div>
<ul>
<li>Minstens 8 karakters</li>
</ul>
<!-- Repeat password -->
<div class="login_containerregister">
<label><b>Herhaal wachtwoord</b></label>
<input type="password"
placeholder="Herhaal wachtwoord"
name="confirmpassword"
value="<?php echo $confirmpassword ?>"
id="confirmpassword"
title="Herhaal wachtwoord"
>
<span class="error">* <?php echo $confirmpasswordErr;?></span>
</div>
<!-- Register location -->
<div class="login_containerregister">
<label><b>Woonplaats</b></label>
<input type="text"
placeholder="Voer uw woonplaats in"
name="location"
value="<?php echo $location ?>"
pattern="[A-Za-z]{1,}"
title="Mag alleen letters bevatten">
<span class="error">* <?php echo $locationErr;?></span>
</div>
<!-- Register email -->
<div class="login_containerregister">
<label><b>Email</b></label>
<input type="email"
placeholder="Voer uw email in"
name="email"
value="<?php echo $email ?>"
id="email"
title="Voer een geldige email in">
<span class="error">* <?php echo $emailErr;?></span>
</div>
<!-- Button for registering -->
<div class="login_containerregister">
<input type="submit"
value="Registreer uw account"
name="Submit"
id="frm1_submit" />
</div>
</form>
<!-- Button for going back to login screen -->
<div class="login_containerlogin">
<a href="https://myhyvesbookplus.nl/~joey/public/login.php" class="button">Login met een account</a>
</div> </div>

File diff suppressed because one or more lines are too long

View File

@@ -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">
@@ -68,7 +68,7 @@ $settings = getSettings();
</li> </li>
</ul> </ul>
</form> </form>
<form class="settings-profilepictue platform" method="post"> <form class="settings-profilepictue platform" method="post" enctype="multipart/form-data">
<h5>Verander profielfoto</h5> <h5>Verander profielfoto</h5>
<ul> <ul>
<li> <li>