PHPBB Avatar Problem.

  • Benat
  • Mastermind
  • Mastermind
  • User avatar
  • Posts: 2123

Post 3+ Months Ago

Does anyone have any idea what this error is? I have no clue.

http://www.electrafiying.com/images/egerror.jpg
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • ATNO/TW
  • Super Moderator
  • Super Moderator
  • User avatar
  • Posts: 23456
  • Loc: Woodbridge VA

Post 3+ Months Ago

Double check any recent mod installs. The stock code for the function in usercp_avatar.php that is throwing the error is this.:

PHP Code: [ Select ]
if ( $width > 0 && $height > 0 && $width <= $board_config['avatar_max_width'] && $height <= $board_config['avatar_max_height'] )
 
   {
 
      $new_filename = uniqid(rand()) . $imgtype;
 
 
 
      if ( $mode == 'editprofile' && $current_type == USER_AVATAR_UPLOAD && $current_avatar != '' )
 
      {
 
         user_avatar_delete($current_type, $current_avatar);
 
      }
 
 
 
      if( $avatar_mode == 'remote' )
 
      {
 
         @copy($tmp_filename, './' . $board_config['avatar_path'] . "/$new_filename");
 
         @unlink($tmp_filename);
 
      }
 
      else
 
      {
 
         if ( @$ini_val('open_basedir') != '' )
 
         {
 
            if ( @phpversion() < '4.0.3' )
 
            {
 
               message_die(GENERAL_ERROR, 'open_basedir is set and your PHP version does not allow move_uploaded_file', '', __LINE__, __FILE__);
 
            }
 
 
 
            $move_file = 'move_uploaded_file';
 
         }
 
         else
 
         {
 
            $move_file = 'copy';
 
         }
 
 
 
         if (!is_uploaded_file($avatar_filename))
 
         {
 
            message_die(GENERAL_ERROR, 'Unable to upload file', '', __LINE__, __FILE__);
 
         }
 
         $move_file($avatar_filename, './' . $board_config['avatar_path'] . "/$new_filename");
 
      }
 
 
 
      @chmod('./' . $board_config['avatar_path'] . "/$new_filename", 0777);
 
 
 
      $avatar_sql = ( $mode == 'editprofile' ) ? ", user_avatar = '$new_filename', user_avatar_type = " . USER_AVATAR_UPLOAD : "'$new_filename', " . USER_AVATAR_UPLOAD;
 
   }
 
   else
 
   {
 
      $l_avatar_size = sprintf($lang['Avatar_imagesize'], $board_config['avatar_max_width'], $board_config['avatar_max_height']);
 
 
 
      $error = true;
 
      $error_msg = ( !empty($error_msg) ) ? $error_msg . '<br />' . $l_avatar_size : $l_avatar_size;
 
   }
 
 
 
   return $avatar_sql;
 
}
 
 
  1. if ( $width > 0 && $height > 0 && $width <= $board_config['avatar_max_width'] && $height <= $board_config['avatar_max_height'] )
  2.  
  3.    {
  4.  
  5.       $new_filename = uniqid(rand()) . $imgtype;
  6.  
  7.  
  8.  
  9.       if ( $mode == 'editprofile' && $current_type == USER_AVATAR_UPLOAD && $current_avatar != '' )
  10.  
  11.       {
  12.  
  13.          user_avatar_delete($current_type, $current_avatar);
  14.  
  15.       }
  16.  
  17.  
  18.  
  19.       if( $avatar_mode == 'remote' )
  20.  
  21.       {
  22.  
  23.          @copy($tmp_filename, './' . $board_config['avatar_path'] . "/$new_filename");
  24.  
  25.          @unlink($tmp_filename);
  26.  
  27.       }
  28.  
  29.       else
  30.  
  31.       {
  32.  
  33.          if ( @$ini_val('open_basedir') != '' )
  34.  
  35.          {
  36.  
  37.             if ( @phpversion() < '4.0.3' )
  38.  
  39.             {
  40.  
  41.                message_die(GENERAL_ERROR, 'open_basedir is set and your PHP version does not allow move_uploaded_file', '', __LINE__, __FILE__);
  42.  
  43.             }
  44.  
  45.  
  46.  
  47.             $move_file = 'move_uploaded_file';
  48.  
  49.          }
  50.  
  51.          else
  52.  
  53.          {
  54.  
  55.             $move_file = 'copy';
  56.  
  57.          }
  58.  
  59.  
  60.  
  61.          if (!is_uploaded_file($avatar_filename))
  62.  
  63.          {
  64.  
  65.             message_die(GENERAL_ERROR, 'Unable to upload file', '', __LINE__, __FILE__);
  66.  
  67.          }
  68.  
  69.          $move_file($avatar_filename, './' . $board_config['avatar_path'] . "/$new_filename");
  70.  
  71.       }
  72.  
  73.  
  74.  
  75.       @chmod('./' . $board_config['avatar_path'] . "/$new_filename", 0777);
  76.  
  77.  
  78.  
  79.       $avatar_sql = ( $mode == 'editprofile' ) ? ", user_avatar = '$new_filename', user_avatar_type = " . USER_AVATAR_UPLOAD : "'$new_filename', " . USER_AVATAR_UPLOAD;
  80.  
  81.    }
  82.  
  83.    else
  84.  
  85.    {
  86.  
  87.       $l_avatar_size = sprintf($lang['Avatar_imagesize'], $board_config['avatar_max_width'], $board_config['avatar_max_height']);
  88.  
  89.  
  90.  
  91.       $error = true;
  92.  
  93.       $error_msg = ( !empty($error_msg) ) ? $error_msg . '<br />' . $l_avatar_size : $l_avatar_size;
  94.  
  95.    }
  96.  
  97.  
  98.  
  99.    return $avatar_sql;
  100.  
  101. }
  102.  
  103.  

(v2.0.21)

You most likely have a problem with a MOD.

If you see no errors there, doublecheck page_header.php starting around line 475 through the end of the document. The stock code is:

PHP Code: [ Select ]
// Work around for "current" Apache 2 + PHP module which seems to not
 
// cope with private cache control setting
 
if (!empty($HTTP_SERVER_VARS['SERVER_SOFTWARE']) && strstr($HTTP_SERVER_VARS['SERVER_SOFTWARE'], 'Apache/2'))
 
{
 
   header ('Cache-Control: no-cache, pre-check=0, post-check=0');
 
}
 
else
 
{
 
   header ('Cache-Control: private, pre-check=0, post-check=0, max-age=0');
 
}
 
header ('Expires: 0');
 
header ('Pragma: no-cache');
 
 
 
$template->pparse('overall_header');
  1. // Work around for "current" Apache 2 + PHP module which seems to not
  2.  
  3. // cope with private cache control setting
  4.  
  5. if (!empty($HTTP_SERVER_VARS['SERVER_SOFTWARE']) && strstr($HTTP_SERVER_VARS['SERVER_SOFTWARE'], 'Apache/2'))
  6.  
  7. {
  8.  
  9.    header ('Cache-Control: no-cache, pre-check=0, post-check=0');
  10.  
  11. }
  12.  
  13. else
  14.  
  15. {
  16.  
  17.    header ('Cache-Control: private, pre-check=0, post-check=0, max-age=0');
  18.  
  19. }
  20.  
  21. header ('Expires: 0');
  22.  
  23. header ('Pragma: no-cache');
  24.  
  25.  
  26.  
  27. $template->pparse('overall_header');
  • Benat
  • Mastermind
  • Mastermind
  • User avatar
  • Posts: 2123

Post 3+ Months Ago

Its driving me insane, I have re-editted the files for the mod that was causing that error, and when I upload it to the directory it makes the whole forum crash..

:twisted:
  • Prime
  • Professor
  • Professor
  • User avatar
  • Posts: 935
  • Loc: Liverpool

Post 3+ Months Ago

Hi,

Using you original code try CHMOD'ing the avatar directory and its contents.

Cheers, Prime ... :D
  • ATNO/TW
  • Super Moderator
  • Super Moderator
  • User avatar
  • Posts: 23456
  • Loc: Woodbridge VA

Post 3+ Months Ago

check with the MOD author. They usually have a post at phpbb when they release a mod. Might be info there to give you a clue. Basically, what's happening is it's trying to send the HTTP header info twice and that is not allowed. That's why it's throwing the error.

Post your code around the lines mentioned in the error from both usercp_avatar.php and page_header.php

Perhaps someone here can spot the problem.
  • daremedy
  • Professor
  • Professor
  • daremedy
  • Posts: 911

Post 3+ Months Ago

CHMOD your /images/avatars directory to 777 (along with any other files in there) and the problem *poof* disappears.
  • Prime
  • Professor
  • Professor
  • User avatar
  • Posts: 935
  • Loc: Liverpool

Post 3+ Months Ago

Hi,

hate to be a killjoy but

Quote:
what's happening is it's trying to send the HTTP header info twice and that is not allowed. That's why it's throwing the error.


not true (sorry ATNO :roll: ). There is only one error, totally ignore the "Cannoty Modify Header ..." errors. They are symtoms and will be cured by default if you correct the first error with the avatar script. I agree with daremedy, it's merely a permissions problem that needs to be CHMOD'd.

Good luck.

Cheers, Prime ...
  • ATNO/TW
  • Super Moderator
  • Super Moderator
  • User avatar
  • Posts: 23456
  • Loc: Woodbridge VA

Post 3+ Months Ago

Well you learn something new everyday. Obviously I read incorrect information once upon a time, and always thought that's what it meant. Thanks for the correction!
  • Benat
  • Mastermind
  • Mastermind
  • User avatar
  • Posts: 2123

Post 3+ Months Ago

Thankyou Prime and Daremedy that worked a treat!
  • piterekd
  • Born
  • Born
  • piterekd
  • Posts: 1

Post 3+ Months Ago

daremedy wrote:
CHMOD your /images/avatars directory to 777 (along with any other files in there) and the problem *poof* disappears.

Thnx for the help, it works at my forum and resolved my problem :)

Polish: Dzięki za pomoc, działa u mnie i rozwiązało mój problem :)

greetings

Post Information

  • Total Posts in this topic: 10 posts
  • Users browsing this forum: No registered users and 62 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.