From bdad9a1ba9e68c016759374fb24059f571d98435 Mon Sep 17 00:00:00 2001 From: deva Date: Mon, 27 Oct 2008 14:58:26 +0000 Subject: Added customizable avatars (users can now upload their own). --- forum/utils/profile.php | 46 ++++++++++++++++++++++++---------------------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/forum/utils/profile.php b/forum/utils/profile.php index 7f8372c..a8676b4 100644 --- a/forum/utils/profile.php +++ b/forum/utils/profile.php @@ -5,7 +5,7 @@ if($action == "update") { // $current_user->username = $username; $current_user->name = $name; $current_user->email = $email; - $current_user->avatar = $avatar; + // $current_user->avatar = $avatar; $current_user->signature = $signature; if($password != "") { if($password == $password_confirm) { @@ -14,29 +14,31 @@ if($action == "update") { error("Passwords do not match - thus not changed!"); } } + + if(is_uploaded_file($_FILES['userfile']['tmp_name'])) { + if(!file_exists("gfx/avatars")) mkdir("gfx/avatars"); + $filename = $_FILES['userfile']['name']; + if($current_user->avatar) unlink("gfx/avatars/" . $current_user->avatar); + move_uploaded_file($_FILES['userfile']['tmp_name'], "gfx/avatars/" . $filename); + $current_user->avatar = $filename; + } + + $users->write(); } ?> -
-username; ?>">
*/ ?> -Name:
-New password:
-Confirm password:
-E-Mail:
-Avatar:
-Signature:
-
-
- +username; ?>">
*/ ?> + Name:
+ New password:
+ Confirm password:
+ E-Mail:
+ Avatar:
+ Avatar
+
+ Signature:
+
+
+
-- cgit v1.2.3