Hendrik testing #64
@@ -1,7 +1,12 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<?php include("../views/head.php"); ?>
|
<?php
|
||||||
|
include("../views/head.php");
|
||||||
|
$_SESSION["userID"] = 2;
|
||||||
|
include_once("../queries/connect.php");
|
||||||
|
include_once("../queries/settings.php");
|
||||||
|
?>
|
||||||
<style>
|
<style>
|
||||||
@import url("styles/settings.css");
|
@import url("styles/settings.css");
|
||||||
</style>
|
</style>
|
||||||
@@ -12,13 +17,20 @@
|
|||||||
* This view adds the main layout over the screen.
|
* This view adds the main layout over the screen.
|
||||||
* Header and menu.
|
* Header and menu.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
include("../views/main.php");
|
include("../views/main.php");
|
||||||
|
|
||||||
|
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||||
|
updateSettings();
|
||||||
|
}?>
|
||||||
|
|
||||||
|
<?php
|
||||||
/* Add your view files here. */
|
/* Add your view files here. */
|
||||||
include("../views/settings-view.php");
|
include("../views/settings-view.php");
|
||||||
|
|
||||||
/* This adds the footer. */
|
/* This adds the footer. */
|
||||||
include("../views/footer.php");
|
include("../views/footer.php");
|
||||||
|
|
||||||
?>
|
?>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -21,6 +21,10 @@
|
|||||||
text-align: right;
|
text-align: right;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.settings-password label, .settings-email label {
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
/* All the fields for typing things. */
|
/* All the fields for typing things. */
|
||||||
.settings input[type="password"],
|
.settings input[type="password"],
|
||||||
.settings input[type="text"],
|
.settings input[type="text"],
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ if ($dbconf === FALSE) {
|
|||||||
die("Error parsing XML file");
|
die("Error parsing XML file");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$db = new PDO("mysql:host=$dbconf->mysql_host;dbname=$dbconf->mysql_database;charset=utf8",
|
$GLOBALS["db"] = new PDO("mysql:host=$dbconf->mysql_host;dbname=$dbconf->mysql_database;charset=utf8",
|
||||||
"$dbconf->mysql_username", "$dbconf->mysql_password")
|
"$dbconf->mysql_username", "$dbconf->mysql_password")
|
||||||
or die('Error connecting to mysql server');
|
or die('Error connecting to mysql server');
|
||||||
}
|
}
|
||||||
|
|||||||
46
website/queries/settings.php
Normal file
46
website/queries/settings.php
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
function getSettings() {
|
||||||
|
$stmt = $GLOBALS["db"]->prepare("
|
||||||
|
SELECT
|
||||||
|
`fname`,
|
||||||
|
`lname`,
|
||||||
|
`email`,
|
||||||
|
`location`,
|
||||||
|
`birthdate`,
|
||||||
|
`bio`,
|
||||||
|
`profilepicture`
|
||||||
|
FROM
|
||||||
|
`user`
|
||||||
|
WHERE
|
||||||
|
`userID` = :userID
|
||||||
|
");
|
||||||
|
|
||||||
|
$stmt->bindParam(":userID", $_SESSION["userID"]);
|
||||||
|
$stmt->execute();
|
||||||
|
return $stmt->fetch();
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateSettings() {
|
||||||
|
$stmt = $GLOBALS["db"]->prepare("
|
||||||
|
UPDATE
|
||||||
|
`user`
|
||||||
|
SET
|
||||||
|
`fname` = :fname,
|
||||||
|
`lname` = :lname,
|
||||||
|
`location` = :location,
|
||||||
|
`birthdate` = :bday,
|
||||||
|
`bio` = :bio
|
||||||
|
WHERE
|
||||||
|
`userID` = :userID
|
||||||
|
");
|
||||||
|
|
||||||
|
$stmt->bindParam(":fname", $_POST["fname"]);
|
||||||
|
$stmt->bindParam(":lname", $_POST["lname"]);
|
||||||
|
$stmt->bindParam(":location", $_POST["location"]);
|
||||||
|
$stmt->bindParam(":bday", $_POST["bday"]);
|
||||||
|
$stmt->bindParam(":bio", $_POST["bio"]);
|
||||||
|
$stmt->bindParam(":userID", $_SESSION["userID"]);
|
||||||
|
|
||||||
|
$stmt->execute();
|
||||||
|
}
|
||||||
@@ -15,6 +15,6 @@
|
|||||||
</style>
|
</style>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
include_once("../connect.php");
|
include_once("../queries/connect.php");
|
||||||
|
|
||||||
?>
|
?>
|
||||||
@@ -1,39 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
$settings = getSettings();
|
||||||
|
?>
|
||||||
|
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<div class="settings">
|
<div class="settings">
|
||||||
<form class="settings-profile platform">
|
<form class="settings-profile platform" method="post">
|
||||||
<h5>Profiel Instellingen</h5>
|
<h5>Profiel Instellingen</h5>
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
<label for="first-name">Voornaam</label>
|
<label for="fname">Voornaam</label>
|
||||||
<input type="text"
|
<input type="text"
|
||||||
name="first-name"
|
name="fname"
|
||||||
id="first-name"
|
id="fname"
|
||||||
placeholder="Voornaam"
|
placeholder="Voornaam"
|
||||||
title="Voornaam"
|
title="Voornaam"
|
||||||
|
value="<?= $settings["fname"]?>"
|
||||||
>
|
>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<label for="last-name">Achternaam</label>
|
<label for="lname">Achternaam</label>
|
||||||
<input type="text"
|
<input type="text"
|
||||||
name="last-name"
|
name="lname"
|
||||||
id="last-name"
|
id="lname"
|
||||||
placeholder="Achternaam"
|
placeholder="Achternaam"
|
||||||
>
|
value="<?= $settings["lname"]?>"
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<label for="place">Woonplaats</label>
|
|
||||||
<input type="text"
|
|
||||||
name="place"
|
|
||||||
id="place"
|
|
||||||
placeholder="Woonplaats"
|
|
||||||
>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<label for="bday">Geboortedatum</label>
|
|
||||||
<input type="date"
|
|
||||||
name="bday"
|
|
||||||
id="bday"
|
|
||||||
placeholder="01/01/1900"
|
|
||||||
>
|
>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
@@ -42,6 +32,16 @@
|
|||||||
name="location"
|
name="location"
|
||||||
id="location"
|
id="location"
|
||||||
placeholder="Locatie"
|
placeholder="Locatie"
|
||||||
|
value="<?= $settings["location"]?>"
|
||||||
|
>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<label for="bday">Geboortedatum</label>
|
||||||
|
<input type="date"
|
||||||
|
name="bday"
|
||||||
|
id="bday"
|
||||||
|
placeholder="01/01/1900"
|
||||||
|
value="<?= $settings["birthdate"]?>"
|
||||||
>
|
>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
@@ -50,7 +50,7 @@
|
|||||||
rows="5"
|
rows="5"
|
||||||
title="bio"
|
title="bio"
|
||||||
id="bio"
|
id="bio"
|
||||||
></textarea>
|
><?= $settings["bio"]?></textarea>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<label></label>
|
<label></label>
|
||||||
@@ -60,12 +60,12 @@
|
|||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</form>
|
</form>
|
||||||
<form class="settings-profilepictue platform">
|
<form class="settings-profilepictue platform" method="post">
|
||||||
<h5>Verander profielfoto</h5>
|
<h5>Verander profielfoto</h5>
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
<label>Huidige profielfoto</label>
|
<label>Huidige profielfoto</label>
|
||||||
<img src="../public/img/top-logo.png"
|
<img src="<?= $settings["profilepicture"] ?>"
|
||||||
class="profile-picture"
|
class="profile-picture"
|
||||||
>
|
>
|
||||||
</li>
|
</li>
|
||||||
@@ -108,7 +108,6 @@
|
|||||||
>
|
>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<label></label>
|
|
||||||
<input type="submit"
|
<input type="submit"
|
||||||
value="Verander wachtwoord"
|
value="Verander wachtwoord"
|
||||||
>
|
>
|
||||||
@@ -119,6 +118,14 @@
|
|||||||
<form class="settings-email platform item-box" method="post">
|
<form class="settings-email platform item-box" method="post">
|
||||||
<h5>Verander Email</h5>
|
<h5>Verander Email</h5>
|
||||||
<ul>
|
<ul>
|
||||||
|
<li>
|
||||||
|
<label for="email-old">Huidig Email </label>
|
||||||
|
<input type="email"
|
||||||
|
id="email-old"
|
||||||
|
value="<?= $settings["email"]?>"
|
||||||
|
disabled
|
||||||
|
>
|
||||||
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<label for="email">Nieuw Email</label>
|
<label for="email">Nieuw Email</label>
|
||||||
<input type="email"
|
<input type="email"
|
||||||
@@ -136,7 +143,6 @@
|
|||||||
>
|
>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<label></label>
|
|
||||||
<input type="submit"
|
<input type="submit"
|
||||||
value="Verander Email"
|
value="Verander Email"
|
||||||
>
|
>
|
||||||
|
|||||||
Reference in New Issue
Block a user