34 Mensajes
12
Avatar Image
Usuario habitual
Usuario habitual

Tengo un pequeño problemilla: Soy administrador de un foro y con la opción de subir un avatar desde el PC activada intento hacerlo y al intentar cargar la imagen me sale un mensaje que dice "el tipo de imagen del avatar tiene que ser .jpg, .gif o .png". He cambiado el CHMOD a 777 y he intentado subir avatares con los tres tipos de extensiones (logicamente con el peso adecuado) y nada de nada. ¡Una ayudita por favor!

Avatar Image
Machacateclados
Machacateclados

Si no eres la unica a mi tambien me pasa, pero es simple, agarras el mismo archivo que quieres descargar, y lo publicas, y luego lo usas a traves del url, es más sencillo.

Avatar Image
Machacateclados
Machacateclados

has intentado estas instrucciones???

Bajar Instrucciones

Avatar Image
Usuario habitual
Usuario habitual

Me ha ido guay. Muchísimas gracias.

Avatar Image
Machacateclados
Machacateclados

Abre tu usercp_avatar.php en un editor de texto y cambia lo siguiente


1) Busca la función "function user_avatar_upload".

Después veras una linea que contiene

"global $board_config, $user_ip, $db, $lang;". después de eso inserta: (recuerda cambiar /home/myhomedir por la home de tu página,
si no sabes cuál es, la puedes saber cuando te sale el error del avatar, ahi te muestra toda la dir de tu página)


if ($avatar_mode == 'local') {
move_uploaded_file($avatar_filename,'/home/myhomedir'.$avatar_filename);
$avatar_filename = '/home/myhomedir'.$avatar_filename;
}
$tmp_path = '/home/myhomedir/tmp';


2) Busca la linea que contiene "$tmp_path = ( !@$ini_val('safe_mode') ) ? '/tmp' : './' . $board_config['avatar_path'] . '/tmp';", y deshabilitala agrgando "//" al inicio de la linea


// $tmp_path = ( !@$ini_val('safe_mode') ) ? '/tmp' : './' . $board_config['avatar_path'] . '/tmp';

al inicio de la linea puedes ver los "//"

3) Busca la linea que contiene "$move_file = 'move_uploaded_file';" an remplaza por:


$move_file = 'copy';


4) Crea una carpeta que se llame "tmp" dentro de la carpeta de tu foro
ejemplo

phpBB/tmp

5)a la carpeta "tmp" dale los permisos 777, con algun programa de ftp, como FlashFXP, cuteFTP, WS_FTP

6)si has seguido los pasos correctamente puedes subir avatar a tu página

Avatar Image
Usuario habitual
Usuario habitual

Perdonarme por mi ignorancia pero sigo todas las instruciones de este ultimo post y no me sale, es que yo de php no tengo ni idea

mirad mi direccion de la web es esta:

https://forosphp.webcindario.com/phpBB2

y yo pongo esto:

if ($avatar_mode == 'local') {move_uploaded_file($avatar_filename,'/home/https://forosphp.webcindario.com/phpBB2/'.$avatar_filename);
$avatar_filename = '/home/https://forosphp.webcindario.com/phpBB2/'.$avatar_filename;}$tmp_path = '/home/https://forosphp.webcindario.com/phpBB2/tmp';



Y ME SALE ESTE ERROR CUANDO ENVIO EL AVATAR DESDE MI PC


Warning: move_uploaded_file(): SAFE MODE Restriction in effect. The script whose uid is 48 is not allowed to access /home owned by uid 0 in /home/webcindario/forosphp/phpBB2/includes/usercp_avatar.php on line 101

POR FAVOR AYUDAAA


Avatar Image
Usuario habitual
Usuario habitual

Quien puede echarme una mano por favor..


gracias

Avatar Image
Machacateclados
Machacateclados

cambia:
esta linea que pusiste /home/https://forosphp.webcindario.com/phpBB2/

por esta otra

/home/webcindario/forosphp/phpBB2/

y esta
/home/https://forosphp.webcindario.com/phpBB2/tmp

por esta

/home/webcindario/forosphp/phpBB2/tmp

Avatar Image
Usuario habitual
Usuario habitual

Rexo
muuuuuchas graciassss
joer casi me lo estaba diciendo el error
que tonto soy


graciassssss

Avatar Image
Machacateclados
Machacateclados

no te preocupes para eso estamos

Incosa.
Usuario Novato
Usuario Novato

Despues de hacer las modificaciones esas en el archivo correspondiente el foro da este error al intentar subir un avatar:
Warning: move_uploaded_file(): SAFE MODE Restriction in effect. The script whose uid is 48 is not allowed to access /home owned by uid 0 in /home/webcindario/incosa/foro/includes/usercp_avatar.php on line 102

Alguien sabe solucionarlo?

Avatar Image
Machacateclados
Machacateclados

cheka q hayas deshabilitado la opción move con los "//"

Avatar Image
Usuario Novato
Usuario Novato

Si, esa linea esta como comentario para que no se ejecute pero aun asi sigue dando el error.

Avatar Image
Machacateclados
Machacateclados

verifica bien los pasos del 3 en adelante, sobre todo la parte de los permisos a la carpeta tmp

Avatar Image
Usuario habitual
Usuario habitual

Esta claro que tiene que ser algun fallo de "sintaxis" ya que a mi me funciono a la primera, excepto por el nombre de la web.

Revisalo como dice Rexo y si no empieza de 0, es lo mejor

Un saludo

OxiAndRex
Usuario Novato
Usuario Novato

Gracias, muchas gracias si siguen las instrucciones esto les servirá, a mi por lo menos me sirvió

Avatar Image
@man / @woman
@man / @woman

Cuando subes el avatar luego luego no se carga, pero espera 1 dia y ya aparecera

Avatar Image
Usuario habitual
Usuario habitual

yo he abierto el usercp_avatar.php (carpeta de includes?) en mi pagina web, y a decir verdad solo tiene una linea de texto. Eso si, antes de instalarlo me he fijado que tenia muchas mas. Que se supone que tengo que hacer? Porque el archivo que decis una vez subido e instalado lo tengo casi vacio. ¿Lo edito del que tengo sin subir y luego lo subo? ¿Lo edito y luego lo reinstalo con el editado?

me he liado

OxiAndRex
Usuario Novato
Usuario Novato

TENGAN CUIDADO CON LAS MAYUSCULAS, YO CASI ME ENLOQUESCO Y EL ERROR ERA UNA "F" QUE DEBIA ESTAR EN MAYUSCULA Y ESTABA EN MINUSCULA.

Avatar Image
Machacateclados
Machacateclados

has una copia del original, editalo como estan las instrucciones y cuando termines de editarlo lo subes

estas instrucciones estan garantizadas, ya que varios usuarios lo han conseguido con exito y los que no han podido al poco tiempo se dan cuenta q tenían un error de sintaxis o algun detalle minimo q no tomaban en cuenta

Avatar Image
Usuario Novato
Usuario Novato

ok, voy a probarlo, gracias

y... por que tenia el usercp_avatar casi vacio en la web, pero no antes de subirlo? es normal?

Avatar Image
Machacateclados
Machacateclados

ok pruebalo y veras q si funciona

lo q se vacio el archivo pues no sabría decirte porq sucedio, a mi me ah pasado un par de ocasiones y no eh descubierto el porq...

Avatar Image
Usuario Novato
Usuario Novato

ya esta, funcionable al 100%. Muchas gracias.

Aleks_CDF
Usuario Novato
Usuario Novato

Buenas, yo tmpc puedo subir los avatares, hize todo lo q pone en el foro pero a mi no me da ningun tipo de error, se me hace un reload a la pagina, y no me aparece el avatar...
Que puede ser?

Avatar Image
Usuario habitual
Usuario habitual

Warning: move_uploaded_file(/home/webcindario/startengines/tmp/php4IE6dQ): failed to open stream: No such file or directory in /home/webcindario/startengines/includes/usercp_avatar.php on line 101

Warning: move_uploaded_file(): Unable to move '/tmp/php4IE6dQ' to '/home/webcindario/startengines/tmp/php4IE6dQ' in /home/webcindario/startengines/includes/usercp_avatar.php on line 101


A mi me dice lo anterior.. ¿alguna idea?

akorps
Usuario Novato
Usuario Novato
Escrito originalmente por Dzacab
Abre tu usercp_avatar.php en un editor de texto y cambia lo siguiente


1) Busca la función "function user_avatar_upload".

Después veras una linea que contiene

"global $board_config, $user_ip, $db, $lang;". después de eso inserta: (recuerda cambiar /home/myhomedir por la home de tu página,
si no sabes cuál es, la puedes saber cuando te sale el error del avatar, ahi te muestra toda la dir de tu página)


if ($avatar_mode == 'local') {
move_uploaded_file($avatar_filename,'/home/myhomedir'.$avatar_filename);
$avatar_filename = '/home/myhomedir'.$avatar_filename;
}
$tmp_path = '/home/myhomedir/tmp';


2) Busca la linea que contiene "$tmp_path = ( !@$ini_val('safe_mode') ) ? '/tmp' : './' . $board_config['avatar_path'] . '/tmp';", y deshabilitala agrgando "//" al inicio de la linea


// $tmp_path = ( !@$ini_val('safe_mode') ) ? '/tmp' : './' . $board_config['avatar_path'] . '/tmp';

al inicio de la linea puedes ver los "//"

3) Busca la linea que contiene "$move_file = 'move_uploaded_file';" an remplaza por:


$move_file = 'copy';


4) Crea una carpeta que se llame "tmp" dentro de la carpeta de tu foro
ejemplo

phpBB/tmp

5)a la carpeta "tmp" dale los permisos 777, con algun programa de ftp, como FlashFXP, cuteFTP, WS_FTP

6)si has seguido los pasos correctamente puedes subir avatar a tu página



hola veo que con esto se les ha solucionado el problema pero yo uso phpbb y no esta la function user_avatar_upload, si no que esta:

usercp_avatar.php

<?php
/***************************************************************************
* usercp_avatar.php
* -------------------
* begin : Saturday, Feb 13, 2001
* copyright : (C) 2001 The phpBB Group
* email : support@phpbb.com
*
* $Id: usercp_avatar.php,v 1.8.2.17 2003/03/04 21:02:36 acydburn Exp $
*
*
***************************************************************************/

/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
*
***************************************************************************/

function check_image_type(&$type, &$error, &$error_msg)
{
global $lang;

switch( $type )
{
case 'jpeg':
case 'pjpeg':
case 'jpg':
return '.jpg';
break;
case 'gif':
return '.gif';
break;
case 'png':
return '.png';
break;
default:
$error = true;
$error_msg = (!empty($error_msg)) ? $error_msg . '<br />' . $lang['Avatar_filetype'] : $lang['Avatar_filetype'];
break;
}

return false;
}

function user_avatar_delete($avatar_type, $avatar_file)
{
global $board_config, $userdata;

if ( $avatar_type == USER_AVATAR_UPLOAD && $avatar_file != '' )
{
if ( @file_exists(@phpbb_realpath('./' . $board_config['avatar_path'] . '/' . $avatar_file)) )
{
@unlink('./' . $board_config['avatar_path'] . '/' . $avatar_file);
}
}

return ", user_avatar = '', user_avatar_type = " . USER_AVATAR_NONE;
}

function user_avatar_gallery($mode, &$error, &$error_msg, $avatar_filename)
{
global $board_config;
if ( file_exists(@phpbb_realpath($board_config['avatar_gallery_path'] . '/' . $avatar_filename)) && ($mode == 'editprofile') )
{
$return = ", user_avatar = '" . str_replace("\'", "''", $avatar_filename) . "', user_avatar_type = " . USER_AVATAR_GALLERY;
}
else
{
$return = '';
}
return $return;
}

function user_avatar_url($mode, &$error, &$error_msg, $avatar_filename)
{
if ( !preg_match('#^(http)|(ftp):\/\/#i', $avatar_filename) )
{
$avatar_filename = 'http://' . $avatar_filename;
}

if ( !preg_match('#^((http)|(ftp):\/\/[\w\-]+?\.([\w\-]+\.)+[\w]+(0-9]+)*\/.*?\.(gif|jpg|jpeg|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;
}

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

}

function user_avatar_upload($mode, $avatar_mode, &$current_avatar, &$current_type, &$error, &$error_msg, $avatar_filename, $avatar_realname, $avatar_filesize, $avatar_filetype)
{
global $board_config, $db, $lang;

$ini_val = ( @phpversion() >= '4.0.0' ) ? 'ini_get' : 'get_cfg_var';

if ( $avatar_mode == 'remote' && preg_match('/^(http:\/\/)?([\w\-\.]+)\:?([0-9]*)\/(.*)$/', $avatar_filename, $url_ary) )
{
if ( empty($url_ary[4]) )
{
$error = true;
$error_msg = ( !empty($error_msg) ) ? $error_msg . '<br />' . $lang['Incomplete_URL'] : $lang['Incomplete_URL'];
return;
}

$base_get = '/' . $url_ary[4];
$port = ( !empty($url_ary[3]) ) ? $url_ary[3] : 80;

if ( !($fsock = @fsockopen($url_ary[2], $port, $errno, $errstr)) )
{
$error = true;
$error_msg = ( !empty($error_msg) ) ? $error_msg . '<br />' . $lang['No_connection_URL'] : $lang['No_connection_URL'];
return;
}

@fputs($fsock, "GET $base_get HTTP/1.1\r\n&quot;
@fputs($fsock, "HOST: " . $url_ary[2] . "\r\n&quot;
@fputs($fsock, "Connection: close\r\n\r\n&quot;

unset($avatar_data);
while( !@feof($fsock) )
{
$avatar_data .= @fread($fsock, $board_config['avatar_filesize']);
}
@fclose($fsock);

if (!preg_match('#Content-Length\: ([0-9]+)[^ /][\s]+#i', $avatar_data, $file_data1) || !preg_match('#Content-Type\: image/[x\-]*([a-z]+)[\s]+#i', $avatar_data, $file_data2))
{
$error = true;
$error_msg = ( !empty($error_msg) ) ? $error_msg . '<br />' . $lang['File_no_data'] : $lang['File_no_data'];
return;
}

$avatar_filesize = $file_data1[1];
$avatar_filetype = $file_data2[1];

if ( !$error && $avatar_filesize > 0 && $avatar_filesize < $board_config['avatar_filesize'] )
{
$avatar_data = substr($avatar_data, strlen($avatar_data) - $avatar_filesize, $avatar_filesize);

$tmp_path = ( !@$ini_val('safe_mode') ) ? '/tmp' : './' . $board_config['avatar_path'] . '/tmp';
$tmp_filename = tempnam($tmp_path, uniqid(rand()) . '-');

$fptr = @fopen($tmp_filename, 'wb');
$bytes_written = @fwrite($fptr, $avatar_data, $avatar_filesize);
@fclose($fptr);

if ( $bytes_written != $avatar_filesize )
{
@unlink($tmp_filename);
message_die(GENERAL_ERROR, 'Could not write avatar file to local storage. Please contact the board administrator with this message', '', __LINE__, __FILE__);
}

list($width, $height) = @getimagesize($tmp_filename);
}
else
{
$l_avatar_size = sprintf($lang['Avatar_filesize'], round($board_config['avatar_filesize'] / 1024));

$error = true;
$error_msg = ( !empty($error_msg) ) ? $error_msg . '<br />' . $l_avatar_size : $l_avatar_size;
}
}
else if ( ( file_exists(@phpbb_realpath($avatar_filename)) ) && preg_match('/\.(jpg|jpeg|gif|png)$/i', $avatar_realname) )
{
if ( $avatar_filesize <= $board_config['avatar_filesize'] && $avatar_filesize > 0 )
{
preg_match('#image\/[x\-]*([a-z]+)#', $avatar_filetype, $avatar_filetype);
$avatar_filetype = $avatar_filetype[1];
}
else
{
$l_avatar_size = sprintf($lang['Avatar_filesize'], round($board_config['avatar_filesize'] / 1024));

$error = true;
$error_msg = ( !empty($error_msg) ) ? $error_msg . '<br />' . $l_avatar_size : $l_avatar_size;
return;
}

list($width, $height) = @getimagesize($avatar_filename);
}

if ( !($imgtype = check_image_type($avatar_filetype, $error, $error_msg)) )
{
return;
}

if ( $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 != '' )
{
if ( file_exists(@phpbb_realpath('./' . $board_config['avatar_path'] . '/' . $current_avatar)) )
{
@unlink('./' . $board_config['avatar_path'] . '/' . $current_avatar);
}
}

if( $avatar_mode == 'remote' )
{
@copy($tmp_filename, './' . $board_config['avatar_path'] . "/$new_filename&quot;
@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';
}

$move_file($avatar_filename, './' . $board_config['avatar_path'] . "/$new_filename&quot;
}

@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;
}

function display_avatar_gallery($mode, &$category, &$user_id, &$email, &$current_email, &$coppa, &$username, &$email, &$new_password, &$cur_password, &$password_confirm, &$icq, &$aim, &$msn, &$yim, &$website, &$location, &$occupation, &$interests, &$signature, &$viewemail, &$notifypm, &$popup_pm, &$notifyreply, &$attachsig, &$allowhtml, &$allowbbcode, &$allowsmilies, &$hideonline, &$style, &$language, &$timezone, &$dateformat, &$session_id)
{
global $board_config, $db, $template, $lang, $images, $theme;
global $phpbb_root_path, $phpEx;

$dir = @opendir($board_config['avatar_gallery_path']);

$avatar_images = array();
while( $file = @readdir($dir) )
{
if( $file != '.' && $file != '..' && !is_file($board_config['avatar_gallery_path'] . '/' . $file) && !is_link($board_config['avatar_gallery_path'] . '/' . $file) )
{
$sub_dir = @opendir($board_config['avatar_gallery_path'] . '/' . $file);

$avatar_row_count = 0;
$avatar_col_count = 0;
while( $sub_file = @readdir($sub_dir) )
{
if( preg_match('/(\.gif$|\.png$|\.jpg|\.jpeg)$/is', $sub_file) )
{
$avatar_images[$file][$avatar_row_count][$avatar_col_count] = $file . '/' . $sub_file;
$avatar_name[$file][$avatar_row_count][$avatar_col_count] = ucfirst(str_replace("_", " ", preg_replace('/^(.*)\..*$/', '\1', $sub_file)));

$avatar_col_count++;
if( $avatar_col_count == 5 )
{
$avatar_row_count++;
$avatar_col_count = 0;
}
}
}
}
}

@closedir($dir);

@ksort($avatar_images);
@reset($avatar_images);

if( empty($category) )
{
list($category, ) = each($avatar_images);
}
@reset($avatar_images);

$s_categories = '<select name="avatarcategory">';
while( list($key) = each($avatar_images) )
{
$selected = ( $key == $category ) ? ' selected="selected"' : '';
if( count($avatar_images[$key]) )
{
$s_categories .= '<option value="' . $key . '"' . $selected . '>' . ucfirst($key) . '</option>';
}
}
$s_categories .= '</select>';

$s_colspan = 0;
for($i = 0; $i < count($avatar_images[$category]); $i++)
{
$template->assign_block_vars("avatar_row", array());

$s_colspan = max($s_colspan, count($avatar_images[$category][$i]));

for($j = 0; $j < count($avatar_images[$category][$i]); $j++)
{
$template->assign_block_vars('avatar_row.avatar_column', array(
"AVATAR_IMAGE" => $board_config['avatar_gallery_path'] . '/' . $avatar_images[$category][$i][$j],
"AVATAR_NAME" => $avatar_name[$category][$i][$j])
);

$template->assign_block_vars('avatar_row.avatar_option_column', array(
"S_OPTIONS_AVATAR" => $avatar_images[$category][$i][$j])
);
}
}

$params = array('coppa', 'user_id', 'username', 'email', 'current_email', 'cur_password', 'new_password', 'password_confirm', 'icq', 'aim', 'msn', 'yim', 'website', 'location', 'occupation', 'interests', 'signature', 'viewemail', 'notifypm', 'popup_pm', 'notifyreply', 'attachsig', 'allowhtml', 'allowbbcode', 'allowsmilies', 'hideonline', 'style', 'language', 'timezone', 'dateformat');

$s_hidden_vars = '<input type="hidden" name="sid" value="' . $session_id . '" /><input type="hidden" name="agreed" value="true" />';

for($i = 0; $i < count($params); $i++)
{
$s_hidden_vars .= '<input type="hidden" name="' . $params[$i] . '" value="' . str_replace('"', '&quot;', $$params[$i]) . '" />';
}

$template->assign_vars(array(
'L_AVATAR_GALLERY' => $lang['Avatar_gallery'],
'L_SELECT_AVATAR' => $lang['Select_avatar'],
'L_RETURN_PROFILE' => $lang['Return_profile'],
'L_CATEGORY' => $lang['Select_category'],

'S_CATEGORY_SELECT' => $s_categories,
'S_COLSPAN' => $s_colspan,
'S_PROFILE_ACTION' => append_sid("profile.$phpEx?mode=$mode&quot,
'S_HIDDEN_FIELDS' => $s_hidden_vars)
);

return;
}

?>




alguien sabe que tengo que modificar para que no me diga que el avatar debe ser jpg, gif o png?

gracias de antemano....
ask123
Usuario habitual
Usuario habitual

Me aparece esto:

Parse error: parse error, unexpected '(', expecting ')' in /home/webcindario/siemensc56/forum/includes/usercp_avatar.php on line 105

Que habre hecho mal?

Avatar Image
User 390661
@man / @woman
@man / @woman

Muchas de las funciones que usa ese script estan deshabilitadas fsockopen, getimagesize, etc.
Alguien que le entienda bien a ese código quiza pueda modificarlo, de otro modo no funcionará.

Avatar Image
Usuario Novato
Usuario Novato

Ola mira veran e subio un foro por phpbb y resulta k e estao leyendo todo estoi pero no veo na pa modificar no se si me podran ayudar miren esto eslo k sale.
<?php
/***************************************************************************
* usercp_avatar.php
* -------------------
* begin : Saturday, Feb 13, 2001
* copyright : (C) 2001 The phpBB Group
* email : support@phpbb.com
*
* $Id: usercp_avatar.php,v 1.8.2.19 2005/02/21 18:37:51 acydburn Exp $
*
*
***************************************************************************/

/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
*
***************************************************************************/

function check_image_type(&$type, &$error, &$error_msg)
{
global $lang;

switch( $type )
{
case 'jpeg':
case 'pjpeg':
case 'jpg':
return '.jpg';
break;
case 'gif':
return '.gif';
break;
case 'png':
return '.png';
break;
default:
$error = true;
$error_msg = (!empty($error_msg)) ? $error_msg . '<br />' . $lang['Avatar_filetype'] : $lang['Avatar_filetype'];
break;
}

return false;
}

function user_avatar_delete($avatar_type, $avatar_file)
{
global $board_config, $userdata;

$avatar_file = basename($avatar_file);
if ( $avatar_type == USER_AVATAR_UPLOAD && $avatar_file != '' )
{
if ( @file_exists(@phpbb_realpath('./' . $board_config['avatar_path'] . '/' . $avatar_file)) )
{
@unlink('./' . $board_config['avatar_path'] . '/' . $avatar_file);
}
}

return ", user_avatar = '', user_avatar_type = " . USER_AVATAR_NONE;
}

function user_avatar_gallery($mode, &$error, &$error_msg, $avatar_filename)
{
global $board_config;

$avatar_filename = str_replace(array('../', '..\\', './', '.\\'), '', $avatar_filename);
if ($avatar_filename{0} == '/' || $avatar_filename{0} == "\\&quotGiño
{
return '';
}

if ( file_exists(@phpbb_realpath($board_config['avatar_gallery_path'] . '/' . $avatar_filename)) && ($mode == 'editprofile') )
{
$return = ", user_avatar = '" . str_replace("\'", "''", $avatar_filename) . "', user_avatar_type = " . USER_AVATAR_GALLERY;
}
else
{
$return = '';
}
return $return;
}

function user_avatar_url($mode, &$error, &$error_msg, $avatar_filename)
{
if ( !preg_match('#^(http)|(ftp):\/\/#i', $avatar_filename) )
{
$avatar_filename = 'http://' . $avatar_filename;
}

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

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

}

function user_avatar_upload($mode, $avatar_mode, &$current_avatar, &$current_type, &$error, &$error_msg, $avatar_filename, $avatar_realname, $avatar_filesize, $avatar_filetype)
{
global $board_config, $db, $lang;

$ini_val = ( @phpversion() >= '4.0.0' ) ? 'ini_get' : 'get_cfg_var';

if ( $avatar_mode == 'remote' && preg_match('/^(http:\/\/)?([\w\-\.]+)\:?([0-9]*)\/(.*)$/', $avatar_filename, $url_ary) )
{
if ( empty($url_ary[4]) )
{
$error = true;
$error_msg = ( !empty($error_msg) ) ? $error_msg . '<br />' . $lang['Incomplete_URL'] : $lang['Incomplete_URL'];
return;
}

$base_get = '/' . $url_ary[4];
$port = ( !empty($url_ary[3]) ) ? $url_ary[3] : 80;

if ( !($fsock = @fsockopen($url_ary[2], $port, $errno, $errstr)) )
{
$error = true;
$error_msg = ( !empty($error_msg) ) ? $error_msg . '<br />' . $lang['No_connection_URL'] : $lang['No_connection_URL'];
return;
}

@fputs($fsock, "GET $base_get HTTP/1.1\r\n&quotGiño;
@fputs($fsock, "HOST: " . $url_ary[2] . "\r\n&quotGiño;
@fputs($fsock, "Connection: close\r\n\r\n&quotGiño;

unset($avatar_data);
while( !@feof($fsock) )
{
$avatar_data .= @fread($fsock, $board_config['avatar_filesize']);
}
@fclose($fsock);

if (!preg_match('#Content-Length\: ([0-9]+)[^ /][\s]+#i', $avatar_data, $file_data1) || !preg_match('#Content-Type\: image/[x\-]*([a-z]+)[\s]+#i', $avatar_data, $file_data2))
{
$error = true;
$error_msg = ( !empty($error_msg) ) ? $error_msg . '<br />' . $lang['File_no_data'] : $lang['File_no_data'];
return;
}

$avatar_filesize = $file_data1[1];
$avatar_filetype = $file_data2[1];

if ( !$error && $avatar_filesize > 0 && $avatar_filesize < $board_config['avatar_filesize'] )
{
$avatar_data = substr($avatar_data, strlen($avatar_data) - $avatar_filesize, $avatar_filesize);

$tmp_path = ( !@$ini_val('safe_mode') ) ? '/tmp' : './' . $board_config['avatar_path'] . '/tmp';
$tmp_filename = tempnam($tmp_path, uniqid(rand()) . '-');

$fptr = @fopen($tmp_filename, 'wb');
$bytes_written = @fwrite($fptr, $avatar_data, $avatar_filesize);
@fclose($fptr);

if ( $bytes_written != $avatar_filesize )
{
@unlink($tmp_filename);
message_die(GENERAL_ERROR, 'Could not write avatar file to local storage. Please contact the board administrator with this message', '', __LINE__, __FILE__);
}

list($width, $height) = @getimagesize($tmp_filename);
}
else
{
$l_avatar_size = sprintf($lang['Avatar_filesize'], round($board_config['avatar_filesize'] / 1024));

$error = true;
$error_msg = ( !empty($error_msg) ) ? $error_msg . '<br />' . $l_avatar_size : $l_avatar_size;
}
}
else if ( ( file_exists(@phpbb_realpath($avatar_filename)) ) && preg_match('/\.(jpg|jpeg|gif|png)$/i', $avatar_realname) )
{
if ( $avatar_filesize <= $board_config['avatar_filesize'] && $avatar_filesize > 0 )
{
preg_match('#image\/[x\-]*([a-z]+)#', $avatar_filetype, $avatar_filetype);
$avatar_filetype = $avatar_filetype[1];
}
else
{
$l_avatar_size = sprintf($lang['Avatar_filesize'], round($board_config['avatar_filesize'] / 1024));

$error = true;
$error_msg = ( !empty($error_msg) ) ? $error_msg . '<br />' . $l_avatar_size : $l_avatar_size;
return;
}

list($width, $height) = @getimagesize($avatar_filename);
}

if ( !($imgtype = check_image_type($avatar_filetype, $error, $error_msg)) )
{
return;
}

if ( $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 != '' )
{
if ( file_exists(@phpbb_realpath('./' . $board_config['avatar_path'] . '/' . $current_avatar)) )
{
@unlink('./' . $board_config['avatar_path'] . '/' . $current_avatar);
}
}

if( $avatar_mode == 'remote' )
{
@copy($tmp_filename, './' . $board_config['avatar_path'] . "/$new_filename&quotGiño;
@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&quotGiño;
}

@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;
}

function display_avatar_gallery($mode, &$category, &$user_id, &$email, &$current_email, &$coppa, &$username, &$email, &$new_password, &$cur_password, &$password_confirm, &$icq, &$aim, &$msn, &$yim, &$website, &$location, &$occupation, &$interests, &$signature, &$viewemail, &$notifypm, &$popup_pm, &$notifyreply, &$attachsig, &$allowhtml, &$allowbbcode, &$allowsmilies, &$hideonline, &$style, &$language, &$timezone, &$dateformat, &$session_id)
{
global $board_config, $db, $template, $lang, $images, $theme;
global $phpbb_root_path, $phpEx;

$dir = @opendir($board_config['avatar_gallery_path']);

$avatar_images = array();
while( $file = @readdir($dir) )
{
if( $file != '.' && $file != '..' && !is_file($board_config['avatar_gallery_path'] . '/' . $file) && !is_link($board_config['avatar_gallery_path'] . '/' . $file) )
{
$sub_dir = @opendir($board_config['avatar_gallery_path'] . '/' . $file);

$avatar_row_count = 0;
$avatar_col_count = 0;
while( $sub_file = @readdir($sub_dir) )
{
if( preg_match('/(\.gif$|\.png$|\.jpg|\.jpeg)$/is', $sub_file) )
{
$avatar_images[$file][$avatar_row_count][$avatar_col_count] = $file . '/' . $sub_file;
$avatar_name[$file][$avatar_row_count][$avatar_col_count] = ucfirst(str_replace("_", " ", preg_replace('/^(.*)\..*$/', '\1', $sub_file)));

$avatar_col_count++;
if( $avatar_col_count == 5 )
{
$avatar_row_count++;
$avatar_col_count = 0;
}
}
}
}
}

@closedir($dir);

@ksort($avatar_images);
@reset($avatar_images);

if( empty($category) )
{
list($category, ) = each($avatar_images);
}
@reset($avatar_images);

$s_categories = '<select name="avatarcategory">';
while( list($key) = each($avatar_images) )
{
$selected = ( $key == $category ) ? ' selected="selected"' : '';
if( count($avatar_images[$key]) )
{
$s_categories .= '<option value="' . $key . '"' . $selected . '>' . ucfirst($key) . '</option>';
}
}
$s_categories .= '</select>';

$s_colspan = 0;
for($i = 0; $i < count($avatar_images[$category]); $i++)
{
$template->assign_block_vars("avatar_row", array());

$s_colspan = max($s_colspan, count($avatar_images[$category][$i]));

for($j = 0; $j < count($avatar_images[$category][$i]); $j++)
{
$template->assign_block_vars('avatar_row.avatar_column', array(
"AVATAR_IMAGE" => $board_config['avatar_gallery_path'] . '/' . $avatar_images[$category][$i][$j],
"AVATAR_NAME" => $avatar_name[$category][$i][$j])
);

$template->assign_block_vars('avatar_row.avatar_option_column', array(
"S_OPTIONS_AVATAR" => $avatar_images[$category][$i][$j])
);
}
}

$params = array('coppa', 'user_id', 'username', 'email', 'current_email', 'cur_password', 'new_password', 'password_confirm', 'icq', 'aim', 'msn', 'yim', 'website', 'location', 'occupation', 'interests', 'signature', 'viewemail', 'notifypm', 'popup_pm', 'notifyreply', 'attachsig', 'allowhtml', 'allowbbcode', 'allowsmilies', 'hideonline', 'style', 'language', 'timezone', 'dateformat');

$s_hidden_vars = '<input type="hidden" name="sid" value="' . $session_id . '" /><input type="hidden" name="agreed" value="true" />';

for($i = 0; $i < count($params); $i++)
{
$s_hidden_vars .= '<input type="hidden" name="' . $params[$i] . '" value="' . str_replace('"', '&quot;', $$params[$i]) . '" />';
}

$template->assign_vars(array(
'L_AVATAR_GALLERY' => $lang['Avatar_gallery'],
'L_SELECT_AVATAR' => $lang['Select_avatar'],
'L_RETURN_PROFILE' => $lang['Return_profile'],
'L_CATEGORY' => $lang['Select_category'],

'S_CATEGORY_SELECT' => $s_categories,
'S_COLSPAN' => $s_colspan,
'S_PROFILE_ACTION' => append_sid("profile.$phpEx?mode=$mode&quotGiño,
'S_HIDDEN_FIELDS' => $s_hidden_vars)
);

return;
}

?>


Aver si me pueden ayudarlo mas pronto posible por favor contesten lo antes posibleRebotadoloco

Avatar Image
Usuario Novato
Usuario Novato

A mi me da este problema

Warning: move_uploaded_file(): open_basedir restriction in effect. File(/home/webcindario/Beti-Stadio/phpBB2/ /tmp/phpvVrcFd) is not within the allowed path(s): (/home/webcindario/beti-stadio) in /home/webcindario/beti-stadio/phpBB2/includes/usercp_avatar.php on line 110

La linea 110 es:

if ($avatar_mode == 'local') {

move_uploaded_file($avatar_filename,'/home/webcindario/Beti-Stadio/phpBB2'.$avatar_filename);
$avatar_filename = '/home/webcindario/Beti-Stadio/phpBB2'.$avatar_filename;

}

$tmp_path = '/home/webcindario/Beti-Stadio/phpBB2/tmp';

Yo veo bien lo que puse, haber si me podeis ayudar

34 Mensajes
12
ATENCIÓN: Este tema no tiene actividad desde hace más de 6 MESES,
te recomendamos abrir un nuevo tema en lugar de responder al actual
Opciones:
Ir al subforo:
Permisos:
TU NO PUEDES Escribir nuevos temas
TU NO PUEDES Responder a los temas
TU NO PUEDES Editar tus propios mensajes
TU NO PUEDES Borrar tus propios mensajes
Temas similares
TemaUsuariosRespuestasVisitasActividad
Por: , el 06/Sep/2003, 08:58
loreienjacme Dzacab creatormix2937Sep/03
Por: , el 21/Mar/2006, 21:01
FOROS_LC User 74154612kMar/06
Por: , el 14/Dic/2010, 01:42
al3m4n02kDec/10
Por: , el 08/Ene/2007, 13:14
sergi_v NoSetup.org12kJan/07
Por: , el 14/Feb/2006, 02:30
MaLaTiTo NoSetup.org12kFeb/06