Kevin prototype #93
@@ -7,6 +7,17 @@
|
||||
include_once("../queries/checkInput.php")
|
||||
?>
|
||||
<body>
|
||||
<script>
|
||||
function checkLoggedIn() {
|
||||
if (confirm("You are already logged in!\nDo you want to logout?\nPress ok to logout.") == true) {
|
||||
window.location.href = "logout.php";
|
||||
} else {
|
||||
window.history.back();
|
||||
}
|
||||
document.getElementById("demo").innerHTML = x;
|
||||
}
|
||||
</script>
|
||||
|
||||
<?php
|
||||
session_start();
|
||||
|
||||
@@ -48,18 +59,5 @@
|
||||
/* This view adds login view */
|
||||
include("../views/login-view.php");
|
||||
?>
|
||||
|
||||
<script>
|
||||
function checkLoggedIn() {
|
||||
if (confirm("You are already logged in!\Do you want to logout?\Press ok to logout.") == true) {
|
||||
unset($_SESSION["userID"]);
|
||||
header("Location: login.php");
|
||||
} else {
|
||||
header("location: profile.php");
|
||||
}
|
||||
document.getElementById("demo").innerHTML = x;
|
||||
}
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -22,12 +22,13 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||
$result = updateSettings();
|
||||
break;
|
||||
case "password":
|
||||
$result = updatePassword();
|
||||
$result = changePassword();
|
||||
break;
|
||||
case "email":
|
||||
$result = changeEmail();
|
||||
break;
|
||||
case "picture":
|
||||
updateProfilePicture();
|
||||
$result = $notImplemented;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
a.button {
|
||||
background-color: #405550;
|
||||
background-color: #C8CABD;
|
||||
border-radius: 10px;
|
||||
color: white;
|
||||
color: black;
|
||||
cursor: pointer;
|
||||
height: 50%;
|
||||
margin: 8px 0;
|
||||
@@ -46,8 +46,8 @@ body {
|
||||
form {
|
||||
/*background-color: #a87a87;*/
|
||||
border-radius: 12px;
|
||||
height: 75%;
|
||||
margin: 10px auto;
|
||||
height: 80%;
|
||||
margin: auto;
|
||||
width: 70%;
|
||||
overflow-y:auto;
|
||||
}
|
||||
@@ -66,14 +66,15 @@ h2 {
|
||||
font-size: 2.0em;
|
||||
}
|
||||
|
||||
|
||||
input[type=text], input[type=password], input[type=email], input[type="date"] {
|
||||
box-sizing: border-box;
|
||||
border-color: #C8CABD;
|
||||
display: inline-block;
|
||||
height: 50%;
|
||||
height: 60%;
|
||||
padding: 8px 20px;
|
||||
margin: 4px 0;
|
||||
width: 50%;
|
||||
width: 70%;
|
||||
}
|
||||
/*
|
||||
input[type=text], input[type=password], input[type=email], input[type="date"] {
|
||||
@@ -101,6 +102,31 @@ label {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.left-arrow {
|
||||
display: inline-block;
|
||||
position: relative;
|
||||
background-color: #C8CABD;
|
||||
height: 30px;
|
||||
width: 90px;
|
||||
padding: 3px 3px 3px 0px;
|
||||
text-align: center;
|
||||
border-radius: 0px 10px 10px 0px;
|
||||
font-size: 24px;
|
||||
|
||||
}
|
||||
.left-arrow:after {
|
||||
content: '';
|
||||
display: block;
|
||||
position: absolute;
|
||||
right: 100%;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
border-top: 15px solid transparent;
|
||||
border-right: 20px solid #C8CABD;
|
||||
border-bottom: 15px solid transparent;
|
||||
border-left: 0px solid transparent;
|
||||
}
|
||||
|
||||
/* padding voor registreer container */
|
||||
.login_containerregister {
|
||||
padding: 16px;
|
||||
@@ -109,7 +135,7 @@ label {
|
||||
|
||||
/* padding voor login_containers */
|
||||
.login_containerlogin {
|
||||
padding: 16px;
|
||||
padding:25px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
@@ -133,11 +159,11 @@ label {
|
||||
background-repeat: repeat-x;
|
||||
background-attachment: fixed;*/
|
||||
box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
|
||||
height: 53%;
|
||||
height: 550px;
|
||||
margin: 34px auto;
|
||||
overflow-y: auto;
|
||||
padding: 20px;
|
||||
width: 35%;
|
||||
width: 50%;
|
||||
}
|
||||
|
||||
/*.platform {
|
||||
|
||||
@@ -87,11 +87,11 @@ function updateSettings() {
|
||||
`userID` = :userID
|
||||
");
|
||||
|
||||
$stmt->bindParam(":fname", $_POST["fname"]);
|
||||
$stmt->bindParam(":lname", $_POST["lname"]);
|
||||
$stmt->bindParam(":location", $_POST["location"]);
|
||||
$stmt->bindParam(":fname", test_input($_POST["fname"]));
|
||||
$stmt->bindParam(":lname", test_input($_POST["lname"]));
|
||||
$stmt->bindParam(":location", test_input($_POST["location"]));
|
||||
$stmt->bindParam(":bday", $_POST["bday"]);
|
||||
$stmt->bindParam(":bio", $_POST["bio"]);
|
||||
$stmt->bindParam(":bio", test_input($_POST["bio"]));
|
||||
$stmt->bindParam(":userID", $_SESSION["userID"]);
|
||||
|
||||
$stmt->execute();
|
||||
@@ -99,11 +99,11 @@ function updateSettings() {
|
||||
return new settingsMessage("happy", "Instellingen zijn opgeslagen.");
|
||||
}
|
||||
|
||||
function updatePassword() {
|
||||
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 (changePassword()) {
|
||||
if (doChangePassword()) {
|
||||
return new settingsMessage("happy", "Wachtwoord gewijzigd.");
|
||||
} else {
|
||||
return new settingsMessage("angry", "Er is iets mis gegaan.");
|
||||
@@ -116,7 +116,7 @@ function updatePassword() {
|
||||
}
|
||||
}
|
||||
|
||||
function changePassword() {
|
||||
function doChangePassword() {
|
||||
$stmt = $GLOBALS["db"]->prepare("
|
||||
UPDATE
|
||||
`user`
|
||||
@@ -184,4 +184,26 @@ function doChangeEmail($email) {
|
||||
$stmt->bindParam(":userID", $_SESSION["userID"]);
|
||||
$stmt->execute();
|
||||
return $stmt->rowCount();
|
||||
}
|
||||
|
||||
function updateProfilePicture() {
|
||||
$profilePictureDir = "/var/www/html/public/";
|
||||
$relativePath = "uploads/" . $_SESSION["userID"] . "_" . basename($_FILES["pp"]["name"]);
|
||||
move_uploaded_file($_FILES['pp']['tmp_name'], $profilePictureDir . $relativePath);
|
||||
setProfilePictureToDatabase("../" . $relativePath);
|
||||
}
|
||||
|
||||
function setProfilePictureToDatabase($url) {
|
||||
$stmt = $GLOBALS["db"]->prepare("
|
||||
UPDATE
|
||||
`user`
|
||||
SET
|
||||
`profilepicture` = :profilepicture
|
||||
WHERE
|
||||
`userID` = :userID
|
||||
");
|
||||
|
||||
$stmt->bindParam(":profilepicture", $url);
|
||||
$stmt->bindParam(":userID", $_SESSION["userID"]);
|
||||
$stmt->execute();
|
||||
}
|
||||
@@ -62,12 +62,6 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||
$listn = ($currentpage-1) * $perpage;
|
||||
$listm = $currentpage * $perpage;
|
||||
|
||||
function test_input($data) {
|
||||
$data = trim($data);
|
||||
$data = stripslashes($data);
|
||||
$data = htmlspecialchars($data);
|
||||
return $data;
|
||||
}
|
||||
?>
|
||||
|
||||
<div class="content">
|
||||
|
||||
@@ -123,13 +123,12 @@
|
||||
value="Registreer uw account"
|
||||
name="Submit"
|
||||
id="frm1_submit">
|
||||
Registreer uw account
|
||||
Registreer
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<!-- Button for going back to login screen -->
|
||||
<div class="login_containerlogin">
|
||||
<a href="https://myhyvesbookplus.nl/login.php" class="button">Login met een account</a>
|
||||
<!-- Button for going back to login screen -->
|
||||
<a href="https://myhyvesbookplus.nl/login.php" class="left-arrow">Login</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -68,7 +68,7 @@ $settings = getSettings();
|
||||
</li>
|
||||
</ul>
|
||||
</form>
|
||||
<form class="settings-profilepictue platform" method="post">
|
||||
<form class="settings-profilepictue platform" method="post" enctype="multipart/form-data">
|
||||
<h5>Verander profielfoto</h5>
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
Reference in New Issue
Block a user