if ($error == "") { [b]// if no error but when we have error what do ?[/b]
$newavatar = $_FILES['user_avatar'];
if ($userdata['user_avatar'] == "" && !empty($newavatar['name']) && is_uploaded_file($newavatar['tmp_name'])) {
$avatarext = strrchr($newavatar['name'],".");
$avatarname = substr($newavatar['name'], 0, strrpos($newavatar['name'], "."));
if (preg_match("/^[-0-9A-Z_\[\]]+$/i", $avatarname) && preg_match("/(\.gif|\.GIF|\.jpg|\.JPG|\.png|\.PNG)$/", $avatarext) && $newavatar['size'] <= 30720) {
$avatarname = $avatarname."[".$userdata['user_id']."]".$avatarext;
$set_avatar = "user_avatar='$avatarname', ";
move_uploaded_file($newavatar['tmp_name'], IMAGES."avatars/".$avatarname);
chmod(IMAGES."avatars/".$avatarname,0644);
if ($size = @getimagesize(IMAGES."avatars/".$avatarname)) {
if ($size['0'] > 100 || $size['1'] > 100) {
unlink(IMAGES."avatars/".$avatarname);
$set_avatar = "";
} elseif (!verify_image(IMAGES."avatars/".$avatarname)) {
unlink(IMAGES."avatars/".$avatarname);
$set_avatar = "";
}
} else {
unlink(IMAGES."avatars/".$avatarname);
$set_avatar = "";
}
}
}
if (isset($_POST['del_avatar'])) {
$set_avatar = "user_avatar='', ";
unlink(IMAGES."avatars/".$userdata['user_avatar']);
}
if ($user_newpassword != "") { $newpass = " user_password='".md5(md5($user_newpassword))."', "; } else { $newpass = " "; }
$result = dbquery("UPDATE ".$db_prefix."users SET user_name='$username',".$newpass."user_email='".$_POST['user_email']."', user_hide_email='$user_hide_email', user_location='$user_location', user_birthdate='$user_birthdate', user_aim='$user_aim', user_icq='$user_icq', user_msn='$user_msn', user_yahoo='$user_yahoo', user_web='$user_web', user_theme='$user_theme', user_offset='$user_offset', ".$set_avatar."user_sig='$user_sig' WHERE user_id='".$userdata['user_id']."'");
$result = dbquery("SELECT * FROM ".$db_prefix."users WHERE user_id='".$userdata['user_id']."'");
if (dbrows($result) != 0) {
$userdata = dbarray($result);
redirect("edit_profile.php?update_profile=ok");
}
}
[b]else
{
redirect("edit_profile.php?update_profile=error");
}[/b]
if (isset($update_profile)) {
[b]if no error[/b]
{echo "<tr>\n<td colspan='2' class='tbl'>".$locale['441']."<br><br>\n</td>\n</tr>\n";}
else
[b]echo the error message here[/b]
}
Category Forum
Suspected Bugs and Errors - 8Labels
None yet
Statistics
1 participant
Notifications
You are not receiving notifications from this thread.
Related Questions