Hendrik search #104
@@ -29,7 +29,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
|||||||
break;
|
break;
|
||||||
case "picture":
|
case "picture":
|
||||||
updateProfilePicture();
|
updateProfilePicture();
|
||||||
$result = $notImplemented;
|
$result = new settingsMessage("happy", "Deze melding doet nog niks nuttigs.");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -188,22 +188,28 @@ function doChangeEmail($email) {
|
|||||||
|
|
||||||
function updateProfilePicture() {
|
function updateProfilePicture() {
|
||||||
$profilePictureDir = "/var/www/html/public/";
|
$profilePictureDir = "/var/www/html/public/";
|
||||||
$relativePath = "uploads/" . $_SESSION["userID"] . "_" . basename($_FILES["pp"]["name"]);
|
$relativePath = "uploads/profilepictures/" . $_SESSION["userID"] . "_" . basename($_FILES["pp"]["name"]);
|
||||||
|
// 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() {
|
||||||
|
//
|
||||||
|
// unlink("/var/www/html/public/uploads/profilepictures/" . $_SESSION["userID"] . "_*");
|
||||||
|
//}
|
||||||
|
|
||||||
function setProfilePictureToDatabase($url) {
|
function setProfilePictureToDatabase($url) {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = $GLOBALS["db"]->prepare("
|
||||||
UPDATE
|
UPDATE
|
||||||
`user`
|
`user`
|
||||||
SET
|
SET
|
||||||
`profilepicture` = :profilepicture
|
`profilepicture` = :profilePicture
|
||||||
WHERE
|
WHERE
|
||||||
`userID` = :userID
|
`userID` = :userID
|
||||||
");
|
");
|
||||||
|
|
||||||
$stmt->bindParam(":profilepicture", $url);
|
$stmt->bindParam(":profilePicture", $url);
|
||||||
$stmt->bindParam(":userID", $_SESSION["userID"]);
|
$stmt->bindParam(":userID", $_SESSION["userID"]);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user