Merge branch 'master' into hendrik-testing
This commit is contained in:
@@ -4,12 +4,14 @@ function placeFriendButtons() {
|
|||||||
friendshipStatus = data;
|
friendshipStatus = data;
|
||||||
$buttonContainer = $("div.friend-button-container");
|
$buttonContainer = $("div.friend-button-container");
|
||||||
$buttonContainer.children().remove();
|
$buttonContainer.children().remove();
|
||||||
|
$("#start-profile-chat-form").hide();
|
||||||
if (friendshipStatus == -1) {
|
if (friendshipStatus == -1) {
|
||||||
return;
|
return;
|
||||||
} else if(friendshipStatus == 0) {
|
} else if(friendshipStatus == 0) {
|
||||||
$buttonContainer.append($("<button class=\"green friend-button\" value=\"request\"><i class=\"fa fa-handshake-o\"></i> Bevriend</button>"));
|
$buttonContainer.append($("<button class=\"green friend-button\" value=\"request\"><i class=\"fa fa-handshake-o\"></i> Bevriend</button>"));
|
||||||
} else if(friendshipStatus == 1) {
|
} else if(friendshipStatus == 1) {
|
||||||
$buttonContainer.append($("<button class=\"red friend-button\" value=\"delete\"><i class=\"fa fa-times\"></i> Verwijder</button>"));
|
$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) {
|
} else if(friendshipStatus == 2) {
|
||||||
$buttonContainer.append($("<button class=\"red friend-button\" value=\"delete\"><i class=\"fa fa-times\"></i> Trek verzoek in</button>"));
|
$buttonContainer.append($("<button class=\"red friend-button\" value=\"delete\"><i class=\"fa fa-times\"></i> Trek verzoek in</button>"));
|
||||||
} else if(friendshipStatus == 3) {
|
} else if(friendshipStatus == 3) {
|
||||||
|
|||||||
@@ -19,16 +19,24 @@
|
|||||||
</script>";
|
</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
|
// Define variables and set to empty values
|
||||||
$uname = $psw ="";
|
$user = $psw ="";
|
||||||
$loginErr = $resetErr ="";
|
$loginErr = $resetErr ="";
|
||||||
|
|
||||||
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||||
switch ($_POST["submit"]) {
|
switch ($_POST["submit"]) {
|
||||||
case "login":
|
case "login":
|
||||||
try {
|
try {
|
||||||
$uname = ($_POST["uname"]);
|
$user = ($_POST["user"]);
|
||||||
validateLogin($_POST["uname"], $_POST["psw"]);
|
validateLogin($_POST["user"], $_POST["psw"]);
|
||||||
} catch(loginException $e) {
|
} catch(loginException $e) {
|
||||||
$loginErr = $e->getMessage();
|
$loginErr = $e->getMessage();
|
||||||
}
|
}
|
||||||
@@ -46,7 +54,96 @@
|
|||||||
</script>";
|
</script>";
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case "register":
|
||||||
|
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){
|
||||||
|
echo "<script>
|
||||||
|
window.onload = function() {
|
||||||
|
$('#registerModal').show();
|
||||||
|
}
|
||||||
|
</script>";
|
||||||
|
$genericErr = $e->getMessage();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// // Trying to login
|
// // Trying to login
|
||||||
|
|||||||
@@ -14,9 +14,12 @@
|
|||||||
header("location: login.php");
|
header("location: login.php");
|
||||||
}
|
}
|
||||||
// define variables and set to empty values
|
// define variables and set to empty values
|
||||||
$name = $surname = $bday = $username = $password = $confirmpassword = $location = $housenumber = $email = $captcha = $ip = "";
|
$name = $surname = $bday = $username = $password = $confirmpassword = $location = $housenumber = $email = $confirmEmail = $captcha = $ip = "";
|
||||||
$genericErr = $nameErr = $surnameErr = $bdayErr = $usernameErr = $passwordErr = $confirmpasswordErr = $locationErr = $housenumberErr = $emailErr = $captchaErr = "";
|
$genericErr = $nameErr = $surnameErr = $bdayErr = $usernameErr = $passwordErr = $confirmpasswordErr = $locationErr = $housenumberErr = $emailErr = $confirmEmailErr = $captchaErr = "";
|
||||||
$correct = true;
|
$correct = true;
|
||||||
|
$day_date = "dag";
|
||||||
|
$month_date = "maand";
|
||||||
|
$year_date = "jaar";
|
||||||
|
|
||||||
// Trying to register an account
|
// Trying to register an account
|
||||||
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||||
@@ -38,7 +41,10 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
try{
|
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");
|
checkInputChoice($bday, "bday");
|
||||||
} catch(bdayException $e){
|
} catch(bdayException $e){
|
||||||
$correct = false;
|
$correct = false;
|
||||||
@@ -76,9 +82,14 @@
|
|||||||
try{
|
try{
|
||||||
$email = test_input(($_POST["email"]));
|
$email = test_input(($_POST["email"]));
|
||||||
checkInputChoice($email, "email");
|
checkInputChoice($email, "email");
|
||||||
|
$confirmEmail = test_input(($_POST["confirmEmail"]));
|
||||||
|
matchEmail();
|
||||||
} catch(emailException $e){
|
} catch(emailException $e){
|
||||||
$correct = false;
|
$correct = false;
|
||||||
$emailErr = $e->getMessage();
|
$emailErr = $e->getMessage();
|
||||||
|
} catch(confirmEmailException $e){
|
||||||
|
$correct = false;
|
||||||
|
$confirmEmailErr = $e->getMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
try{
|
try{
|
||||||
|
|||||||
@@ -28,10 +28,12 @@ body {
|
|||||||
form {
|
form {
|
||||||
/*background-color: #a87a87;*/
|
/*background-color: #a87a87;*/
|
||||||
border-radius: 12px;
|
border-radius: 12px;
|
||||||
height: 85%;
|
height: 80%;
|
||||||
margin: auto;
|
margin: auto;
|
||||||
width: 80%;
|
width: 600px;
|
||||||
overflow-y:auto;
|
overflow-y:auto;
|
||||||
|
overflow-x: hidden;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -130,7 +132,11 @@ label {
|
|||||||
margin: 34px auto;
|
margin: 34px auto;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
width: 45%;
|
width: 600px;
|
||||||
|
}
|
||||||
|
|
||||||
|
select{
|
||||||
|
width: 18%;
|
||||||
}
|
}
|
||||||
|
|
||||||
ul {
|
ul {
|
||||||
@@ -160,7 +166,7 @@ ul {
|
|||||||
margin: auto;
|
margin: auto;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
border: 1px solid #888;
|
border: 1px solid #888;
|
||||||
width: 500px;
|
width: 589px;
|
||||||
box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2),0 6px 20px 0 rgba(0,0,0,0.19);
|
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-name: animatetop;
|
||||||
-webkit-animation-duration: 0.4s;
|
-webkit-animation-duration: 0.4s;
|
||||||
@@ -200,10 +206,11 @@ ul {
|
|||||||
color: black;
|
color: black;
|
||||||
}
|
}
|
||||||
|
|
||||||
.modal-body {padding: 2px 16px;}
|
.modal-body {
|
||||||
|
padding: 2px 16px;
|
||||||
|
}
|
||||||
|
|
||||||
.modal-footer {
|
.modal-footer {
|
||||||
padding: 2px 16px;
|
|
||||||
background-color: #FBC02D;
|
background-color: #FBC02D;
|
||||||
color: black;
|
color: black;
|
||||||
}
|
}
|
||||||
@@ -275,3 +275,16 @@ div[data-title]:hover:after {
|
|||||||
display: inline-block;
|
display: inline-block;
|
||||||
vertical-align: middle;
|
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;
|
||||||
|
}
|
||||||
@@ -30,6 +30,7 @@ div.posts div.post {
|
|||||||
width: calc(100% - 40px);
|
width: calc(100% - 40px);
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
transition-duration: 250ms;
|
transition-duration: 250ms;
|
||||||
|
word-wrap: break-word;
|
||||||
}
|
}
|
||||||
|
|
||||||
div.posts div.post:hover {
|
div.posts div.post:hover {
|
||||||
|
|||||||
@@ -38,7 +38,6 @@ function checkName($variable){
|
|||||||
if (empty($variable)) {
|
if (empty($variable)) {
|
||||||
throw new lettersAndSpacesException("Verplicht!");
|
throw new lettersAndSpacesException("Verplicht!");
|
||||||
} else if (!preg_match("/^[a-zA-Z ]*$/", $variable)) {
|
} else if (!preg_match("/^[a-zA-Z ]*$/", $variable)) {
|
||||||
|
|
||||||
throw new lettersAndSpacesException("Alleen letters en spaties zijn toegestaan!");
|
throw new lettersAndSpacesException("Alleen letters en spaties zijn toegestaan!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -48,12 +47,12 @@ function validateBday($variable){
|
|||||||
if (empty($variable)) {
|
if (empty($variable)) {
|
||||||
throw new bdayException("Verplicht!");
|
throw new bdayException("Verplicht!");
|
||||||
} else {
|
} else {
|
||||||
if (!(validateDate($variable, "Y/m/d"))) {
|
if (!(validateDate($variable, "Y-m-d"))) {
|
||||||
throw new bdayException("Geen geldige datum");
|
throw new bdayException("Geen geldige datum");
|
||||||
} else {
|
} else {
|
||||||
$dateNow = date("Y/m/d");
|
$dateNow = date("Y-m-d");
|
||||||
if ($dateNow < $variable) {
|
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. */
|
/* checks if an input is a valid email. */
|
||||||
function resetEmail($variable){
|
function resetEmail($variable){
|
||||||
if (empty($variable)) {
|
if (empty($variable)) {
|
||||||
@@ -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
|
class captchaException extends Exception
|
||||||
{
|
{
|
||||||
public function __construct($message = "", $code = 0, Exception $previous = null)
|
public function __construct($message = "", $code = 0, Exception $previous = null)
|
||||||
|
|||||||
@@ -9,10 +9,11 @@ function getUser() {
|
|||||||
FROM
|
FROM
|
||||||
`user`
|
`user`
|
||||||
WHERE
|
WHERE
|
||||||
`username` LIKE :username
|
`username` LIKE :username OR
|
||||||
|
`email` LIKE :username
|
||||||
");
|
");
|
||||||
|
|
||||||
$stmt->bindParam(":username", $_POST["uname"]);
|
$stmt->bindParam(":username", test_input($_POST["user"]));
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
return $stmt->fetch(PDO::FETCH_ASSOC);
|
return $stmt->fetch(PDO::FETCH_ASSOC);
|
||||||
}
|
}
|
||||||
@@ -20,7 +21,7 @@ function getUser() {
|
|||||||
function validateLogin($username, $password){
|
function validateLogin($username, $password){
|
||||||
// Empty username or password field
|
// Empty username or password field
|
||||||
if (empty($username) || empty($password)) {
|
if (empty($username) || empty($password)) {
|
||||||
throw new loginException("Gebruikersnaam of wachtwoord is niet ingevuld");
|
throw new loginException("Inloggegevens zijn niet ingevuld");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$psw = test_input($password);
|
$psw = test_input($password);
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
function getOldChatMessages($user2ID) {
|
function getOldChatMessages($user2ID) {
|
||||||
|
require_once ("friendship.php");
|
||||||
$user1ID = $_SESSION["userID"];
|
$user1ID = $_SESSION["userID"];
|
||||||
|
if (getFriendshipStatus($user2ID) == 1) {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = $GLOBALS["db"]->prepare("
|
||||||
SELECT
|
SELECT
|
||||||
*
|
*
|
||||||
@@ -23,9 +24,14 @@ function getOldChatMessages($user2ID) {
|
|||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
|
|
||||||
return json_encode($stmt->fetchAll());
|
return json_encode($stmt->fetchAll());
|
||||||
|
} else {
|
||||||
|
return "[]";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function sendMessage($destination, $content) {
|
function sendMessage($destination, $content) {
|
||||||
|
require_once("friendship.php");
|
||||||
|
if (getFriendshipStatus($destination) == 1) {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = $GLOBALS["db"]->prepare("
|
||||||
INSERT INTO
|
INSERT INTO
|
||||||
`private_message`
|
`private_message`
|
||||||
@@ -47,9 +53,14 @@ function sendMessage($destination, $content) {
|
|||||||
"destination" => $destination,
|
"destination" => $destination,
|
||||||
"content" => $content
|
"content" => $content
|
||||||
));
|
));
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getNewChatMessages($lastID, $destination) {
|
function getNewChatMessages($lastID, $destination) {
|
||||||
|
require_once("friendship.php");
|
||||||
|
if (getFriendshipStatus($destination) == 1) {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = $GLOBALS["db"]->prepare("
|
||||||
SELECT
|
SELECT
|
||||||
*
|
*
|
||||||
@@ -73,19 +84,22 @@ function getNewChatMessages($lastID, $destination) {
|
|||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
|
|
||||||
return json_encode($stmt->fetchAll());
|
return json_encode($stmt->fetchAll());
|
||||||
|
} else {
|
||||||
|
return "[]";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function selectAllUnreadChat() {
|
function selectAllUnreadChat() {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = $GLOBALS["db"]->prepare("
|
||||||
SELECT
|
SELECT
|
||||||
LEFT(CONCAT(`user`.`fname`, ' ', `user`.`lname`), 15) as `fullname`,
|
LEFT(CONCAT(`user`.`fname`, ' ', `user`.`lname`), 15) AS `fullname`,
|
||||||
`user`.`userID`,
|
`user`.`userID`,
|
||||||
IFNULL(
|
IFNULL(
|
||||||
`profilepicture`,
|
`profilepicture`,
|
||||||
'../img/avatar-standard.png'
|
'../img/avatar-standard.png'
|
||||||
) AS profilepicture,
|
) AS profilepicture,
|
||||||
LEFT(`private_message`.`content`, 15) as `content`
|
LEFT(`private_message`.`content`, 15) AS `content`
|
||||||
FROM
|
FROM
|
||||||
`private_message`,
|
`private_message`,
|
||||||
`friendship`,
|
`friendship`,
|
||||||
@@ -101,7 +115,8 @@ function selectAllUnreadChat() {
|
|||||||
`friendship`.chatLastVisted2 IS NULL)) AND
|
`friendship`.chatLastVisted2 IS NULL)) AND
|
||||||
`private_message`.`origin` = `user`.`userID` AND
|
`private_message`.`origin` = `user`.`userID` AND
|
||||||
`private_message`.`destination` = :userID AND
|
`private_message`.`destination` = :userID AND
|
||||||
`user`.`role` != 'banned'
|
`user`.`role` != 'banned' AND
|
||||||
|
`friendship`.`status` = 'confirmed'
|
||||||
|
|
||||||
GROUP BY `user`.`userID`
|
GROUP BY `user`.`userID`
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ function getExistingUsername() {
|
|||||||
`username` LIKE :username
|
`username` LIKE :username
|
||||||
");
|
");
|
||||||
|
|
||||||
$stmt->bindParam(":username", $_POST["username"]);
|
$stmt->bindParam(":username", test_input($_POST["username"]));
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
return $stmt->rowCount();
|
return $stmt->rowCount();
|
||||||
|
|
||||||
@@ -26,7 +26,7 @@ function getExistingEmail() {
|
|||||||
`email` LIKE :email
|
`email` LIKE :email
|
||||||
");
|
");
|
||||||
|
|
||||||
$stmt->bindParam(":email", $_POST["email"]);
|
$stmt->bindParam(":email", test_input($_POST["email"]));
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
return $stmt->rowCount();
|
return $stmt->rowCount();
|
||||||
|
|
||||||
@@ -42,7 +42,7 @@ function getResetEmail() {
|
|||||||
`email` LIKE :email
|
`email` LIKE :email
|
||||||
");
|
");
|
||||||
|
|
||||||
$stmt->bindParam(":email", $_POST["forgotEmail"]);
|
$stmt->bindParam(":email", test_input($_POST["forgotEmail"]));
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
return $stmt->rowCount();
|
return $stmt->rowCount();
|
||||||
|
|
||||||
@@ -70,15 +70,21 @@ function registerAccount() {
|
|||||||
|
|
||||||
$hash=password_hash($_POST["password"], PASSWORD_DEFAULT);
|
$hash=password_hash($_POST["password"], PASSWORD_DEFAULT);
|
||||||
|
|
||||||
$stmt->bindParam(":fname", $_POST["name"]);
|
$stmt->bindParam(":fname", test_input($_POST["name"]));
|
||||||
$stmt->bindParam(":lname", $_POST["surname"]);
|
$stmt->bindParam(":lname", test_input($_POST["surname"]));
|
||||||
$stmt->bindParam(":bday", $_POST["bday"]);
|
$stmt->bindParam(":bday", test_input($_POST["bday"]));
|
||||||
$stmt->bindParam(":username", $_POST["username"]);
|
$stmt->bindParam(":username", test_input($_POST["username"]));
|
||||||
$stmt->bindParam(":password", $hash);
|
$stmt->bindParam(":password", test_input($hash));
|
||||||
$stmt->bindParam(":location", $_POST["location"]);
|
$stmt->bindParam(":location", test_input($_POST["location"]));
|
||||||
$stmt->bindParam(":email", (strtolower($_POST["email"])));
|
$stmt->bindParam(":email", test_input(strtolower($_POST["email"])));
|
||||||
|
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
$stmt->rowCount();
|
$stmt->rowCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function submitselect($date, $value){
|
||||||
|
if ($date == $value){
|
||||||
|
echo "selected";
|
||||||
|
}
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ function getUsername($userID) {
|
|||||||
function selectUser($me, $other) {
|
function selectUser($me, $other) {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = $GLOBALS["db"]->prepare("
|
||||||
SELECT
|
SELECT
|
||||||
|
`userID`,
|
||||||
`username`,
|
`username`,
|
||||||
`birthdate`,
|
`birthdate`,
|
||||||
`location`,
|
`location`,
|
||||||
@@ -94,7 +95,7 @@ function selectAllUserGroups($userID) {
|
|||||||
`group_page`.`groupID` = `group_member`.`groupID`
|
`group_page`.`groupID` = `group_member`.`groupID`
|
||||||
WHERE
|
WHERE
|
||||||
`userID` = :userID AND
|
`userID` = :userID AND
|
||||||
`role` = 1
|
`role` = 'member'
|
||||||
");
|
");
|
||||||
|
|
||||||
$stmt->bindParam(':userID', $userID, PDO::PARAM_INT);
|
$stmt->bindParam(':userID', $userID, PDO::PARAM_INT);
|
||||||
@@ -331,9 +332,10 @@ function searchSomeUsers($n, $m, $search) {
|
|||||||
FROM
|
FROM
|
||||||
`user`
|
`user`
|
||||||
WHERE
|
WHERE
|
||||||
`username` LIKE :keyword OR
|
(`username` LIKE :keyword OR
|
||||||
`fname` LIKE :keyword OR
|
`fname` LIKE :keyword OR
|
||||||
`lname` LIKE :keyword
|
`lname` LIKE :keyword) AND
|
||||||
|
`role` != 'banned'
|
||||||
ORDER BY
|
ORDER BY
|
||||||
`fname`,
|
`fname`,
|
||||||
`lname`,
|
`lname`,
|
||||||
|
|||||||
@@ -74,6 +74,7 @@
|
|||||||
name="content"
|
name="content"
|
||||||
id="newContent"
|
id="newContent"
|
||||||
placeholder="Schrijf een bericht..."
|
placeholder="Schrijf een bericht..."
|
||||||
|
autocomplete="off"
|
||||||
autofocus
|
autofocus
|
||||||
required
|
required
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -13,12 +13,12 @@
|
|||||||
|
|
||||||
<!-- Login name -->
|
<!-- Login name -->
|
||||||
<div class="login_containerlogin">
|
<div class="login_containerlogin">
|
||||||
<label><b>Gebruikersnaam</b></label>
|
<label><b>Gebruikersnaam/Email</b></label>
|
||||||
<input type="text"
|
<input type="text"
|
||||||
placeholder="Voer uw gebruikersnaam in"
|
placeholder="Voer uw gebruikersnaam/email in"
|
||||||
name="uname"
|
name="user"
|
||||||
value="<?php echo $uname ?>"
|
value="<?php echo $user ?>"
|
||||||
title="Moet 6 of meer karakters bevatten"
|
title="Moet een geldige gebruiker zijn"
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -47,8 +47,8 @@
|
|||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Button for going to the register screen -->
|
<!-- Button for going to the register screen -->
|
||||||
<div class="login_containerlogin">
|
<div class="login_containerlogin">
|
||||||
<a href="https://myhyvesbookplus.nl/register" class="button">Registreer een account</a>
|
<a href="https://myhyvesbookplus.nl/register" class="button">Registreer een account</a>
|
||||||
|
|
||||||
<!-- Trigger/Open The Modal -->
|
<!-- Trigger/Open The Modal -->
|
||||||
@@ -86,31 +86,232 @@
|
|||||||
|
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
<script>
|
|
||||||
// Get the modal
|
|
||||||
var modal = document.getElementById('myModal');
|
|
||||||
|
|
||||||
|
<!-- 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">
|
||||||
|
|
||||||
|
<!-- 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>
|
||||||
|
<!-- <input type="date"-->
|
||||||
|
<!-- name="bday"-->
|
||||||
|
<!-- value="--><?php //echo $bday ?><!--"-->
|
||||||
|
<!-- id="bday"-->
|
||||||
|
<!-- placeholder="1996/01/01"-->
|
||||||
|
<!-- data-fv-date-max=""-->
|
||||||
|
<!-- data-date="" data-date-format="DD MMMM YYYY"-->
|
||||||
|
<!-- >-->
|
||||||
|
<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>
|
||||||
|
|
||||||
|
<!-- 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>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
// Get the button that opens the modal
|
// Get the button that opens the modal
|
||||||
|
var modal = document.getElementById('myModal');
|
||||||
var btn = document.getElementById("myBtn");
|
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
|
// Get the <span> element that closes the modal
|
||||||
var span = document.getElementsByClassName("close")[0];
|
var span = document.getElementsByClassName("close")[0];
|
||||||
|
var registerSpan = document.getElementsByClassName("close")[1];
|
||||||
|
|
||||||
// When the user clicks the button, open the modal
|
// When the user clicks the button, open the modal
|
||||||
btn.onclick = function() {
|
btn.onclick = function() {
|
||||||
modal.style.display = "block";
|
modal.style.display = "block";
|
||||||
}
|
}
|
||||||
|
registerBtn.onclick = function() {
|
||||||
|
registerModal.style.display = "block";
|
||||||
|
}
|
||||||
|
|
||||||
// When the user clicks on <span> (x), close the modal
|
// When the user clicks on <span> (x), close the modal
|
||||||
span.onclick = function() {
|
span.onclick = function() {
|
||||||
modal.style.display = "none";
|
modal.style.display = "none";
|
||||||
}
|
}
|
||||||
|
registerSpan.onclick = function() {
|
||||||
// When the user clicks anywhere outside of the modal, close it
|
registerModal.style.display = "none";
|
||||||
window.onclick = function(event) {
|
|
||||||
if (event.target == modal) {
|
|
||||||
modal.style.display = "none";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -1,7 +1,13 @@
|
|||||||
<div class="content">
|
<div class="content">
|
||||||
<div class="profile-box platform">
|
<div class="profile-box platform">
|
||||||
<img class="left profile-picture" src="<?php echo $user["profilepicture"] ?>">
|
<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 class="friend-button-container">
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -40,14 +40,52 @@
|
|||||||
|
|
||||||
<!-- Register birthday -->
|
<!-- Register birthday -->
|
||||||
<div class="login_containerregister">
|
<div class="login_containerregister">
|
||||||
<label><b>Geboortedatum</b></label>
|
<label><b>Geboortedatum(Dag/Maand/Jaar)</b></label>
|
||||||
<input type="text"
|
<!-- <input type="date"-->
|
||||||
name="bday"
|
<!-- name="bday"-->
|
||||||
value="<?php echo $bday ?>"
|
<!-- value="--><?php //echo $bday ?><!--"-->
|
||||||
id="bday"
|
<!-- id="bday"-->
|
||||||
placeholder="1996/01/01"
|
<!-- placeholder="1996/01/01"-->
|
||||||
data-fv-date-max=""
|
<!-- data-fv-date-max=""-->
|
||||||
>
|
<!-- data-date="" data-date-format="DD MMMM YYYY"-->
|
||||||
|
<!-- >-->
|
||||||
|
<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>
|
*<span class="error"> <?php echo $bdayErr;?></span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -118,6 +156,18 @@
|
|||||||
*<span class="error"> <?php echo $emailErr;?></span>
|
*<span class="error"> <?php echo $emailErr;?></span>
|
||||||
</div>
|
</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="login_containerregister">
|
||||||
<div class="g-recaptcha" data-sitekey="6Lc72xIUAAAAADumlWetgENm7NGd9Npyo0c_tYYQ"></div>
|
<div class="g-recaptcha" data-sitekey="6Lc72xIUAAAAADumlWetgENm7NGd9Npyo0c_tYYQ"></div>
|
||||||
<span class="error"> <?php echo $captchaErr;?></span>
|
<span class="error"> <?php echo $captchaErr;?></span>
|
||||||
|
|||||||
Reference in New Issue
Block a user