Merge branch 'master' into kevin-prototype
This commit is contained in:
41
website/public/API/nietSlecht.php
Normal file
41
website/public/API/nietSlecht.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
session_start();
|
||||
require_once ("../queries/connect.php");
|
||||
require_once ("../queries/checkInput.php");
|
||||
|
||||
function getNietSlechtCountForPost(int $postID) : int {
|
||||
$stmt = $GLOBALS["db"]->prepare("
|
||||
SELECT
|
||||
`userID`
|
||||
FROM
|
||||
`niet_slecht`
|
||||
WHERE
|
||||
`postID` = :postID
|
||||
");
|
||||
$stmt->bindParam(":postID", $postID);
|
||||
$stmt->execute();
|
||||
return $stmt->rowCount();
|
||||
}
|
||||
|
||||
function getNietSlechtUsersForPost(int $postID) {
|
||||
$stmt = $GLOBALS["db"]->prepare("
|
||||
SELECT
|
||||
`fname`,
|
||||
`lname`,
|
||||
CONCAT(`user`.`fname`, ' ', `user`.`lname`) as `fullname`
|
||||
FROM
|
||||
`user`
|
||||
INNER JOIN
|
||||
`niet_slecht`
|
||||
WHERE
|
||||
`user`.`userID` = `niet_slecht`.`userID` AND
|
||||
`niet_slecht`.`postID` = :postID
|
||||
");
|
||||
$stmt->bindParam(":postID", $postID);
|
||||
$stmt->execute();
|
||||
$rows = $stmt->fetchAll();
|
||||
foreach ($rows as $row) {
|
||||
print($row["fullname"]);
|
||||
}
|
||||
}
|
||||
@@ -5,14 +5,25 @@ session_start();
|
||||
require("../../queries/post.php");
|
||||
require("../../queries/connect.php");
|
||||
require("../../queries/checkInput.php");
|
||||
if (empty($_POST['newcomment-content'])) {
|
||||
print_r($_POST);
|
||||
if ($_POST['button'] == 'reaction') {
|
||||
if (empty($_POST['newcomment-content'])) {
|
||||
echo 0;
|
||||
} else {
|
||||
if(makeComment($_POST['postID'],
|
||||
} else {
|
||||
if (makeComment($_POST['postID'],
|
||||
$_SESSION['userID'],
|
||||
test_input($_POST['newcomment-content']))) {
|
||||
echo 1;
|
||||
} else {
|
||||
echo 0;
|
||||
}
|
||||
}
|
||||
} else if ($_POST['button'] == 'nietslecht') {
|
||||
if (makeNietSlecht($_POST["postID"], $_SESSION["userID"])) {
|
||||
echo 1;
|
||||
} else {
|
||||
echo 0;
|
||||
}
|
||||
} else {
|
||||
echo 0;
|
||||
}
|
||||
@@ -1,3 +1,5 @@
|
||||
var previousDate = new Date("1970-01-01 00:00:00");
|
||||
|
||||
$(document).ready(function() {
|
||||
loadMessages();
|
||||
sayEmpty();
|
||||
@@ -31,17 +33,28 @@ function sendMessage() {
|
||||
}
|
||||
|
||||
function addMessages(messages) {
|
||||
for(i in messages) {
|
||||
for(var i in messages) {
|
||||
thisDate = new Date(messages[i].creationdate);
|
||||
thisDate.setHours(0,0,0,0);
|
||||
if (messages[i].destination == $(".destinationID").val()) {
|
||||
type = "chat-message-self";
|
||||
} else {
|
||||
type = "chat-message-other";
|
||||
}
|
||||
|
||||
if (thisDate > previousDate) {
|
||||
previousDate = thisDate;
|
||||
$("#chat-history").append('\
|
||||
<div class="day-message"> \
|
||||
<div class="day-message-content">\
|
||||
' + days[thisDate.getDay()] + " " + thisDate.getDate() + " " + months[thisDate.getMonth()] + " " + thisDate.getFullYear() + '\
|
||||
</div> \
|
||||
</div>\
|
||||
');
|
||||
}
|
||||
$("#chat-history").append('\
|
||||
<div class="chat-message"> \
|
||||
<div class="' + type + '">\
|
||||
' + messages[i].content + '\
|
||||
' + fancyText(messages[i].content) + '\
|
||||
</div> \
|
||||
</div>\
|
||||
');
|
||||
@@ -49,6 +62,7 @@ function addMessages(messages) {
|
||||
}
|
||||
|
||||
function switchUser(userID) {
|
||||
previousDate = new Date("1970-01-01 00:00:00");
|
||||
$(".chat-field").show();
|
||||
$(".destinationID").val(userID);
|
||||
$("#chat-history").html("");
|
||||
|
||||
@@ -4,12 +4,14 @@ function placeFriendButtons() {
|
||||
friendshipStatus = data;
|
||||
$buttonContainer = $("div.friend-button-container");
|
||||
$buttonContainer.children().remove();
|
||||
$("#start-profile-chat-form").hide();
|
||||
if (friendshipStatus == -1) {
|
||||
return;
|
||||
} else if(friendshipStatus == 0) {
|
||||
$buttonContainer.append($("<button class=\"green friend-button\" value=\"request\"><i class=\"fa fa-handshake-o\"></i> Bevriend</button>"));
|
||||
} else if(friendshipStatus == 1) {
|
||||
$buttonContainer.append($("<button class=\"red friend-button\" value=\"delete\"><i class=\"fa fa-times\"></i> Verwijder</button>"));
|
||||
$("#start-profile-chat-form").show();
|
||||
} else if(friendshipStatus == 2) {
|
||||
$buttonContainer.append($("<button class=\"red friend-button\" value=\"delete\"><i class=\"fa fa-times\"></i> Trek verzoek in</button>"));
|
||||
} else if(friendshipStatus == 3) {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
$(document).ready(function() {
|
||||
|
||||
// Toggle menu
|
||||
$("#own-profile-picture, #open-notifications").click(function() {
|
||||
if ($("#notification-center").css('right') == "-256px") {
|
||||
@@ -8,12 +7,22 @@ $(document).ready(function() {
|
||||
$(".modal").width("calc(100% - 512px)");
|
||||
$(".content").css("margin-right", "256px");
|
||||
$("#notification-center").css("right", "0px");
|
||||
|
||||
// Add cookie so the menu stays open on other pages
|
||||
document.cookie = "menu=open; path=/";
|
||||
} else {
|
||||
// Make the menu invisible and move the content to the right.
|
||||
$("#chat-history").width("calc(100% - 331px)");
|
||||
$(".modal").width("calc(100% - 256px)");
|
||||
$(".content").css("margin-right", "0px");
|
||||
$("#notification-center").css("right", "-256px");
|
||||
|
||||
// Change menu cookie to close
|
||||
document.cookie = "menu=closed; path=/";
|
||||
}
|
||||
});
|
||||
|
||||
if (getCookie("menu") == "open") {
|
||||
$("#own-profile-picture").click();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1,3 +1,34 @@
|
||||
var days = ["zondag", "maandag", "dinsdag", "woensdag", "donderdag", "vrijdag", "zaterdag"];
|
||||
var months = ["januari", "februari", "maart", "april", "mei", "juni", "juli", "augustus", "september", "oktober", "november", "december"]
|
||||
|
||||
function fancyText(text) {
|
||||
|
||||
// Add images and gifs.
|
||||
var regex = /(https:\/\/.[^ ]*\.(?:png|jpg|jpeg|gif))/ig;
|
||||
text = text.replace(regex, function(img) {
|
||||
return "<img src='" + img + "' />";
|
||||
});
|
||||
|
||||
// Add links.
|
||||
// regex = /(https:\/\/.[^ ]*\.(?:net|com|nl))/ig;
|
||||
// text = text.replace(regex, function(link) {
|
||||
// return "<a href='" + link + "'>LINK</a>";
|
||||
// });
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
function getCookie(key) {
|
||||
cookies = document.cookie.split("; ");
|
||||
for (var i in cookies) {
|
||||
cookie = cookies[i].split("=");
|
||||
if (cookie[0] == key) {
|
||||
return cookie[1];
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function editFriendship(userID, value) {
|
||||
$.post("API/editFriendship.php", { usr: userID, action: value })
|
||||
.done(function() {
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
function postComment() {
|
||||
function postComment(buttonValue) {
|
||||
formData = $("#newcommentform").serializeArray();
|
||||
formData.push({name: "button", value: buttonValue});
|
||||
$.post(
|
||||
"API/postComment.php",
|
||||
$("#newcommentform").serialize()
|
||||
formData
|
||||
);
|
||||
|
||||
$("#newcomment").val("");
|
||||
@@ -14,5 +16,3 @@ function postComment() {
|
||||
$('#modal-response').html(data);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
function checkLoggedIn() {
|
||||
if (confirm("You are already logged in!\nDo you want to logout?\nPress ok to logout.") == true) {
|
||||
if (confirm("U bent al ingelogd!!\nWilt u uitloggen?\nKlik ok om uit te loggen.") == true) {
|
||||
window.location.href = "logout.php";
|
||||
} else {
|
||||
window.location.href = "profile.php";
|
||||
@@ -7,9 +7,9 @@ function checkLoggedIn() {
|
||||
}
|
||||
|
||||
function bannedAlert(){
|
||||
alert("Your account is banned");
|
||||
alert("Uw account is geband!");
|
||||
}
|
||||
|
||||
function emailNotConfirmed(){
|
||||
alert("Your account has not been verified yet!\nAnother email has been sent to you")
|
||||
alert("Uw account is nog niet bevestigd!\nEr is een nieuwe email gestuurd om uw account te bevestigen");
|
||||
}
|
||||
|
||||
@@ -8,7 +8,6 @@ function searchUsers(n, m) {
|
||||
filter: $("#search-filter").val()
|
||||
}
|
||||
).done(function(data) {
|
||||
console.log(data);
|
||||
if (!showFriends(data, "#search-users-list", 0, "profile.php", "GET")) {
|
||||
$("#search-users-list").text("Niemand gevonden");
|
||||
}
|
||||
@@ -25,7 +24,6 @@ function searchGroups(n, m) {
|
||||
filter: $("#search-filter").val()
|
||||
}
|
||||
).done(function(data) {
|
||||
console.log(data);
|
||||
if (!showGroups(data, "#search-groups-list")) {
|
||||
$("#search-groups-list").text("Geen groepen gevonden");
|
||||
}
|
||||
|
||||
@@ -19,16 +19,24 @@
|
||||
</script>";
|
||||
}
|
||||
|
||||
// define variables and set to empty values
|
||||
$name = $surname = $bday = $username = $password = $confirmpassword = $location = $housenumber = $email = $confirmEmail = $captcha = $ip = "";
|
||||
$genericErr = $nameErr = $surnameErr = $bdayErr = $usernameErr = $passwordErr = $confirmpasswordErr = $locationErr = $housenumberErr = $emailErr = $confirmEmailErr = $captchaErr = "";
|
||||
$correct = true;
|
||||
$day_date = "dag";
|
||||
$month_date = "maand";
|
||||
$year_date = "jaar";
|
||||
|
||||
// Define variables and set to empty values
|
||||
$uname = $psw ="";
|
||||
$user = $psw = $remember ="";
|
||||
$loginErr = $resetErr ="";
|
||||
|
||||
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||
switch ($_POST["submit"]) {
|
||||
case "login":
|
||||
try {
|
||||
$uname = ($_POST["uname"]);
|
||||
validateLogin($_POST["uname"], $_POST["psw"]);
|
||||
$user = ($_POST["user"]);
|
||||
validateLogin($_POST["user"], $_POST["psw"]);
|
||||
} catch(loginException $e) {
|
||||
$loginErr = $e->getMessage();
|
||||
}
|
||||
@@ -46,19 +54,10 @@
|
||||
</script>";
|
||||
}
|
||||
break;
|
||||
|
||||
case "register":
|
||||
include("register.php");
|
||||
}
|
||||
}
|
||||
// // Trying to login
|
||||
// if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||
// try{
|
||||
// $uname = ($_POST["uname"]);
|
||||
// validateLogin($_POST["uname"], $_POST["psw"]);
|
||||
// } catch(loginException $e) {
|
||||
// $loginErr = $e->getMessage();
|
||||
// }
|
||||
// }
|
||||
|
||||
/* This view adds login view */
|
||||
include("../views/login-view.php");
|
||||
?>
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
<style>
|
||||
@import url("styles/profile.css");
|
||||
@import url("styles/post-popup.css");
|
||||
@import url('https://fonts.googleapis.com/css?family=Anton');
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
115
website/public/register(stash).php
Normal file
115
website/public/register(stash).php
Normal file
@@ -0,0 +1,115 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<?php
|
||||
include("../views/login_head.php");
|
||||
require_once("../queries/connect.php");
|
||||
include_once("../queries/register.php");
|
||||
include_once("../queries/checkInput.php");
|
||||
include_once("../queries/emailconfirm.php");
|
||||
?>
|
||||
<body>
|
||||
<?php
|
||||
session_start();
|
||||
if(isset($_SESSION["userID"])){
|
||||
header("location: login.php");
|
||||
}
|
||||
// define variables and set to empty values
|
||||
$name = $surname = $bday = $username = $password = $confirmpassword = $location = $housenumber = $email = $confirmEmail = $captcha = $ip = "";
|
||||
$genericErr = $nameErr = $surnameErr = $bdayErr = $usernameErr = $passwordErr = $confirmpasswordErr = $locationErr = $housenumberErr = $emailErr = $confirmEmailErr = $captchaErr = "";
|
||||
$correct = true;
|
||||
$day_date = "dag";
|
||||
$month_date = "maand";
|
||||
$year_date = "jaar";
|
||||
|
||||
// Trying to register an account
|
||||
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||
try {
|
||||
$name = test_input(($_POST["name"]));
|
||||
checkInputChoice($name, "lettersAndSpaces");
|
||||
} catch(lettersAndSpacesException $e){
|
||||
$correct = false;
|
||||
$nameErr = $e->getMessage();
|
||||
}
|
||||
|
||||
try {
|
||||
$surname = test_input(($_POST["surname"]));
|
||||
checkInputChoice($surname, "lettersAndSpaces");
|
||||
}
|
||||
catch(lettersAndSpacesException $e){
|
||||
$correct = false;
|
||||
$surnameErr = $e->getMessage();
|
||||
}
|
||||
|
||||
try{
|
||||
$day_date = test_input(($_POST["day_date"]));
|
||||
$month_date = test_input(($_POST["month_date"]));
|
||||
$year_date = test_input(($_POST["year_date"]));
|
||||
$bday = $year_date . "-" . $month_date . "-" . $day_date;
|
||||
checkInputChoice($bday, "bday");
|
||||
} catch(bdayException $e){
|
||||
$correct = false;
|
||||
$bdayErr = $e->getMessage();
|
||||
}
|
||||
|
||||
try{
|
||||
$username = str_replace(' ', '', test_input(($_POST["username"])));
|
||||
checkInputChoice($username, "username");
|
||||
} catch(usernameException $e){
|
||||
$correct = false;
|
||||
$usernameErr = $e->getMessage();
|
||||
}
|
||||
|
||||
try{
|
||||
$password = str_replace(' ', '', test_input(($_POST["password"])));
|
||||
checkInputChoice($password, "longerEight");
|
||||
matchPassword();
|
||||
} catch(passwordException $e){
|
||||
$correct = false;
|
||||
$passwordErr = $e->getMessage();
|
||||
} catch(confirmPasswordException $e){
|
||||
$correct = false;
|
||||
$confirmPasswordErr = $e->getMessage();
|
||||
}
|
||||
|
||||
try{
|
||||
$location = test_input(($_POST["location"]));
|
||||
checkInputChoice($location, "lettersAndSpaces");
|
||||
} catch(lettersAndSpacesException $e){
|
||||
$correct = false;
|
||||
$locationErr = $e->getMessage();
|
||||
}
|
||||
|
||||
try{
|
||||
$email = test_input(($_POST["email"]));
|
||||
checkInputChoice($email, "email");
|
||||
$confirmEmail = test_input(($_POST["confirmEmail"]));
|
||||
matchEmail();
|
||||
} catch(emailException $e){
|
||||
$correct = false;
|
||||
$emailErr = $e->getMessage();
|
||||
} catch(confirmEmailException $e){
|
||||
$correct = false;
|
||||
$confirmEmailErr = $e->getMessage();
|
||||
}
|
||||
|
||||
try{
|
||||
$captcha = $_POST['g-recaptcha-response'];
|
||||
checkCaptcha($captcha);
|
||||
} catch(captchaException $e){
|
||||
$correct = false;
|
||||
$captchaErr = $e->getMessage();
|
||||
}
|
||||
|
||||
try {
|
||||
getIp();
|
||||
registerCheck($correct);
|
||||
sendConfirmEmailUsername($username);
|
||||
} catch(registerException $e){
|
||||
$genericErr = $e->getMessage();
|
||||
}
|
||||
}
|
||||
/* This view adds register view */
|
||||
include("../views/register-view.php");
|
||||
?>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,25 +1,5 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<?php
|
||||
include("../views/login_head.php");
|
||||
require_once("../queries/connect.php");
|
||||
include_once("../queries/register.php");
|
||||
include_once("../queries/checkInput.php");
|
||||
include_once("../queries/emailconfirm.php");
|
||||
?>
|
||||
<body>
|
||||
<?php
|
||||
session_start();
|
||||
if(isset($_SESSION["userID"])){
|
||||
header("location: login.php");
|
||||
}
|
||||
// define variables and set to empty values
|
||||
$name = $surname = $bday = $username = $password = $confirmpassword = $location = $housenumber = $email = $captcha = $ip = "";
|
||||
$genericErr = $nameErr = $surnameErr = $bdayErr = $usernameErr = $passwordErr = $confirmpasswordErr = $locationErr = $housenumberErr = $emailErr = $captchaErr = "";
|
||||
$correct = true;
|
||||
|
||||
// Trying to register an account
|
||||
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||
try {
|
||||
$name = test_input(($_POST["name"]));
|
||||
checkInputChoice($name, "lettersAndSpaces");
|
||||
@@ -38,7 +18,10 @@
|
||||
}
|
||||
|
||||
try{
|
||||
$bday = test_input(($_POST["bday"]));
|
||||
$day_date = test_input(($_POST["day_date"]));
|
||||
$month_date = test_input(($_POST["month_date"]));
|
||||
$year_date = test_input(($_POST["year_date"]));
|
||||
$bday = $year_date . "-" . $month_date . "-" . $day_date;
|
||||
checkInputChoice($bday, "bday");
|
||||
} catch(bdayException $e){
|
||||
$correct = false;
|
||||
@@ -76,9 +59,14 @@
|
||||
try{
|
||||
$email = test_input(($_POST["email"]));
|
||||
checkInputChoice($email, "email");
|
||||
$confirmEmail = test_input(($_POST["confirmEmail"]));
|
||||
matchEmail();
|
||||
} catch(emailException $e){
|
||||
$correct = false;
|
||||
$emailErr = $e->getMessage();
|
||||
} catch(confirmEmailException $e){
|
||||
$correct = false;
|
||||
$confirmEmailErr = $e->getMessage();
|
||||
}
|
||||
|
||||
try{
|
||||
@@ -94,11 +82,10 @@
|
||||
registerCheck($correct);
|
||||
sendConfirmEmailUsername($username);
|
||||
} catch(registerException $e){
|
||||
echo "<script>
|
||||
window.onload = function() {
|
||||
$('#registerModal').show();
|
||||
}
|
||||
</script>";
|
||||
$genericErr = $e->getMessage();
|
||||
}
|
||||
}
|
||||
/* This view adds register view */
|
||||
include("../views/register-view.php");
|
||||
?>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
|
||||
body {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/* Overall chat-screen */
|
||||
.chat {
|
||||
position: fixed;
|
||||
@@ -37,6 +42,22 @@
|
||||
}
|
||||
|
||||
/* Chat-message takes the whole width of the chat area */
|
||||
.day-message {
|
||||
width: 100%;
|
||||
min-height: 40px;
|
||||
padding: 10px 0;
|
||||
clear: both;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.day-message-content {
|
||||
width: auto;
|
||||
padding: 10px;
|
||||
|
||||
background-color: #F8F8F8;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.chat-message {
|
||||
width: 100%;
|
||||
min-height: 40px;
|
||||
@@ -106,3 +127,7 @@
|
||||
background: #4CAF50;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.chat-message img {
|
||||
max-width: 100%;
|
||||
}
|
||||
@@ -30,8 +30,10 @@ form {
|
||||
border-radius: 12px;
|
||||
height: 85%;
|
||||
margin: auto;
|
||||
width: 80%;
|
||||
overflow-y:auto;
|
||||
width: 600px;
|
||||
overflow-y: auto;
|
||||
overflow-x: hidden;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -44,13 +46,13 @@ h1 {
|
||||
|
||||
/* registreer titel*/
|
||||
h2 {
|
||||
padding: 16px;
|
||||
padding: 8px;
|
||||
text-align: left;
|
||||
font-size: 2.0em;
|
||||
}
|
||||
|
||||
h3 {
|
||||
padding: 16px;
|
||||
padding: 8px;
|
||||
text-align: center;
|
||||
font-size: 1.5em;
|
||||
}
|
||||
@@ -61,11 +63,15 @@ input[type=text], input[type=password], input[type=email], input[type="date"] {
|
||||
display: inline-block;
|
||||
height: 60%;
|
||||
font-size: 16px;
|
||||
padding: 8px 20px;
|
||||
padding: 8px 10px;
|
||||
margin: 4px 0;
|
||||
width: 55%;
|
||||
}
|
||||
|
||||
.middle{
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.center{
|
||||
text-align: center;
|
||||
}
|
||||
@@ -77,7 +83,7 @@ button {
|
||||
cursor: pointer;
|
||||
height: 50%;
|
||||
padding: 8px 20px;
|
||||
margin: 10px;
|
||||
margin: 5px;
|
||||
font-family: Arial;
|
||||
font-size: 22px;
|
||||
box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
|
||||
@@ -88,6 +94,7 @@ button {
|
||||
font-family: Arial;
|
||||
font-size: 15px;
|
||||
color: red;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
label {
|
||||
@@ -96,19 +103,19 @@ label {
|
||||
|
||||
/* padding voor registreer container */
|
||||
.login_containerregister {
|
||||
padding: 16px;
|
||||
padding: 8px;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
/* padding voor login_containers */
|
||||
.login_containerlogin {
|
||||
padding:16px;
|
||||
padding:8px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/* padding voor foutmelding login */
|
||||
.login_containerfault {
|
||||
padding: 16px;
|
||||
padding: 4px;
|
||||
text-align: center;
|
||||
color: red;
|
||||
}
|
||||
@@ -127,10 +134,14 @@ label {
|
||||
background-attachment: fixed;*/
|
||||
box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
|
||||
height: 400px;
|
||||
margin: 34px auto;
|
||||
margin: 16px auto;
|
||||
overflow-y: auto;
|
||||
padding: 20px;
|
||||
width: 45%;
|
||||
width: 600px;
|
||||
}
|
||||
|
||||
select{
|
||||
width: 18%;
|
||||
}
|
||||
|
||||
ul {
|
||||
@@ -143,12 +154,12 @@ ul {
|
||||
display: none; /* Hidden by default */
|
||||
position: fixed; /* Stay in place */
|
||||
z-index: 1; /* Sit on top */
|
||||
padding-top: 100px; /* Location of the box */
|
||||
padding-top: 30px; /* Location of the box */
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 100%; /* Full width */
|
||||
height: 100%; /* Full height */
|
||||
overflow: auto; /* Enable scroll if needed */
|
||||
overflow: hidden; /* Enable scroll if needed */
|
||||
background-color: rgb(0,0,0); /* Fallback color */
|
||||
background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
|
||||
}
|
||||
@@ -160,7 +171,7 @@ ul {
|
||||
margin: auto;
|
||||
padding: 0;
|
||||
border: 1px solid #888;
|
||||
width: 500px;
|
||||
width: 600px;
|
||||
box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2),0 6px 20px 0 rgba(0,0,0,0.19);
|
||||
-webkit-animation-name: animatetop;
|
||||
-webkit-animation-duration: 0.4s;
|
||||
@@ -183,7 +194,7 @@ ul {
|
||||
.close {
|
||||
color: white;
|
||||
float: right;
|
||||
font-size: 28px;
|
||||
font-size: 36px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
@@ -195,15 +206,16 @@ ul {
|
||||
}
|
||||
|
||||
.modal-header {
|
||||
padding: 2px 16px;
|
||||
padding: 4px 16px;
|
||||
background-color: #FBC02D;
|
||||
color: black;
|
||||
}
|
||||
|
||||
.modal-body {padding: 2px 16px;}
|
||||
.modal-body {
|
||||
padding: 2px 16px;
|
||||
}
|
||||
|
||||
.modal-footer {
|
||||
padding: 2px 16px;
|
||||
background-color: #FBC02D;
|
||||
color: black;
|
||||
}
|
||||
@@ -275,3 +275,16 @@ div[data-title]:hover:after {
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar {
|
||||
width: 5px;
|
||||
height: 5px;
|
||||
}
|
||||
::-webkit-scrollbar-track {
|
||||
background: none;
|
||||
}
|
||||
::-webkit-scrollbar-thumb {
|
||||
-webkit-border-radius: 20px;
|
||||
border-radius: 20px;
|
||||
background: #4CAF50;
|
||||
}
|
||||
@@ -70,3 +70,8 @@
|
||||
margin: 5px auto;
|
||||
width: 95%;
|
||||
}
|
||||
|
||||
.nietslecht {
|
||||
font-family: Impact, Anton, sans-serif;
|
||||
text-shadow: -1.5px 0 1px black, 0 1.5px 1px black, 1px 0 1.5px black, 0 -1.5px 1px black;
|
||||
}
|
||||
@@ -30,6 +30,7 @@ div.posts div.post {
|
||||
width: calc(100% - 40px);
|
||||
cursor: pointer;
|
||||
transition-duration: 250ms;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
|
||||
div.posts div.post:hover {
|
||||
|
||||
@@ -38,7 +38,6 @@ function checkName($variable){
|
||||
if (empty($variable)) {
|
||||
throw new lettersAndSpacesException("Verplicht!");
|
||||
} else if (!preg_match("/^[a-zA-Z ]*$/", $variable)) {
|
||||
|
||||
throw new lettersAndSpacesException("Alleen letters en spaties zijn toegestaan!");
|
||||
}
|
||||
}
|
||||
@@ -48,12 +47,12 @@ function validateBday($variable){
|
||||
if (empty($variable)) {
|
||||
throw new bdayException("Verplicht!");
|
||||
} else {
|
||||
if (!(validateDate($variable, "Y/m/d"))) {
|
||||
if (!(validateDate($variable, "Y-m-d"))) {
|
||||
throw new bdayException("Geen geldige datum");
|
||||
} else {
|
||||
$dateNow = date("Y/m/d");
|
||||
$dateNow = date("Y-m-d");
|
||||
if ($dateNow < $variable) {
|
||||
throw new bdayException("Geen geldige datum");
|
||||
throw new bdayException("Geen geldige datum!");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -97,6 +96,12 @@ function validateEmail($variable){
|
||||
}
|
||||
}
|
||||
|
||||
function matchEmail(){
|
||||
if (strtolower($_POST["email"]) != strtolower($_POST["confirmEmail"])){
|
||||
throw new confirmEmailException("Emails matchen niet!");
|
||||
}
|
||||
}
|
||||
|
||||
/* checks if an input is a valid email. */
|
||||
function resetEmail($variable){
|
||||
if (empty($variable)) {
|
||||
@@ -119,11 +124,11 @@ function matchPassword(){
|
||||
/* Checks if captcha is correctly filled in */
|
||||
function checkCaptcha($captcha){
|
||||
if(!$captcha){
|
||||
throw new captchaException("Captcha needs to be filled in!");
|
||||
throw new captchaException("Captcha moet ingevuld worde!");
|
||||
} else {
|
||||
$response=json_decode(file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=6Lc72xIUAAAAAPizuF3nUbklCPljVCVzgYespz8o&response=".$captcha."&remoteip=".$_SERVER['REMOTE_ADDR']));
|
||||
if($response->success==false) {
|
||||
throw new captchaException("You are a spammer!");
|
||||
throw new captchaException("Je bent een spammer!");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -206,6 +211,14 @@ class emailException extends Exception
|
||||
}
|
||||
}
|
||||
|
||||
class confirmEmailException extends Exception
|
||||
{
|
||||
public function __construct($message = "", $code = 0, Exception $previous = null)
|
||||
{
|
||||
parent::__construct($message, $code, $previous);
|
||||
}
|
||||
}
|
||||
|
||||
class captchaException extends Exception
|
||||
{
|
||||
public function __construct($message = "", $code = 0, Exception $previous = null)
|
||||
|
||||
@@ -9,10 +9,11 @@ function getUser() {
|
||||
FROM
|
||||
`user`
|
||||
WHERE
|
||||
`username` LIKE :username
|
||||
`username` LIKE :username OR
|
||||
`email` LIKE :username
|
||||
");
|
||||
|
||||
$stmt->bindParam(":username", $_POST["uname"]);
|
||||
$stmt->bindValue(":username", test_input($_POST["user"]));
|
||||
$stmt->execute();
|
||||
return $stmt->fetch(PDO::FETCH_ASSOC);
|
||||
}
|
||||
@@ -20,7 +21,7 @@ function getUser() {
|
||||
function validateLogin($username, $password){
|
||||
// Empty username or password field
|
||||
if (empty($username) || empty($password)) {
|
||||
throw new loginException("Gebruikersnaam of wachtwoord is niet ingevuld");
|
||||
throw new loginException("Inloggegevens zijn niet ingevuld");
|
||||
}
|
||||
else {
|
||||
$psw = test_input($password);
|
||||
@@ -41,6 +42,9 @@ function validateLogin($username, $password){
|
||||
</script>";
|
||||
} else {
|
||||
$_SESSION["userID"] = $userID;
|
||||
// if($_POST[rememberMe] == 1){
|
||||
// ini_set("session.gc_maxlifetime", "10");
|
||||
// }
|
||||
header("location: profile.php");
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -75,7 +75,7 @@ function makePost($userID, $groupID, $title, $content) {
|
||||
$stmt->execute();
|
||||
}
|
||||
|
||||
function makeComment($postID, $userID, $content) {
|
||||
function makeComment($postID, $userID, $content) : int {
|
||||
$stmt = $GLOBALS["db"]->prepare("
|
||||
INSERT INTO
|
||||
`comment` (
|
||||
@@ -94,4 +94,55 @@ function makeComment($postID, $userID, $content) {
|
||||
$stmt->bindParam(':userID', $userID);
|
||||
$stmt->bindParam(':content', $content);
|
||||
$stmt->execute();
|
||||
return $stmt->rowCount();
|
||||
}
|
||||
|
||||
function makeNietSlecht(int $postID, int $userID) : int {
|
||||
if (checkNietSlecht($postID, $userID)) {
|
||||
return deleteNietSlecht($postID, $userID);
|
||||
} else {
|
||||
return addNietSlecht($postID, $userID);
|
||||
}
|
||||
}
|
||||
|
||||
function checkNietSlecht(int $postID, int $userID) {
|
||||
$stmt = $GLOBALS["db"]->prepare("
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
`niet_slecht`
|
||||
WHERE
|
||||
`userID` = :userID AND
|
||||
`postID` = :postID
|
||||
");
|
||||
$stmt->bindParam(":userID", $userID);
|
||||
$stmt->bindParam(":postID", $postID);
|
||||
$stmt->execute();
|
||||
return $stmt->rowCount();
|
||||
}
|
||||
|
||||
function addNietSlecht(int $postID, int $userID) {
|
||||
$stmt = $GLOBALS["db"]->prepare("
|
||||
INSERT INTO
|
||||
`niet_slecht` (`userID`, `postID`)
|
||||
VALUES (:userID, :postID)
|
||||
");
|
||||
$stmt->bindParam(":userID", $userID);
|
||||
$stmt->bindParam(":postID", $postID);
|
||||
$stmt->execute();
|
||||
return $stmt->rowCount();
|
||||
}
|
||||
|
||||
function deleteNietSlecht(int $postID, int $userID) {
|
||||
$stmt = $GLOBALS["db"]->prepare("
|
||||
DELETE FROM
|
||||
`niet_slecht`
|
||||
WHERE
|
||||
`userID` = :userID AND
|
||||
`postID` = :postID
|
||||
");
|
||||
$stmt->bindParam(":userID", $userID);
|
||||
$stmt->bindParam(":postID", $postID);
|
||||
$stmt->execute();
|
||||
return $stmt->rowCount();
|
||||
}
|
||||
@@ -1,8 +1,9 @@
|
||||
<?php
|
||||
|
||||
function getOldChatMessages($user2ID) {
|
||||
require_once ("friendship.php");
|
||||
$user1ID = $_SESSION["userID"];
|
||||
|
||||
if (getFriendshipStatus($user2ID) == 1) {
|
||||
$stmt = $GLOBALS["db"]->prepare("
|
||||
SELECT
|
||||
*
|
||||
@@ -23,9 +24,14 @@ function getOldChatMessages($user2ID) {
|
||||
$stmt->execute();
|
||||
|
||||
return json_encode($stmt->fetchAll());
|
||||
} else {
|
||||
return "[]";
|
||||
}
|
||||
}
|
||||
|
||||
function sendMessage($destination, $content) {
|
||||
require_once("friendship.php");
|
||||
if (getFriendshipStatus($destination) == 1) {
|
||||
$stmt = $GLOBALS["db"]->prepare("
|
||||
INSERT INTO
|
||||
`private_message`
|
||||
@@ -47,9 +53,14 @@ function sendMessage($destination, $content) {
|
||||
"destination" => $destination,
|
||||
"content" => $content
|
||||
));
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function getNewChatMessages($lastID, $destination) {
|
||||
require_once("friendship.php");
|
||||
if (getFriendshipStatus($destination) == 1) {
|
||||
$stmt = $GLOBALS["db"]->prepare("
|
||||
SELECT
|
||||
*
|
||||
@@ -73,19 +84,22 @@ function getNewChatMessages($lastID, $destination) {
|
||||
$stmt->execute();
|
||||
|
||||
return json_encode($stmt->fetchAll());
|
||||
} else {
|
||||
return "[]";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function selectAllUnreadChat() {
|
||||
$stmt = $GLOBALS["db"]->prepare("
|
||||
SELECT
|
||||
LEFT(CONCAT(`user`.`fname`, ' ', `user`.`lname`), 15) as `fullname`,
|
||||
LEFT(CONCAT(`user`.`fname`, ' ', `user`.`lname`), 15) AS `fullname`,
|
||||
`user`.`userID`,
|
||||
IFNULL(
|
||||
`profilepicture`,
|
||||
'../img/avatar-standard.png'
|
||||
) AS profilepicture,
|
||||
LEFT(`private_message`.`content`, 15) as `content`
|
||||
LEFT(`private_message`.`content`, 15) AS `content`
|
||||
FROM
|
||||
`private_message`,
|
||||
`friendship`,
|
||||
@@ -101,7 +115,8 @@ function selectAllUnreadChat() {
|
||||
`friendship`.chatLastVisted2 IS NULL)) AND
|
||||
`private_message`.`origin` = `user`.`userID` AND
|
||||
`private_message`.`destination` = :userID AND
|
||||
`user`.`role` != 'banned'
|
||||
`user`.`role` != 'banned' AND
|
||||
`friendship`.`status` = 'confirmed'
|
||||
|
||||
GROUP BY `user`.`userID`
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ function getExistingUsername() {
|
||||
`username` LIKE :username
|
||||
");
|
||||
|
||||
$stmt->bindParam(":username", $_POST["username"]);
|
||||
$stmt->bindValue(":username", test_input($_POST["username"]));
|
||||
$stmt->execute();
|
||||
return $stmt->rowCount();
|
||||
|
||||
@@ -26,7 +26,7 @@ function getExistingEmail() {
|
||||
`email` LIKE :email
|
||||
");
|
||||
|
||||
$stmt->bindParam(":email", $_POST["email"]);
|
||||
$stmt->bindValue(":email", test_input($_POST["email"]));
|
||||
$stmt->execute();
|
||||
return $stmt->rowCount();
|
||||
|
||||
@@ -42,7 +42,7 @@ function getResetEmail() {
|
||||
`email` LIKE :email
|
||||
");
|
||||
|
||||
$stmt->bindParam(":email", $_POST["forgotEmail"]);
|
||||
$stmt->bindValue(":email", test_input($_POST["forgotEmail"]));
|
||||
$stmt->execute();
|
||||
return $stmt->rowCount();
|
||||
|
||||
@@ -70,15 +70,21 @@ function registerAccount() {
|
||||
|
||||
$hash=password_hash($_POST["password"], PASSWORD_DEFAULT);
|
||||
|
||||
$stmt->bindParam(":fname", $_POST["name"]);
|
||||
$stmt->bindParam(":lname", $_POST["surname"]);
|
||||
$stmt->bindParam(":bday", $_POST["bday"]);
|
||||
$stmt->bindParam(":username", $_POST["username"]);
|
||||
$stmt->bindParam(":password", $hash);
|
||||
$stmt->bindParam(":location", $_POST["location"]);
|
||||
$stmt->bindParam(":email", (strtolower($_POST["email"])));
|
||||
$stmt->bindValue(":fname", test_input($_POST["name"]));
|
||||
$stmt->bindValue(":lname", test_input($_POST["surname"]));
|
||||
$stmt->bindValue(":bday", test_input($_POST["bday"]));
|
||||
$stmt->bindValue(":username", test_input($_POST["username"]));
|
||||
$stmt->bindValue(":password", test_input($hash));
|
||||
$stmt->bindValue(":location", test_input($_POST["location"]));
|
||||
$stmt->bindValue(":email", test_input(strtolower($_POST["email"])));
|
||||
|
||||
$stmt->execute();
|
||||
$stmt->rowCount();
|
||||
}
|
||||
|
||||
function submitselect($date, $value){
|
||||
if ($date == $value){
|
||||
echo "selected";
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -50,5 +50,5 @@ function setHashToDatabase(int $userID, string $hash) {
|
||||
$stmt->bindParam(":hash", $hash);
|
||||
$stmt->bindParam(":userID", $userID);
|
||||
$stmt->execute();
|
||||
return $stmt->rowCount();
|
||||
$stmt->rowCount();
|
||||
}
|
||||
@@ -1,6 +1,10 @@
|
||||
<?php
|
||||
include_once "../queries/emailconfirm.php";
|
||||
|
||||
/**
|
||||
* Class AlertMessage
|
||||
* abstract class for alertMessages used in
|
||||
*/
|
||||
abstract class AlertMessage extends Exception {
|
||||
public function __construct($message = "", $code = 0, Exception $previous = null)
|
||||
{
|
||||
@@ -10,6 +14,10 @@ abstract class AlertMessage extends Exception {
|
||||
abstract public function getClass();
|
||||
}
|
||||
|
||||
/**
|
||||
* Class HappyAlert
|
||||
* class for a happy alert as an exception.
|
||||
*/
|
||||
class HappyAlert extends AlertMessage {
|
||||
|
||||
public function __construct($message = "Gelukt!", $code = 0, Exception $previous = null)
|
||||
@@ -22,6 +30,10 @@ class HappyAlert extends AlertMessage {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Class AngryAlert
|
||||
* class for an angry alert as as exception.
|
||||
*/
|
||||
class AngryAlert extends AlertMessage {
|
||||
public function __construct($message = "Er is iets fout gegaan.", $code = 0, Exception $previous = null)
|
||||
{
|
||||
@@ -46,7 +58,9 @@ function getSettings() {
|
||||
`location`,
|
||||
`birthdate`,
|
||||
`bio`,
|
||||
`profilepicture`
|
||||
`profilepicture`,
|
||||
`showBday`,
|
||||
`showEmail`
|
||||
FROM
|
||||
`user`
|
||||
WHERE
|
||||
@@ -58,6 +72,10 @@ function getSettings() {
|
||||
return $stmt->fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the passwordHas form the database
|
||||
* @return mixed passwordhash
|
||||
*/
|
||||
function getPasswordHash() {
|
||||
$stmt = $GLOBALS["db"]->prepare("
|
||||
SELECT
|
||||
@@ -73,6 +91,10 @@ function getPasswordHash() {
|
||||
return $stmt->fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* Changes the setting from post.
|
||||
* @throws HappyAlert
|
||||
*/
|
||||
function updateSettings() {
|
||||
$stmt = $GLOBALS["db"]->prepare("
|
||||
UPDATE
|
||||
@@ -82,7 +104,9 @@ function updateSettings() {
|
||||
`lname` = :lname,
|
||||
`location` = :location,
|
||||
`birthdate` = :bday,
|
||||
`bio` = :bio
|
||||
`bio` = :bio,
|
||||
`showEmail` = :showEmail,
|
||||
`showBday` = :showBday
|
||||
WHERE
|
||||
`userID` = :userID
|
||||
");
|
||||
@@ -92,15 +116,22 @@ function updateSettings() {
|
||||
$stmt->bindValue(":location", test_input($_POST["location"]));
|
||||
$stmt->bindValue(":bday", test_input($_POST["bday"]));
|
||||
$stmt->bindValue(":bio", test_input($_POST["bio"]));
|
||||
$stmt->bindValue(":showEmail", test_input($_POST["showEmail"]));
|
||||
$stmt->bindValue(":showBday", test_input($_POST["showBday"]));
|
||||
|
||||
$stmt->bindValue(":userID", $_SESSION["userID"]);
|
||||
$stmt->execute();
|
||||
throw new HappyAlert("Instellingen zijn opgeslagen.");
|
||||
}
|
||||
|
||||
/**
|
||||
* Change
|
||||
* @throws AngryAlert
|
||||
*/
|
||||
function changePassword() {
|
||||
$user = getPasswordHash();
|
||||
if (password_verify($_POST["password-old"], $user["password"])) {
|
||||
if ($_POST["password-new"] == $_POST["password-confirm"] && (strlen($_POST["password-new"]) >= 8)) {
|
||||
if (password_verify($_POST["password-old"], test_input($user["password"]))) {
|
||||
if (test_input($_POST["password-new"]) == test_input($_POST["password-confirm"]) && (strlen(test_input($_POST["password-new"])) >= 8)) {
|
||||
doChangePassword();
|
||||
} else {
|
||||
throw new AngryAlert("Wachtwoorden komen niet overeen.");
|
||||
@@ -110,6 +141,10 @@ function changePassword() {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws AngryAlert
|
||||
* @throws HappyAlert
|
||||
*/
|
||||
function doChangePassword() {
|
||||
$stmt = $GLOBALS["db"]->prepare("
|
||||
UPDATE
|
||||
@@ -134,8 +169,8 @@ function doChangePassword() {
|
||||
|
||||
function changeEmail() {
|
||||
|
||||
if ($_POST["email"] == $_POST["email-confirm"]) {
|
||||
$email = strtolower($_POST["email"]);
|
||||
if (test_input($_POST["email"]) == test_input($_POST["email-confirm"])) {
|
||||
$email = strtolower(test_input($_POST["email"]));
|
||||
if (filter_var($email, FILTER_VALIDATE_EMAIL)) {
|
||||
//check if email exists
|
||||
emailIsAvailableInDatabase($email);
|
||||
@@ -193,7 +228,6 @@ function updateAvatar() {
|
||||
$tmpImg = $_FILES["pp"]["tmp_name"];
|
||||
|
||||
checkAvatarSize($tmpImg);
|
||||
removeOldAvatar();
|
||||
if (getimagesize($tmpImg)["mime"] == "image/gif") {
|
||||
if ($_FILES["pp"]["size"] > 4000000) {
|
||||
throw new AngryAlert("Bestand is te groot, maximaal 4MB toegestaan.");
|
||||
@@ -205,6 +239,7 @@ function updateAvatar() {
|
||||
$scaledImg = scaleAvatar($tmpImg);
|
||||
imagepng($scaledImg, $profilePictureDir . $relativePath);
|
||||
}
|
||||
removeOldAvatar();
|
||||
setAvatarToDatabase("../" . $relativePath);
|
||||
throw new HappyAlert("Profielfoto veranderd.");
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@ function getUsername($userID) {
|
||||
function selectUser($me, $other) {
|
||||
$stmt = $GLOBALS["db"]->prepare("
|
||||
SELECT
|
||||
`userID`,
|
||||
`username`,
|
||||
`birthdate`,
|
||||
`location`,
|
||||
@@ -94,7 +95,7 @@ function selectAllUserGroups($userID) {
|
||||
`group_page`.`groupID` = `group_member`.`groupID`
|
||||
WHERE
|
||||
`userID` = :userID AND
|
||||
`role` = 1
|
||||
`role` = 'member'
|
||||
");
|
||||
|
||||
$stmt->bindParam(':userID', $userID, PDO::PARAM_INT);
|
||||
@@ -343,9 +344,10 @@ function searchSomeUsers($n, $m, $search) {
|
||||
FROM
|
||||
`user`
|
||||
WHERE
|
||||
`username` LIKE :keyword OR
|
||||
(`username` LIKE :keyword OR
|
||||
`fname` LIKE :keyword OR
|
||||
`lname` LIKE :keyword
|
||||
`lname` LIKE :keyword) AND
|
||||
`role` != 'banned'
|
||||
ORDER BY
|
||||
`fname`,
|
||||
`lname`,
|
||||
|
||||
37
website/views/bdayInput.php
Normal file
37
website/views/bdayInput.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<select name="day_date" >
|
||||
<option>dag</option>
|
||||
<?php
|
||||
for($i=1; $i<32; $i++) {
|
||||
$i = sprintf("%02d", $i);
|
||||
?>
|
||||
<option value="<?= $i ?>" <?php submitselect($day_date, $i)?>><?= $i ?></option>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<select name="month_date">
|
||||
<option>Maand</option>
|
||||
<option value="01" <?php submitselect($month_date, "01")?>>januari</option>
|
||||
<option value="02" <?php submitselect($month_date, "02")?>>februari</option>
|
||||
<option value="03" <?php submitselect($month_date, "03")?>>maart</option>
|
||||
<option value="04" <?php submitselect($month_date, "04")?>>april</option>
|
||||
<option value="05" <?php submitselect($month_date, "05")?>>mei</option>
|
||||
<option value="06" <?php submitselect($month_date, "06")?>>juni</option>
|
||||
<option value="07" <?php submitselect($month_date, "07")?>>juli</option>
|
||||
<option value="08" <?php submitselect($month_date, "08")?>>augustus</option>
|
||||
<option value="09" <?php submitselect($month_date, "09")?>>september</option>
|
||||
<option value="10" <?php submitselect($month_date, "10")?>>oktober</option>
|
||||
<option value="11" <?php submitselect($month_date, "11")?>>november</option>
|
||||
<option value="12" <?php submitselect($month_date, "12")?>>december</option>
|
||||
</select>
|
||||
<select name="year_date">
|
||||
<option>Jaar</option>
|
||||
<?php
|
||||
$year = (new DateTime)->format("Y");
|
||||
for($i=$year; $i > $year - 100; $i--) {
|
||||
?>
|
||||
<option value="<?= $i ?>" <?php submitselect($year_date, $i)?>><?= $i ?></option>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
@@ -74,6 +74,7 @@
|
||||
name="content"
|
||||
id="newContent"
|
||||
placeholder="Schrijf een bericht..."
|
||||
autocomplete="off"
|
||||
autofocus
|
||||
required
|
||||
/>
|
||||
|
||||
36
website/views/forgotPasswordModal.php
Normal file
36
website/views/forgotPasswordModal.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<!-- Trigger/Open The Modal -->
|
||||
<button id="myBtn" class="button">Wachtwoord vergeten</button>
|
||||
|
||||
<!-- The Modal -->
|
||||
<div id="myModal" class="modal">
|
||||
<form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>"
|
||||
return= $correct
|
||||
method="post"
|
||||
name="forgotPassword">
|
||||
|
||||
<!-- Modal content -->
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<span class="close">×</span>
|
||||
<h3>Voer uw emailadres in</h3>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<input type="text"
|
||||
class="middle"
|
||||
placeholder="Voer uw email in"
|
||||
name="forgotEmail"
|
||||
title="Voer een email in">
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<div class="login_containerfault"><span><?php echo $resetErr; ?></span></div>
|
||||
<button type="submit"
|
||||
value="reset"
|
||||
name="submit"
|
||||
id="frm1_submit">
|
||||
Reset password
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
@@ -13,12 +13,13 @@
|
||||
|
||||
<!-- Login name -->
|
||||
<div class="login_containerlogin">
|
||||
<label><b>Gebruikersnaam</b></label>
|
||||
<label><b>Gebruikersnaam/Email</b></label>
|
||||
<input type="text"
|
||||
placeholder="Voer uw gebruikersnaam in"
|
||||
name="uname"
|
||||
value="<?php echo $uname ?>"
|
||||
title="Moet 6 of meer karakters bevatten"
|
||||
class="middle"
|
||||
placeholder="Voer uw gebruikersnaam/email in"
|
||||
name="user"
|
||||
value="<?php echo $user ?>"
|
||||
title="Moet een geldige gebruiker zijn"
|
||||
>
|
||||
</div>
|
||||
|
||||
@@ -26,6 +27,7 @@
|
||||
<div class="login_containerlogin">
|
||||
<label><b>Wachtwoord</b></label>
|
||||
<input type="password"
|
||||
class="middle"
|
||||
placeholder="Voer uw wachtwoord in"
|
||||
name="psw"
|
||||
title="Moet minstens 8 karakters lang zijn"
|
||||
@@ -44,73 +46,65 @@
|
||||
Inloggen
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="login_containerlogin">
|
||||
<label><b>Onthoud mij</b></label>
|
||||
<input type="checkbox" name="rememberMe" value=1><br>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<!-- Button for going to the register screen -->
|
||||
<div class="login_containerlogin">
|
||||
<a href="https://myhyvesbookplus.nl/register" class="button">Registreer een account</a>
|
||||
<!-- Button for going to the register screen -->
|
||||
<div class="login_containerlogin">
|
||||
<!-- <a href="https://myhyvesbookplus.nl/register" class="button">Registreer een account</a>-->
|
||||
|
||||
<!-- Trigger/Open The Modal -->
|
||||
<button id="myBtn" class="button">Wachtwoord vergeten</button>
|
||||
<?php
|
||||
include("../views/forgotPasswordModal.php");
|
||||
include("../views/registerModal.php");
|
||||
?>
|
||||
|
||||
<!-- The Modal -->
|
||||
<div id="myModal" class="modal">
|
||||
<form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>"
|
||||
return= $correct
|
||||
method="post"
|
||||
name="forgotPassword">
|
||||
</div>
|
||||
|
||||
<!-- Modal content -->
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<span class="close">×</span>
|
||||
<h3>Voer uw emailadres in</h3>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<input type="text"
|
||||
placeholder="Voer uw email in"
|
||||
name="forgotEmail"
|
||||
title="Voer een email in">
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<div class="login_containerfault"><span><?php echo $resetErr; ?></span></div>
|
||||
<button type="submit"
|
||||
value="reset"
|
||||
name="submit"
|
||||
id="frm1_submit">
|
||||
Reset password
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
// Get the modal
|
||||
var modal = document.getElementById('myModal');
|
||||
// Get the button that opens the modal
|
||||
var modal = document.getElementById('myModal');
|
||||
var btn = document.getElementById("myBtn");
|
||||
|
||||
// Get the button that opens the modal
|
||||
var btn = document.getElementById("myBtn");
|
||||
// Get the modal
|
||||
var registerModal = document.getElementById('registerModal');
|
||||
var registerBtn = document.getElementById("registerBtn");
|
||||
|
||||
// Get the <span> element that closes the modal
|
||||
var span = document.getElementsByClassName("close")[0];
|
||||
// Get the <span> element that closes the modal
|
||||
var span = document.getElementsByClassName("close")[0];
|
||||
var registerSpan = document.getElementsByClassName("close")[1];
|
||||
|
||||
// When the user clicks the button, open the modal
|
||||
btn.onclick = function() {
|
||||
// When the user clicks the button, open the modal
|
||||
btn.onclick = function () {
|
||||
// modal.style.display = "block";
|
||||
modal.style.display = "block";
|
||||
window.onload=emailSent();
|
||||
|
||||
}
|
||||
|
||||
// When the user clicks on <span> (x), close the modal
|
||||
span.onclick = function() {
|
||||
registerBtn.onclick = function () {
|
||||
registerModal.style.display = "block";
|
||||
}
|
||||
|
||||
// When the user clicks on <span> (x), close the modal
|
||||
span.onclick = function () {
|
||||
modal.style.display = "none";
|
||||
}
|
||||
registerSpan.onclick = function () {
|
||||
registerModal.style.display = "none";
|
||||
}
|
||||
|
||||
// When the user clicks anywhere outside of the modal, close it
|
||||
window.onclick = function(event) {
|
||||
// When the user clicks anywhere outside of the modal, close it
|
||||
window.onclick = function (event) {
|
||||
if (event.target == modal) {
|
||||
modal.style.display = "none";
|
||||
}
|
||||
if (event.target == registerModal) {
|
||||
registerModal.style.display = "none";
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -2,6 +2,7 @@
|
||||
$postID = $_GET['postID'];
|
||||
$post = selectPostById($postID)->fetch(PDO::FETCH_ASSOC);
|
||||
$fullname = $post['fname'] . " " . $post['lname'] . " (" . $post['username'] . ")";
|
||||
session_start();
|
||||
|
||||
echo("
|
||||
<div class='post-header header'>
|
||||
@@ -21,10 +22,20 @@ echo("
|
||||
|
||||
<div class='post-comments'>
|
||||
<div class="commentfield">
|
||||
<form id="newcommentform" action="javascript:postComment();">
|
||||
<form id="newcommentform" onsubmit="return false;">
|
||||
<input type="hidden" id="newcomment-textarea" name="postID" value="<?= $postID ?>">
|
||||
<textarea id="newcomment" name="newcomment-content" placeholder="Laat een reactie achter..."></textarea> <br>
|
||||
<input type="submit" value="Reageer!">
|
||||
<button onclick="postComment('reaction')" name="button" value="reaction">Reageer!</button>
|
||||
<!-- TODO: if/else op "niet slecht." button voor like/unlike-->
|
||||
<button onclick="postComment('nietslecht')" name="button" value="nietslecht">
|
||||
<?php
|
||||
if (checkNietSlecht($postID, $_SESSION["userID"])) {
|
||||
echo 'Trek <span class="nietslecht">"Niet slecht."</span> terug';
|
||||
} else {
|
||||
echo 'Vind ik <span class="nietslecht">"Niet slecht."</span>';
|
||||
}
|
||||
?>
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -1,7 +1,13 @@
|
||||
<div class="content">
|
||||
<div class="profile-box platform">
|
||||
<img class="left profile-picture" src="<?php echo $user["profilepicture"] ?>">
|
||||
|
||||
<form id="start-profile-chat-form" class="right" action="chat.php" method="get">
|
||||
<button name="username"
|
||||
class="friend-button green"
|
||||
value="<?php echo $user["userID"] ?>">
|
||||
<i class="fa fa-comment-o"></i> Chat
|
||||
</button>
|
||||
</form>
|
||||
<div class="friend-button-container">
|
||||
|
||||
</div>
|
||||
|
||||
@@ -40,14 +40,44 @@
|
||||
|
||||
<!-- Register birthday -->
|
||||
<div class="login_containerregister">
|
||||
<label><b>Geboortedatum</b></label>
|
||||
<input type="text"
|
||||
name="bday"
|
||||
value="<?php echo $bday ?>"
|
||||
id="bday"
|
||||
placeholder="1996/01/01"
|
||||
data-fv-date-max=""
|
||||
>
|
||||
<label><b>Geboortedatum(Dag/Maand/Jaar)</b></label>
|
||||
<select name="day_date" >
|
||||
<option>dag</option>
|
||||
<?php
|
||||
for($i=1; $i<32; $i++) {
|
||||
$i = sprintf("%02d", $i);
|
||||
?>
|
||||
<option value="<?= $i ?>" <?php submitselect($day_date, $i)?>><?= $i ?></option>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<select name="month_date">
|
||||
<option>Maand</option>
|
||||
<option value="01" <?php submitselect($month_date, "01")?>>Januari</option>
|
||||
<option value="02" <?php submitselect($month_date, "02")?>>Februari</option>
|
||||
<option value="03" <?php submitselect($month_date, "03")?>>Maart</option>
|
||||
<option value="04" <?php submitselect($month_date, "04")?>>April</option>
|
||||
<option value="05" <?php submitselect($month_date, "05")?>>Mei</option>
|
||||
<option value="06" <?php submitselect($month_date, "06")?>>Juni</option>
|
||||
<option value="07" <?php submitselect($month_date, "07")?>>Juli</option>
|
||||
<option value="08" <?php submitselect($month_date, "08")?>>Augustus</option>
|
||||
<option value="09" <?php submitselect($month_date, "09")?>>September</option>
|
||||
<option value="10" <?php submitselect($month_date, "10")?>>Oktober</option>
|
||||
<option value="11" <?php submitselect($month_date, "11")?>>November</option>
|
||||
<option value="12" <?php submitselect($month_date, "12")?>>December</option>
|
||||
</select>
|
||||
<select name="year_date">
|
||||
<option>Jaar</option>
|
||||
<?php
|
||||
$year = (new DateTime)->format("Y");
|
||||
for($i=$year; $i > $year - 100; $i--) {
|
||||
?>
|
||||
<option value="<?= $i ?>" <?php submitselect($year_date, $i)?>><?= $i ?></option>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
*<span class="error"> <?php echo $bdayErr;?></span>
|
||||
</div>
|
||||
|
||||
@@ -118,6 +148,18 @@
|
||||
*<span class="error"> <?php echo $emailErr;?></span>
|
||||
</div>
|
||||
|
||||
<!-- Register email -->
|
||||
<div class="login_containerregister">
|
||||
<label><b>Herhaal email</b></label>
|
||||
<input type="text"
|
||||
placeholder="Herhaal uw email"
|
||||
name="confirmEmail"
|
||||
value="<?php echo $confirmEmail ?>"
|
||||
id="email"
|
||||
title="Herhaal uw email">
|
||||
*<span class="error"> <?php echo $confirmEmailErr;?></span>
|
||||
</div>
|
||||
|
||||
<div class="login_containerregister">
|
||||
<div class="g-recaptcha" data-sitekey="6Lc72xIUAAAAADumlWetgENm7NGd9Npyo0c_tYYQ"></div>
|
||||
<span class="error"> <?php echo $captchaErr;?></span>
|
||||
|
||||
158
website/views/registerModal.php
Normal file
158
website/views/registerModal.php
Normal file
@@ -0,0 +1,158 @@
|
||||
<!-- Trigger/Open The Modal -->
|
||||
<button id="registerBtn" class="button">Registreer een account</button>
|
||||
|
||||
<!-- The Modal -->
|
||||
<div id="registerModal" class="modal">
|
||||
<form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>"
|
||||
return= $correct
|
||||
method="post"
|
||||
name="forgotPassword">
|
||||
|
||||
<!-- Modal content -->
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<span class="close">×</span>
|
||||
<h3>Registreer uw account</h3>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>"
|
||||
return= $correct
|
||||
method="post">
|
||||
|
||||
<div class="login_containerregister"><label>U krijgt een bevestigingsemail na het registreren</label></div>
|
||||
|
||||
<!-- Error message -->
|
||||
<div class="login_containerfault"><?php echo $genericErr;?></span></div>
|
||||
|
||||
<!-- Register name -->
|
||||
<div class="login_containerregister">
|
||||
<label><b>Naam</b></label>
|
||||
<input type="text"
|
||||
placeholder="Voer uw naam in"
|
||||
name="name"
|
||||
value="<?php echo $name ?>"
|
||||
title="Mag alleen letters bevatten"
|
||||
>
|
||||
*<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>
|
||||
<?php
|
||||
include("../views/bdayInput.php");
|
||||
?>
|
||||
*<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>Locatie</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>
|
||||
|
||||
<!-- Register email -->
|
||||
<div class="login_containerregister">
|
||||
<label><b>Herhaal email</b></label>
|
||||
<input type="text"
|
||||
placeholder="Herhaal uw email"
|
||||
name="confirmEmail"
|
||||
value="<?php echo $confirmEmail ?>"
|
||||
id="email"
|
||||
title="Herhaal uw email">
|
||||
*<span class="error"> <?php echo $confirmEmailErr;?></span>
|
||||
</div>
|
||||
|
||||
<div class="login_containerregister">
|
||||
<div class="g-recaptcha" data-sitekey="6Lc72xIUAAAAADumlWetgENm7NGd9Npyo0c_tYYQ">
|
||||
</div>
|
||||
<span class="error"> <?php echo $captchaErr;?></span>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<div class="login_containerfault"><span><?php echo $resetErr; ?></span></div>
|
||||
<button type="submit"
|
||||
value="register"
|
||||
name="submit"
|
||||
id="frm1_submit">
|
||||
Registreer
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
@@ -51,6 +51,32 @@ $settings = getSettings();
|
||||
value="<?= $settings["birthdate"]?>"
|
||||
>
|
||||
</li>
|
||||
<li>
|
||||
<label for="showBday">Toon leeftijd</label>
|
||||
<input type="radio"
|
||||
name="showBday"
|
||||
value="1"
|
||||
<?php echo ($settings["showBday"] ? "checked" : "")?>
|
||||
> Ja
|
||||
<input type="radio"
|
||||
name="showBday"
|
||||
value="0"
|
||||
<?php echo ($settings["showBday"] ? "" : "checked")?>
|
||||
> Nee
|
||||
</li>
|
||||
<li>
|
||||
<label for="showEmail">Toon Email</label>
|
||||
<input type="radio"
|
||||
name="showEmail"
|
||||
value="1"
|
||||
<?php echo ($settings["showEmail"] ? "checked" : "")?>
|
||||
> Ja
|
||||
<input type="radio"
|
||||
name="showEmail"
|
||||
value="0"
|
||||
<?php echo ($settings["showEmail"] ? "" : "checked")?>
|
||||
> Nee
|
||||
</li>
|
||||
<li>
|
||||
<label for="bio">Bio</label>
|
||||
<textarea name="bio"
|
||||
|
||||
Reference in New Issue
Block a user