Lars algemeen #102
@@ -2,7 +2,7 @@
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<?php
|
<?php
|
||||||
include("../views/head.php");
|
include_once("../views/head.php");
|
||||||
include_once("../queries/connect.php");
|
include_once("../queries/connect.php");
|
||||||
include_once("../queries/settings.php");
|
include_once("../queries/settings.php");
|
||||||
?>
|
?>
|
||||||
@@ -12,8 +12,6 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
include("../views/main.php");
|
|
||||||
$notImplemented = new settingsMessage("angry", "Deze functie werkt nog niet :(");
|
$notImplemented = new settingsMessage("angry", "Deze functie werkt nog niet :(");
|
||||||
|
|
||||||
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||||
@@ -33,6 +31,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
include("../views/main.php");
|
||||||
|
|
||||||
include("../views/settings-view.php");
|
include("../views/settings-view.php");
|
||||||
|
|
||||||
|
|||||||
@@ -188,15 +188,25 @@ function doChangeEmail($email) {
|
|||||||
function updateProfilePicture() {
|
function updateProfilePicture() {
|
||||||
$profilePictureDir = "/var/www/html/public/";
|
$profilePictureDir = "/var/www/html/public/";
|
||||||
$relativePath = "uploads/profilepictures/" . $_SESSION["userID"] . "_" . basename($_FILES["pp"]["name"]);
|
$relativePath = "uploads/profilepictures/" . $_SESSION["userID"] . "_" . basename($_FILES["pp"]["name"]);
|
||||||
// removeOldProfilePicture();
|
removeOldProfilePicture();
|
||||||
move_uploaded_file($_FILES['pp']['tmp_name'], $profilePictureDir . $relativePath);
|
move_uploaded_file($_FILES['pp']['tmp_name'], $profilePictureDir . $relativePath);
|
||||||
setProfilePictureToDatabase("../" . $relativePath);
|
setProfilePictureToDatabase("../" . $relativePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
//function removeOldProfilePicture() {
|
function removeOldProfilePicture() {
|
||||||
//
|
$stmt = $GLOBALS["db"]->prepare("
|
||||||
// unlink("/var/www/html/public/uploads/profilepictures/" . $_SESSION["userID"] . "_*");
|
SELECT
|
||||||
//}
|
`profilepicture`
|
||||||
|
FROM
|
||||||
|
`user`
|
||||||
|
WHERE
|
||||||
|
`userID` = :userID
|
||||||
|
");
|
||||||
|
$stmt->bindParam(":userID", $_SESSION["userID"]);
|
||||||
|
$stmt->execute();
|
||||||
|
$old_avatar = $stmt->fetch()["profilepicture"];
|
||||||
|
unlink("/var/www/html/public/uploads/" . $old_avatar);
|
||||||
|
}
|
||||||
|
|
||||||
function setProfilePictureToDatabase($url) {
|
function setProfilePictureToDatabase($url) {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = $GLOBALS["db"]->prepare("
|
||||||
|
|||||||
Reference in New Issue
Block a user