From ce6a42482a37d63e83b14bb7e203e672c0c76b58 Mon Sep 17 00:00:00 2001 From: Carson Fleming Date: Wed, 25 Oct 2017 13:34:10 -0400 Subject: Fixed profile pictures glitch --- dash/profile.php | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'dash/profile.php') diff --git a/dash/profile.php b/dash/profile.php index d730dc9..fa3ee8e 100644 --- a/dash/profile.php +++ b/dash/profile.php @@ -57,7 +57,7 @@ while ($row = $result->fetch_assoc()) {

-

Profile Picture

+

Profile Picture

Based on

@@ -97,11 +97,13 @@ $result->free(); ), 'changed.tpl')) or dash_fatal('We couldn\'t send mail to your new email address, so your profile has not been updated.'); } if (!empty($_FILES['picture']['tmp_name'])) { - $usepropic = ', picture = id'; + $picstr = genpicstr(); + $usepropic = ', picture = \''.$db->escape_string($picstr).'\''; $tmpfile = $_FILES['picture']['tmp_name']; if (getimagesize($tmpfile) === false) dash_fatal('Your uploaded file is not an image.'); @$img = imagecreatefromstring(file_get_contents($tmpfile)); - @imagepng($img, 'uimg/'.$b_user['id'].'.png'); + @imagepng($img, $picstr) or dash_fatal('Your new profile picture could not be saved to the server.'); + @unlink($b_user['picture']); @imagedestroy($img); } $db->query('UPDATE users SET email = \''.$db->escape_string($_POST['email']).'\', zipcode = \''.$db->escape_string($_POST['zip']).'\', phone = \''.$db->escape_string($_POST['phone']).'\', address = '.$addr.', bio = '.$bio.$usepropic.$deactivate.' WHERE id = '.$b_user['id']) or dash_fatal($db->error); @@ -121,12 +123,7 @@ $result->free();

Profile Picture

-'.PHP_EOL; - else - echo ' Profile Picture'.PHP_EOL; -?> + Profile Picture

Upload New

-- cgit v1.2.3