Marijn button #99
2
.gitignore
vendored
2
.gitignore
vendored
@@ -8,7 +8,7 @@
|
|||||||
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
|
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
|
||||||
|
|
||||||
|
|
||||||
|
.idea/*
|
||||||
# User-specific stuff:
|
# User-specific stuff:
|
||||||
.idea/workspace.xml
|
.idea/workspace.xml
|
||||||
.idea/tasks.xml
|
.idea/tasks.xml
|
||||||
|
|||||||
14
website/.htaccess
Normal file
14
website/.htaccess
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
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 ^([^/.]+)\/$ $1.php [L]
|
||||||
|
|
||||||
|
RewriteRule ^profile/([A-z0-9]+)\/?$ profile.php?username=$1 [NC]
|
||||||
13
website/public/API/loadMessages.php
Normal file
13
website/public/API/loadMessages.php
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
session_start();
|
||||||
|
require_once("../../queries/connect.php");
|
||||||
|
require_once("../../queries/private_message.php");
|
||||||
|
|
||||||
|
if (isset($_POST["lastID"]) && $_POST["lastID"] != "") {
|
||||||
|
|
||||||
|
echo getNewChatMessages($_POST["lastID"], $_POST["destination"]);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
echo getOldChatMessages($_POST["destination"]);
|
||||||
|
}
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
include_once("../queries/private_message.php");
|
session_start();
|
||||||
|
require_once("../../queries/connect.php");
|
||||||
|
require_once("../../queries/private_message.php");
|
||||||
|
|
||||||
if (isset($_POST["destination"]) &&
|
if (isset($_POST["destination"]) &&
|
||||||
isset($_POST["content"])) {
|
isset($_POST["content"])) {
|
||||||
BIN
website/public/img/error404.jpg
Normal file
BIN
website/public/img/error404.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 33 KiB |
@@ -1,10 +1,12 @@
|
|||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
loadMessages();
|
loadMessages();
|
||||||
|
sayEmpty();
|
||||||
|
$(".chat-field").hide();
|
||||||
});
|
});
|
||||||
|
|
||||||
function loadMessages() {
|
function loadMessages() {
|
||||||
$.post(
|
$.post(
|
||||||
"loadMessages.php",
|
"API/loadMessages.php",
|
||||||
$("#lastIDForm").serialize()
|
$("#lastIDForm").serialize()
|
||||||
).done(function(data) {
|
).done(function(data) {
|
||||||
if (data && data != "[]") {
|
if (data && data != "[]") {
|
||||||
@@ -23,7 +25,7 @@ function loadMessages() {
|
|||||||
function sendMessage() {
|
function sendMessage() {
|
||||||
console.log($("#sendMessageForm").serialize());
|
console.log($("#sendMessageForm").serialize());
|
||||||
$.post(
|
$.post(
|
||||||
"sendMessage.php",
|
"API/sendMessage.php",
|
||||||
$("#sendMessageForm").serialize()
|
$("#sendMessageForm").serialize()
|
||||||
).done(function( data ) {
|
).done(function( data ) {
|
||||||
console.log(data);
|
console.log(data);
|
||||||
@@ -51,7 +53,14 @@ function addMessages(messages) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function switchUser(userID) {
|
function switchUser(userID) {
|
||||||
|
$(".chat-field").show();
|
||||||
$(".destinationID").val(userID);
|
$(".destinationID").val(userID);
|
||||||
$("#chat-history").html("");
|
$("#chat-history").html("");
|
||||||
$("#lastID").val("");
|
$("#lastID").val("");
|
||||||
|
$(".chat-left .friend-item").removeClass("active-friend-chat");
|
||||||
|
$(".chat-left #friend-item-" + userID).addClass("active-friend-chat");
|
||||||
|
}
|
||||||
|
|
||||||
|
function sayEmpty() {
|
||||||
|
$("#chat-history").html("Begin nu met chatten!");
|
||||||
}
|
}
|
||||||
@@ -1,3 +1,60 @@
|
|||||||
|
<?php
|
||||||
|
include("../queries/user.php");
|
||||||
|
include("../queries/friendship.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";
|
||||||
|
}
|
||||||
|
|
||||||
|
if(empty($_GET["username"])) {
|
||||||
|
echo "User does not exist!";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$userID = getUserID($_GET["username"]);
|
||||||
|
|
||||||
|
$user = selectUser($userID);
|
||||||
|
$profile_friends = selectAllFriends($userID);
|
||||||
|
$profile_groups = selectAllUserGroups($userID);
|
||||||
|
$posts = selectAllUserPosts($userID);
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
include("../views/main.php");
|
include("../views/main.php");
|
||||||
|
$notImplemented = new settingsMessage("angry", "Deze functie werkt nog niet :(");
|
||||||
|
|
||||||
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||||
switch ($_POST["form"]) {
|
switch ($_POST["form"]) {
|
||||||
@@ -24,16 +25,10 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
|||||||
$result = updatePassword();
|
$result = updatePassword();
|
||||||
break;
|
break;
|
||||||
case "email":
|
case "email":
|
||||||
$result = array (
|
$result = changeEmail();
|
||||||
"type" => "settings-message-angry",
|
|
||||||
"message" => "Deze functie werkt nog niet :("
|
|
||||||
);
|
|
||||||
break;
|
break;
|
||||||
case "picture":
|
case "picture":
|
||||||
$result = array (
|
$result = $notImplemented;
|
||||||
"type" => "settings-message-angry",
|
|
||||||
"message" => "Deze functie werkt nog niet :("
|
|
||||||
);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -89,3 +89,8 @@
|
|||||||
border-radius: 0 10px 10px 0;
|
border-radius: 0 10px 10px 0;
|
||||||
box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
|
box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.active-friend-chat {
|
||||||
|
background: aquamarine;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
@@ -30,9 +30,14 @@
|
|||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.friend-item:hover {
|
||||||
|
background: #845663;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
.menu button {
|
.menu button {
|
||||||
background: none;
|
background: none;
|
||||||
color: #333;
|
color: inherit;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
include_once("../queries/connect.php");
|
include_once("../queries/connect.php");
|
||||||
include_once("../queries/friendship.php");
|
include_once("../queries/friendship.php");
|
||||||
|
|
||||||
$friends = selectAllFriends($db, 666);
|
$friends = selectAllFriends(666);
|
||||||
while($friend = $friends->fetch(PDO::FETCH_ASSOC)) {
|
while($friend = $friends->fetch(PDO::FETCH_ASSOC)) {
|
||||||
echo $friend['username'].' '.$friend['onlinestatus'] . "<br />";
|
echo $friend['username'].' '.$friend['onlinestatus'] . "<br />";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,26 +1,31 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
function selectAllFriends($db, $userID) {
|
function selectAllFriends($userID) {
|
||||||
return $db->query("
|
$stmt = $GLOBALS["db"]->prepare("
|
||||||
SELECT
|
SELECT
|
||||||
`user`.`userID`,
|
`userID`,
|
||||||
`user`.`username`,
|
`username`,
|
||||||
`user`.`profilepicture`,
|
IFNULL(
|
||||||
`user`.`onlinestatus`,
|
`profilepicture`,
|
||||||
`user`.`role`
|
'../img/notbad.jpg'
|
||||||
FROM
|
) AS profilepicture,
|
||||||
`user`
|
`onlinestatus`,
|
||||||
INNER JOIN
|
`role`
|
||||||
`friendship`
|
FROM
|
||||||
WHERE
|
`user`
|
||||||
`friendship`.`user1ID` = $userID AND
|
INNER JOIN
|
||||||
`friendship`.`user2ID` = `user`.`userID` OR
|
`friendship`
|
||||||
`friendship`.`user2ID` = $userID AND
|
WHERE
|
||||||
`friendship`.`user1ID` = `user`.`userID` AND
|
(`friendship`.`user1ID` = :userID AND
|
||||||
`user`.`role` != 3
|
`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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
?>
|
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
function selectAllGroupsFromUser($db, $userID) {
|
function selectAllGroupsFromUser($userID) {
|
||||||
return $db->query("
|
return $GLOBALS["db"]->query("
|
||||||
SELECT
|
SELECT
|
||||||
`group_page`.`name`,
|
`group_page`.`name`,
|
||||||
`group_page`.`picture`
|
`group_page`.`picture`
|
||||||
@@ -15,7 +15,3 @@ function selectAllGroupsFromUser($db, $userID) {
|
|||||||
`group_page`.`status` != 0
|
`group_page`.`status` != 0
|
||||||
");
|
");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
?>
|
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
function selectGroupById($db, $groupID) {
|
function selectGroupById($groupID) {
|
||||||
return $db->query("
|
return $GLOBALS["db"]->query("
|
||||||
SELECT
|
SELECT
|
||||||
`group_page`.`name`,
|
`group_page`.`name`,
|
||||||
`group_page`.`picture`,
|
`group_page`.`picture`,
|
||||||
@@ -15,8 +15,8 @@ function selectGroupById($db, $groupID) {
|
|||||||
");
|
");
|
||||||
}
|
}
|
||||||
|
|
||||||
function select20GroupsFromN($db, $n) {
|
function select20GroupsFromN($n) {
|
||||||
return $db->query("
|
return $GLOBALS["db"]->query("
|
||||||
SELECT
|
SELECT
|
||||||
`group_page`.`groupID`,
|
`group_page`.`groupID`,
|
||||||
`group_page`.`name`,
|
`group_page`.`name`,
|
||||||
@@ -33,8 +33,8 @@ function select20GroupsFromN($db, $n) {
|
|||||||
");
|
");
|
||||||
}
|
}
|
||||||
|
|
||||||
function select20GroupsByStatusFromN($db, $n, $status) {
|
function select20GroupsByStatusFromN($n, $status) {
|
||||||
return $db->query("
|
return $GLOBALS["db"]->query("
|
||||||
SELECT
|
SELECT
|
||||||
`group_page`.`groupID`,
|
`group_page`.`groupID`,
|
||||||
`group_page`.`name`,
|
`group_page`.`name`,
|
||||||
@@ -53,8 +53,8 @@ function select20GroupsByStatusFromN($db, $n, $status) {
|
|||||||
");
|
");
|
||||||
}
|
}
|
||||||
|
|
||||||
function search20GroupsFromNByStatus($db, $n, $keyword, $status) {
|
function search20GroupsFromNByStatus($n, $keyword, $status) {
|
||||||
$q = $db->prepare("
|
$q = $GLOBALS["db"]->prepare("
|
||||||
SELECT
|
SELECT
|
||||||
`groupID`,
|
`groupID`,
|
||||||
`name`,
|
`name`,
|
||||||
@@ -80,8 +80,8 @@ function search20GroupsFromNByStatus($db, $n, $keyword, $status) {
|
|||||||
return $q;
|
return $q;
|
||||||
}
|
}
|
||||||
|
|
||||||
function changeGroupStatusByID($db, $id, $status) {
|
function changeGroupStatusByID($id, $status) {
|
||||||
$q = $db->query("
|
$q = $GLOBALS["db"]->query("
|
||||||
UPDATE
|
UPDATE
|
||||||
`group_page`
|
`group_page`
|
||||||
SET
|
SET
|
||||||
@@ -92,8 +92,3 @@ function changeGroupStatusByID($db, $id, $status) {
|
|||||||
|
|
||||||
return $q;
|
return $q;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
|||||||
21
website/queries/header.php
Normal file
21
website/queries/header.php
Normal 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();
|
||||||
|
}
|
||||||
@@ -15,5 +15,3 @@ function getUser() {
|
|||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
return $stmt->fetch(PDO::FETCH_ASSOC);
|
return $stmt->fetch(PDO::FETCH_ASSOC);
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
|
||||||
|
|||||||
@@ -1,14 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
include_once("connect.php");
|
|
||||||
|
|
||||||
session_start();
|
|
||||||
|
|
||||||
function getOldChatMessages($user2ID) {
|
function getOldChatMessages($user2ID) {
|
||||||
$db = $GLOBALS["db"];
|
|
||||||
$user1ID = $_SESSION["userID"];
|
$user1ID = $_SESSION["userID"];
|
||||||
|
|
||||||
$stmt = $db->prepare("
|
$stmt = $GLOBALS["db"]->prepare("
|
||||||
SELECT
|
SELECT
|
||||||
*
|
*
|
||||||
FROM
|
FROM
|
||||||
@@ -31,8 +26,7 @@ function getOldChatMessages($user2ID) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function sendMessage($destination, $content) {
|
function sendMessage($destination, $content) {
|
||||||
$db = $GLOBALS["db"];
|
$stmt = $GLOBALS["db"]->prepare("
|
||||||
$stmt = $db->prepare("
|
|
||||||
INSERT INTO
|
INSERT INTO
|
||||||
`private_message`
|
`private_message`
|
||||||
(
|
(
|
||||||
@@ -56,10 +50,7 @@ function sendMessage($destination, $content) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getNewChatMessages($lastID, $destination) {
|
function getNewChatMessages($lastID, $destination) {
|
||||||
$db = $GLOBALS["db"];
|
$stmt = $GLOBALS["db"]->prepare("
|
||||||
$origin = $_SESSION["userID"];
|
|
||||||
|
|
||||||
$stmt = $db->prepare("
|
|
||||||
SELECT
|
SELECT
|
||||||
*
|
*
|
||||||
FROM
|
FROM
|
||||||
@@ -75,7 +66,7 @@ function getNewChatMessages($lastID, $destination) {
|
|||||||
`messageID` ASC
|
`messageID` ASC
|
||||||
");
|
");
|
||||||
|
|
||||||
$stmt->bindParam(':user1', $origin);
|
$stmt->bindParam(':user1', $_SESSION["userID"]);
|
||||||
$stmt->bindParam(':user2', $destination);
|
$stmt->bindParam(':user2', $destination);
|
||||||
$stmt->bindParam(':lastID', $lastID);
|
$stmt->bindParam(':lastID', $lastID);
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,42 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
class settingsMessage {
|
||||||
|
private $class;
|
||||||
|
private $message;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* settingsMessage constructor.
|
||||||
|
* @param string $type Happy or angry
|
||||||
|
* @param string $message The message to display
|
||||||
|
*/
|
||||||
|
public function __construct($type, $message) {
|
||||||
|
$this->message = $message;
|
||||||
|
switch ($type) {
|
||||||
|
case "happy":
|
||||||
|
$this->class = "settings-message-happy";
|
||||||
|
break;
|
||||||
|
case "angry":
|
||||||
|
$this->class = "settings-message-angry";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$this->class = "settings-message";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getClass() {
|
||||||
|
return $this->class;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getMessage() {
|
||||||
|
return $this->message;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the settings form the database.
|
||||||
|
* @return mixed Setting as an array.
|
||||||
|
*/
|
||||||
function getSettings() {
|
function getSettings() {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = $GLOBALS["db"]->prepare("
|
||||||
SELECT
|
SELECT
|
||||||
@@ -59,40 +96,28 @@ function updateSettings() {
|
|||||||
|
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
|
|
||||||
return array (
|
return new settingsMessage("happy", "Instellingen zijn opgeslagen.");
|
||||||
"type" => "settings-message-happy",
|
|
||||||
"message" => "Instellingen zijn opgeslagen."
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function updatePassword() {
|
function updatePassword() {
|
||||||
$user = getPasswordHash();
|
$user = getPasswordHash();
|
||||||
if (password_verify($_POST["password-old"].strtolower($user["username"]), $user["password"])) {
|
if (password_verify($_POST["password-old"], $user["password"])) {
|
||||||
if ($_POST["password-new"] == $_POST["password-confirm"] && (strlen($_POST["password-new"]) >= 8)) {
|
if ($_POST["password-new"] == $_POST["password-confirm"] && (strlen($_POST["password-new"]) >= 8)) {
|
||||||
if (changePassword($user)) {
|
if (changePassword()) {
|
||||||
return array ("type" => "settings-message-happy",
|
return new settingsMessage("happy", "Wachtwoord gewijzigd.");
|
||||||
"message" => "Wachtwoord gewijzigd.");
|
|
||||||
} else {
|
} else {
|
||||||
return array (
|
return new settingsMessage("angry", "Er is iets mis gegaan.");
|
||||||
"type" => "settings-message-angry",
|
|
||||||
"message" => "Er is iets mis gegaan.");
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return array (
|
return new settingsMessage("angry", "Wachtwoorden komen niet oveen.");
|
||||||
"type" => "settings-message-angry",
|
|
||||||
"message" => "Wachtwoorden komen niet oveeen."
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return array(
|
return new settingsMessage("angry", "Oud wachtwoord niet correct.");
|
||||||
"type" => "settings-message-angry",
|
|
||||||
"message" => "Oud wachtwoord niet correct."
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function changePassword($user) {
|
function changePassword() {
|
||||||
$stmt =$GLOBALS["db"]->prepare("
|
$stmt = $GLOBALS["db"]->prepare("
|
||||||
UPDATE
|
UPDATE
|
||||||
`user`
|
`user`
|
||||||
SET
|
SET
|
||||||
@@ -101,9 +126,62 @@ function changePassword($user) {
|
|||||||
`userID` = :userID
|
`userID` = :userID
|
||||||
");
|
");
|
||||||
|
|
||||||
$hashed_password = password_hash($_POST["password-new"].strtolower($user["username"]), PASSWORD_DEFAULT);
|
$hashed_password = password_hash($_POST["password-new"], PASSWORD_DEFAULT);
|
||||||
$stmt->bindParam(":new_password", $hashed_password);
|
$stmt->bindParam(":new_password", $hashed_password);
|
||||||
$stmt->bindParam(":userID", $_SESSION["userID"]);
|
$stmt->bindParam(":userID", $_SESSION["userID"]);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
return $stmt->rowCount();
|
return $stmt->rowCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function changeEmail() {
|
||||||
|
|
||||||
|
if ($_POST["email"] == $_POST["email-confirm"]) {
|
||||||
|
$email = strtolower($_POST["email"]);
|
||||||
|
if (filter_var($email, FILTER_VALIDATE_EMAIL)) {
|
||||||
|
//check if email exists
|
||||||
|
if (emailIsAvailableInDatabase($email)) {
|
||||||
|
if (doChangeEmail($email)) {
|
||||||
|
return new settingsMessage("happy", "Emailadres is veranderd.");
|
||||||
|
} else {
|
||||||
|
return new settingsMessage("angry", "Er is iets mis gegaan.");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return new settingsMessage("angry", "Emailadres bestaat al.");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return new settingsMessage("angry", "Geef een geldig emailadres.");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return new settingsMessage("angry", "Emailadressen komen niet overeen.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function emailIsAvailableInDatabase($email) {
|
||||||
|
$stmt = $GLOBALS["db"]->prepare("
|
||||||
|
SELECT
|
||||||
|
`email`
|
||||||
|
FROM
|
||||||
|
`user`
|
||||||
|
WHERE
|
||||||
|
`email` = :email
|
||||||
|
");
|
||||||
|
|
||||||
|
$stmt->bindParam(":email", $email);
|
||||||
|
$stmt->execute();
|
||||||
|
return !$stmt->rowCount();
|
||||||
|
}
|
||||||
|
|
||||||
|
function doChangeEmail($email) {
|
||||||
|
$stmt = $GLOBALS["db"]->prepare("
|
||||||
|
UPDATE
|
||||||
|
`user`
|
||||||
|
SET
|
||||||
|
`email` = :email
|
||||||
|
WHERE
|
||||||
|
`userID` = :userID
|
||||||
|
");
|
||||||
|
$stmt->bindParam(":email", $email);
|
||||||
|
$stmt->bindParam(":userID", $_SESSION["userID"]);
|
||||||
|
$stmt->execute();
|
||||||
|
return $stmt->rowCount();
|
||||||
|
}
|
||||||
@@ -1,7 +1,93 @@
|
|||||||
<?php
|
<?php
|
||||||
|
require("connect.php");
|
||||||
|
|
||||||
function select20UsersFromN($db, $n) {
|
function getUserID($username) {
|
||||||
return $db->query("
|
$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) {
|
||||||
|
return $GLOBALS["db"]->query("
|
||||||
SELECT
|
SELECT
|
||||||
`userID`,
|
`userID`,
|
||||||
`username`,
|
`username`,
|
||||||
@@ -17,8 +103,8 @@ function select20UsersFromN($db, $n) {
|
|||||||
");
|
");
|
||||||
}
|
}
|
||||||
|
|
||||||
function search20UsersFromN($db, $n, $keyword) {
|
function search20UsersFromN($n, $keyword) {
|
||||||
$q = $db->prepare("
|
$q = $GLOBALS["db"]->prepare("
|
||||||
SELECT
|
SELECT
|
||||||
`userID`,
|
`userID`,
|
||||||
`username`,
|
`username`,
|
||||||
@@ -41,8 +127,8 @@ function search20UsersFromN($db, $n, $keyword) {
|
|||||||
return $q;
|
return $q;
|
||||||
}
|
}
|
||||||
|
|
||||||
function search20UsersFromNByStatus($db, $n, $keyword, $status) {
|
function search20UsersFromNByStatus($n, $keyword, $status) {
|
||||||
$q = $db->prepare("
|
$q = $GLOBALS["db"]->prepare("
|
||||||
SELECT
|
SELECT
|
||||||
`userID`,
|
`userID`,
|
||||||
`username`,
|
`username`,
|
||||||
@@ -69,8 +155,8 @@ function search20UsersFromNByStatus($db, $n, $keyword, $status) {
|
|||||||
return $q;
|
return $q;
|
||||||
}
|
}
|
||||||
|
|
||||||
function changeUserStatusByID($db, $id, $status) {
|
function changeUserStatusByID($id, $status) {
|
||||||
$q = $db->query("
|
$q = $GLOBALS["db"]->query("
|
||||||
UPDATE
|
UPDATE
|
||||||
`user`
|
`user`
|
||||||
SET
|
SET
|
||||||
|
|||||||
@@ -61,9 +61,9 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($_POST["actions"]) && !empty($_POST["userID"])) {
|
if (!empty($_POST["actions"]) && !empty($_POST["userID"])) {
|
||||||
changeUserStatusByID($db, $_POST["userID"], $_POST["actions"]);
|
changeUserStatusByID($_POST["userID"], $_POST["actions"]);
|
||||||
} elseif (!empty($_POST["actions"]) && !empty($_POST["groupID"])) {
|
} elseif (!empty($_POST["actions"]) && !empty($_POST["groupID"])) {
|
||||||
changeGroupStatusByID($db, $_POST["groupID"], $_POST["actions"]);
|
changeGroupStatusByID($_POST["groupID"], $_POST["actions"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -183,7 +183,7 @@ function test_input($data) {
|
|||||||
<!-- Table construction via php PDO. -->
|
<!-- Table construction via php PDO. -->
|
||||||
<?php
|
<?php
|
||||||
if ($pagetype == 'user') {
|
if ($pagetype == 'user') {
|
||||||
$q = search20UsersFromNByStatus($db, $listnr, $search, $status);
|
$q = search20UsersFromNByStatus($listnr, $search, $status);
|
||||||
|
|
||||||
while($user = $q->fetch(PDO::FETCH_ASSOC)) {
|
while($user = $q->fetch(PDO::FETCH_ASSOC)) {
|
||||||
$userID = $user['userID'];
|
$userID = $user['userID'];
|
||||||
@@ -218,7 +218,7 @@ function test_input($data) {
|
|||||||
");
|
");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$q = search20GroupsFromNByStatus($db, $listnr, $search, $groupstatus);
|
$q = search20GroupsFromNByStatus($listnr, $search, $groupstatus);
|
||||||
|
|
||||||
while ($group = $q->fetch(PDO::FETCH_ASSOC)) {
|
while ($group = $q->fetch(PDO::FETCH_ASSOC)) {
|
||||||
$groupID = $group['groupID'];
|
$groupID = $group['groupID'];
|
||||||
|
|||||||
@@ -6,11 +6,8 @@
|
|||||||
<?php
|
<?php
|
||||||
include_once("../queries/friendship.php");
|
include_once("../queries/friendship.php");
|
||||||
|
|
||||||
if (empty($_SESSION["userID"]))
|
|
||||||
$_SESSION["userID"] = 2;
|
|
||||||
|
|
||||||
// Get all the friends of a user.
|
// Get all the friends of a user.
|
||||||
$friends = selectAllFriends($db, $_SESSION["userID"]);
|
$friends = selectAllFriends($_SESSION["userID"]);
|
||||||
$i = 0;
|
$i = 0;
|
||||||
|
|
||||||
// Print all the users.
|
// Print all the users.
|
||||||
@@ -28,7 +25,7 @@
|
|||||||
|
|
||||||
// Echo the friend.
|
// Echo the friend.
|
||||||
echo "
|
echo "
|
||||||
<li class='friend-item' onclick='switchUser(\"$userID\")'>
|
<li class='friend-item' id='friend-item-$userID' onclick='switchUser(\"$userID\")'>
|
||||||
<div class='friend'>
|
<div class='friend'>
|
||||||
<img alt='PF' class='profile-picture' src='$pf'/>
|
<img alt='PF' class='profile-picture' src='$pf'/>
|
||||||
$username
|
$username
|
||||||
@@ -38,12 +35,6 @@
|
|||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</ul>
|
</ul>
|
||||||
<!-- <a href="#">-->
|
|
||||||
<!-- <div class="chat-conversation">-->
|
|
||||||
<!-- <img class="profile-picture" src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTDnuRSeeyPve7KwDvJJ6OBzj3gyghwLcE2z9kZeYBOyZavh3mw">-->
|
|
||||||
<!-- Rudolf Leslo-->
|
|
||||||
<!-- </div>-->
|
|
||||||
<!-- </a>-->
|
|
||||||
</nav>
|
</nav>
|
||||||
<div class="chat-right right">
|
<div class="chat-right right">
|
||||||
<div id="chat-history" class="chat-history platform">
|
<div id="chat-history" class="chat-history platform">
|
||||||
@@ -74,7 +65,7 @@
|
|||||||
<input type="text"
|
<input type="text"
|
||||||
name="content"
|
name="content"
|
||||||
id="newContent"
|
id="newContent"
|
||||||
placeholder="Reageer..."
|
placeholder="Schrijf een bericht..."
|
||||||
autofocus
|
autofocus
|
||||||
required
|
required
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -18,3 +18,7 @@
|
|||||||
include_once("../queries/connect.php");
|
include_once("../queries/connect.php");
|
||||||
|
|
||||||
session_start();
|
session_start();
|
||||||
|
|
||||||
|
if(!isset($_SESSION["userID"])){
|
||||||
|
header("location:login.php");
|
||||||
|
}
|
||||||
@@ -1,3 +1,8 @@
|
|||||||
|
<?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>
|
||||||
@@ -23,9 +28,9 @@
|
|||||||
<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,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" />
|
<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>
|
<a href="chat.php"><div class="right fa fa-comments-o" id="open-chat" data-title="Prive chats"></div></a>
|
||||||
</header>
|
</header>
|
||||||
|
|||||||
@@ -9,11 +9,8 @@
|
|||||||
// Load file.
|
// Load file.
|
||||||
include_once("../queries/friendship.php");
|
include_once("../queries/friendship.php");
|
||||||
|
|
||||||
if (empty($_SESSION["userID"]))
|
|
||||||
$_SESSION["userID"] = 2;
|
|
||||||
|
|
||||||
// Get all the friends of a user.
|
// Get all the friends of a user.
|
||||||
$friends = selectAllFriends($db, $_SESSION["userID"]);
|
$friends = selectAllFriends($_SESSION["userID"]);
|
||||||
$i = 0;
|
$i = 0;
|
||||||
|
|
||||||
// Print all the users.
|
// Print all the users.
|
||||||
@@ -69,7 +66,7 @@
|
|||||||
include_once("../queries/group_member.php");
|
include_once("../queries/group_member.php");
|
||||||
|
|
||||||
// Get all the friends of a user.
|
// Get all the friends of a user.
|
||||||
$groups = selectAllGroupsFromUser($db, $_SESSION["userID"]);
|
$groups = selectAllGroupsFromUser($_SESSION["userID"]);
|
||||||
$i = 0;
|
$i = 0;
|
||||||
|
|
||||||
// Print all the users.
|
// Print all the users.
|
||||||
|
|||||||
@@ -1,113 +1,56 @@
|
|||||||
<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["fname"]?> <?=$user["lname"]?> (<?=$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>
|
<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='#' 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($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='#' 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($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>
|
while($post = $posts->fetch()) {
|
||||||
<p>Lorem ipsum dolor sit amet, consectetur.</p>
|
$nicetime = nicetime($post["creationdate"]);
|
||||||
<p class="subscript">Enkele minuten geleden geplaatst</p>
|
echo "
|
||||||
</div>
|
<div class='post platform'>
|
||||||
<div class="post platform">
|
<h2>${post["title"]}</h2>
|
||||||
<h2>Image</h2>
|
<p>${post["content"]}</p>
|
||||||
<img src="http://i.imgur.com/ypIQKjE.jpg" alt="Olympic Mountains, Washington">
|
<p class=\"subscript\">${nicetime} geplaatst.</p>
|
||||||
<p class="subscript">Gisteren geplaatst</p>
|
</div>
|
||||||
</div>
|
";
|
||||||
<div class="post platform">
|
}
|
||||||
<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>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@@ -6,9 +6,9 @@ $settings = getSettings();
|
|||||||
<div class="settings">
|
<div class="settings">
|
||||||
<?php
|
<?php
|
||||||
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||||
echo "<div class='platform settings-message ${result["type"]}'>
|
echo "<div class='platform settings-message ". $result->getClass()."'>".
|
||||||
${result["message"]}
|
$result->getMessage().
|
||||||
</div>";
|
"</div>";
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<form class="settings-profile platform" method="post">
|
<form class="settings-profile platform" method="post">
|
||||||
|
|||||||
Reference in New Issue
Block a user