Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.
Not a member yet? Click here to register.
Forgot Password?

How do you manage errors display on profile update?

Asked Modified Viewed 1,410 times
S
sekouba
S
  • Newbie, joined since
  • Contributed 1 post on the community forums.
  • Started 1 thread in the forums
  • Started this discussions
asked
Newbie

On version 6 when a user try to update his profile with wrong character how display errors message ?
on include/update_profile_include.php

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]


on edit_profile.php

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]
   }

[alt]
//Put in code tags on code and disabled smilies -Smith[/alt]
Edited by Smith on 12-07-2008 15:11,
0 replies
There are no post found.

Labels

None yet

Statistics

  • Views 0 views
  • Posts 0 posts
  • Votes 0 votes
  • Topic users 1 member

1 participant

S
S
  • Newbie, joined since
  • Contributed 1 post on the community forums.
  • Started 1 thread in the forums
  • Started this discussions

Notifications

Track thread

You are not receiving notifications from this thread.

Related Questions

Not yet