phpBB-TweakS
 
Advanced Search
   
 
Home Downloads FAQ Register FAQ Memberlist Usergroups Ranks
 
 

Please help us to develop!

 
It appears you are using a browser that is not based on Internet Explorer, this means you are not viewing the web as good as you should be. Other browsers might try to immitate Internet Explorer, but none can parse the web as it should like Internet Explorer can. So view the web as it was meant to be with Avant Browser!
         

phpBB-TweakS Forum Index Misc. Support Avatar Issue
Display posts from previous:   
Half Thread Topic  Fully Thread Topic  Download Topic
      All times are GMT - 5 Hours  
Post new topic  Reply to topic

Fri Sep 14, 2007 8:58 pm
Author Message
X
100 Club
100 Club


Mexico

Joined: 13 Jan 2005
Posts: 157
Words Posted: 22,097
Average Post: 140.75

Location: México

Post subject: Avatar Issue Reply with quote

I have some code here that checks all kinds of stuff about the avatar.
It was working fine but now it seems totally dead.
Whats the problem with this, why it wont work with PHP5 or PHP4.4+ ?

Code:

function user_avatar_url($mode, &$error, &$error_msg, $avatar_filename)
{
   global $lang;

   if ( !preg_match('#^(http)|(ftp):\/\/#i', $avatar_filename) )
   {
      $avatar_filename = 'http://' . $avatar_filename;
   }

   $avatar_filename = substr($avatar_filename, 0, 100);

   if ( !preg_match("#^((ht|f)tp://)([^ \?&=\#\"\n\r\t<]*?(\.(jpg|jpeg|gif|png))$)#is", $avatar_filename) )
   {
      $error = true;
      $error_msg = ( !empty($error_msg) ) ? $error_msg . '<br />' . $lang['Wrong_remote_avatar_format'] : $lang['Wrong_remote_avatar_format'];
      return;
   }

//TILL THIS

   global $board_config;
   
   $remote_file = @fopen ($avatar_filename, "rb");
   
   if(!$remote_file)
   {
      $error = true;
      $error_msg = sprintf($lang['Remote_avatar_no_image'], $avatar_filename);
      return;
   }
   
   $user_avatar_size = 0;
   do
   {
      if (strlen(@fread($remote_file, 1)) == 0)
      {
         break;
      }
      $user_avatar_size ++;
   }
   while(true);
   @fclose($remote_file);
 
   if($user_avatar_size > $board_config['avatar_filesize'])
   {
      $error = true;
      $error_msg = sprintf($lang['Remote_avatar_error_filesize'], $board_config['avatar_filesize']);
      return;
   }
 
   list($user_avatar_width, $user_avatar_height) = @getimagesize($avatar_filename);
   
   if($user_avatar_width > $board_config['avatar_max_width'] || $user_avatar_height > $board_config['avatar_max_height'])
   {
      $error = true;
      $error_msg = sprintf($lang['Remote_avatar_error_dimension'], $board_config['avatar_max_width'], $board_config['avatar_max_height']);
      return;
   }

   return ( $mode == 'editprofile' ) ? ", user_avatar = '" . str_replace("\'", "''", $avatar_filename) . "', user_avatar_type = " . USER_AVATAR_REMOTE : '';

}


It was working fine till a month or two ago.
I cannot understand why its wrong, maybe with PHP5 it has a reason to fail but no with my PHP4.4+

Greets.
Post #1
      Back To Top  

Sun Sep 16, 2007 4:19 pm
Author Message
aUsTiN
Webmaster
Webmaster


Usa Georgia

Joined: 05 Jan 2005
Posts: 3684
Words Posted: 144,671
Average Post: 39.27

Location: USA

Post subject: Reply with quote

What exactly is this supposed to do? The reason i ask an obvious question is by glancing at it, i dont see anything standing out as to why it doesn't work.

What part of it does work if any?

If the upload bit is broke, is the dir still CHMOD'ed properly? Remove the @ signs and see if it returns a PHP error.
Post #2
      Back To Top  

 
         

Post new topic  Reply to topic

phpBB-TweakS Forum Index Misc. Support Avatar Issue
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 vote in polls in this forum


      Back To Top  

Page 1 of 1
Jump to:  
 
Protected by phpBB Security © phpBB-TweakS
phpBB Security Has Blocked 3,237 Exploit Attempts.

· Archive · Sitemap: Index · Sitemap: Forums · Sitemap: Topics · Sitemap: Posts ·

:: [ Load Time: 2.9 Seconds ] :: [ 29 Queries ] :: [ 3,824 Page(s) Viewed Today ] ::
:: [ Todays Queries: 114,607 ] :: [ Highest Load: 1,396,429 Queries On May. 08, 2007 ] ::
:: [ SQL Load: 63% Time: 1.8 ] :: [ PHP Load: 37% Time: 1.1 ] :: [ Debug: On ] :: [ GZIP: Enabled ] ::
:: The server last rebooted 82 days, 2 hours, 53 minutes, 29 seconds ago. ::

The phpBB[Network]!
       
Powered by phpBB 2.0.* © 2001, 2002 phpBB Group
Avalanche style by What Is Real © 2004