"MicroMonkey, post: 94074":well . Thats odd lol. I will try that then. Now im completely confused

"MicroMonkey, post: 94067":I had some trouble with this also, and it was user permissions. www-data has the apache2 permissions while a user not in that group would not be able to write to the file. Its a mess lol. Im still having troubles on my end with group permissions on my ubuntu server
"MicroMonkey, post: 94067":I had some trouble with this also, and it was user permissions. www-data has the apache2 permissions while a user not in that group would not be able to write to the file. Its a mess lol. Im still having troubles on my end with group permissions on my ubuntu server
still do not understand why it behaves that way, it is supposed to work as a host 
I have windows "MicroMonkey, post: 94064":hmm. Make sure avatars directory is chmod 777. Here is my entire upavatar.php
<?php
////////////////////////////////////////
// TorrentTrader v2.x
// http://www.torrenttrader.org
//
// Upload Avatar
// Author: Skayver
//
// Date: 13/11/2007
///////////////////////////////////////
require_once ("backend/functions.php");
dbconn();
loggedinonly();
$action = $_REQUEST["action"];
if ($site_config['AVATARUPLOAD']){
if (!($_FILES[avatar]['name'] == "")) {
$max_avatar_size = $site_config['avatar_max_filesize'];
if ($_FILES[avatar]['size'] > $max_avatar_size)
show_error_msg("Invalid file size!", "Image must be less than " . mksize($site_config['avatar_max_filesize']),1);
if (preg_match('/^(.+)\.(jpg|gif|png)$/si', $_FILES[avatar]['name'])){
define("MAX_WIDTH", 80); // Define width sizes what you want.
define("MAX_HEIGHT", 80); // Define height sizes what you want.
$avatar_dir = "".str_replace("\\","/",getcwd())."".$site_config['avatar_dir']."";
$avatar_url = "".$site_config['SITEURL']."".$site_config['avatar_dir']."";
$shit = explode('.', $_FILES[avatar]['name']);
$type = strtolower(end($shit));
if (extension_loaded('gd')){
$gdinfo = gd_info();
list($width, $height) = getimagesize($_FILES[avatar]['tmp_name']);
$scale = min(MAX_WIDTH/$width, MAX_HEIGHT/$height);
if ($scale < 1) {
$n_w = floor($scale*$width);
$n_h = floor($scale*$height);
}
else{
$n_w = $width;
$n_h = $height;
}
$tmp_image = imagecreatetruecolor($n_w, $n_h);
if ($type == 'png' OR $type == 'gif' OR $type == 'jpg'){
$avatar = $CURUSER[id] . "." . $type;
if (($type == 'jpg' OR $type == 'jpeg') AND ($gdinfo['JPG Support'] OR $gdinfo['JPEG Support']) ){
$nimage = imagecreatefromjpeg($_FILES[avatar]['tmp_name']);
imagecopyresampled($tmp_image, $nimage, 0, 0, 0, 0, $n_w, $n_h, $width, $height);
if (!imagejpeg($tmp_image, $avatar_dir . "/" . $avatar))
show_error_msg("Error", "Error, uploading JPG files type. <br>Maybe your GD library not support JPG",1);
}
if ($type == 'gif' and $gdinfo['GIF Create Support']){
if ($scale < 1) {
$nimage = imagecreatefromgif($_FILES[avatar]['tmp_name']);
imagecopyresampled($tmp_image, $nimage, 0, 0, 0, 0, $n_w, $n_h, $width, $height);
if (!imagegif($tmp_image, $avatar_dir . "/" . $avatar))
show_error_msg("Error", "Error, uploading GIF files type. <br>Maybe your GD library not support GIF Create",1);
}
else{
if (!move_uploaded_file($_FILES[avatar]['tmp_name'], $avatar_dir . "/" . $avatar))
show_error_msg("Error", "Error, moving uploaded GIF file.",1);
}
}
if ($type == 'png' and $gdinfo['PNG Support'] == 1 ){
$nimage = imagecreatefrompng($_FILES[avatar]['tmp_name']);
imagecopyresampled($tmp_image, $nimage, 0, 0, 0, 0, $n_w, $n_h, $width, $height);
if (!imagepng($tmp_image, $avatar_dir . "/" . $avatar))
show_error_msg("Error", "Error, uploading PNG files type. <br>Maybe your GD library not support PNG",1);
}
SQL_Query_exec("UPDATE users SET avatar = '$avatar_url/$avatar' WHERE username = '$CURUSER[username]'");
}
}
else { show_error_msg("PHP - Error", "PHP on your server, not support GD library. <br>Reinstall your PHP with support GD",1); }
}
else {
write_log("<b>HACKING ATTEMPT !!! </b>- User <B>" . $CURUSER["username"] . "</B> try to upload avatar file: <B>" . $_FILES[avatar]["name"] . "</B>");
show_error_msg("Invalid type", "Is not allowed type file: (" . $_FILES[avatar]["name"] .")",1);
}
}
stdhead("Upload Avatar");
begin_frame("" . T_("UP_AVATAR") . "");
if ($action == "post") {
if (empty($_FILES[avatar]['tmp_name'])){
print ("<br><p><center>" . T_("NO_AVATAR") . "<a href=upavatar.php?action=upload><b>" . T_("UP_AVATAR") . "</b></a></center></p>");
}
else{
print ("<br><p><center>" . T_("AVATAR_OK") . "<a href=account.php?action=edit_settings&do=edit><b>" . T_("ACCOUNT") . "</b></a></center></p>");
autolink("account.php?action=edit_settings&do=edit", "" . T_("AVATAR_OK") . "");
}
}
if ($action == "upload") {
print ("<form method=post action=?action=post enctype=multipart/form-data><table align=center width=550 border=1 cellpadding=5><tr><td align=right>". T_("AVATAR_FILE") ." :</td><td><input type=file name=avatar size=60></td></tr><tr><td align=right>". T_("DISCLAIMER") ." :</td><td>". T_("AVATAR_TXT") ."".mksize($site_config['avatar_max_filesize'])."</td></tr><tr><td colspan=2 align=center><input type=submit name=Submit value='".T_("UP_AVATAR")."' class=btn></td></td></tr></table></form>");
//print ("<form method=post action=?action=post enctype=multipart/form-data><table align=center width=550 border=1 cellpadding=5><tr><td class=table_col1 align=right>". T_("AVATAR_FILE") ." :</td><td class=table_col1><input type=file name=avatar size=60></td></tr><tr><td class=table_col1 align=right>". T_("DISCLAIMER") ." :</td><td class=table_col1>". T_("AVATAR_TXT") ."</td></tr><tr><td class=table_col2 colspan=2 align=center><input type=submit name=Submit value='".T_("UP_AVATAR")."' class=btn></td></td></tr></table></form>");
}
if (!$action == "post" OR !$action == "upload") {
write_log("<b>HACKING ATTEMPT !!! </b>- User <b>" . $CURUSER["username"] . "</b> tries to direct access to upavatar.php");
print ("<br><p><center><b>Direct access not allowed !!!</b></p><p>Go to: <a href=account.php?action=edit_settings&do=edit><b>" . T_("ACCOUNT") . "</b></a></center></p><br>");
}
}
else{
stdhead("ERROR !");
write_log("<b>HACKING ATTEMPT !!! </b>- User <b>" . $CURUSER["username"] . "</b> tries to upload avatar !");
show_error_msg ("Error", "<p><font color=red>Avatar uploading, disabled bay site admin !</font></p>");
}
end_frame();
stdfoot();
?>
"MicroMonkey, post: 94062":try this. replace your lines 28 to 34
if (preg_match('/^(.+)\.(jpg|gif|png)$/si', $_FILES[avatar]['name'])){
define("MAX_WIDTH", 100); // Define width sizes what you want.
define("MAX_HEIGHT", 100); // Define height sizes what you want.
$avatar_dir = "".str_replace("\\","/",getcwd())."".$site_config['avatar_dir']."";
$avatar_url = "".$site_config['SITEURL']."".$site_config['avatar_dir']."";
$tmp = explode('.', $_FILES[avatar]['name']);
$type = strtolower(end($tmp));
"MicroMonkey, post: 94051":Check line 30 and 31 (or whatever number it is, but it looks like this) in upavatar.php. I didnt test this, but I will later, but it seems logical to me. The VAR $type had multiple references, and that dont work in flash, so I assume it wouldnt work here. I used shit in case tmp was used somewhere else. I didnt feel like looking for it lol
$shit = explode('.', $_FILES[avatar]['name']);
$type = strtolower(end($shit));


"UFFENO1, post: 94049":I tried this and for me it works. Do you get any SQL-Error?
I got this error:
Database Error in carroussel.php on line 217: Unknown column 'safe' in 'where clause'. Query was: SELECT id, name, image1 , seeders,leechers, category, size FROM torrents WHERE banned ='no' AND visible='yes' AND safe='yes' AND image1 <> '' ORDER BY added DESC limit 45.
I change this:
$query="SELECT id, name, image1 , seeders, leechers, category, size FROM torrents WHERE banned ='no' AND visible='yes' AND safe='yes' AND image1 <> '' ORDER BY added DESC limit 45";
to this:
$query="SELECT id, name, image1 , seeders, leechers, category, size FROM torrents WHERE banned ='no' AND visible='yes' AND image1 <> '' ORDER BY added DESC limit 45";
"MicroMonkey, post: 94047":Just a guess, but maybe by being localhost is what is causing the "direct access not allowed" error. I run the tracker on a different machine than the one I am on, so I have never seen that error. You could also remove that line of code in upavatar.php and see if that helps you at least trouble shoot the problem.
if (!$action == "post" OR !$action == "upload") {
write_log("<b>HACKING ATTEMPT !!! </b>- User <b>" . $CURUSER["username"] . "</b> tries to direct access to upavatar.php");
print ("<br><p><center><b>Direct access not allowed !!!</b></p><p>Go to: <a href=account.php?action=edit_settings&do=edit><b>" . T_("ACCOUNT") . "</b></a></center></p><br>");
}
not sure if it helps anyone, but below is all the code I have.
in config.php
/// START UPLOAD AVATAR ///
$site_config['AVATARUPLOAD'] = true; // Enable / Disable upload avatar
$site_config['avatar_dir'] = '/avatars'; // Dir where will be stored avatars
also in config.php
// Image upload settings
$site_config['image_max_filesize'] = 20971520;
$site_config['avatar_max_filesize'] = 11010000; // Max uploaded image size in bytes (Default: 512 kB)
$site_config['allowed_image_types'] = array(
// "mimetype" => ".ext",
"image/gif" => ".gif",
"image/pjpeg" => ".jpg",
"image/jpeg" => ".jpg",
"image/jpg" => ".jpg",
"image/png" => ".png"
);
in account.php
/// START UPLOAD AVATAR ///
if ($site_config['AVATARUPLOAD']){
$avatar = htmlspecialchars($CURUSER["avatar"]);
if (!$avatar)
$avatar = "".$site_config["SITEURL"]."/images/default_avatar.png";
print("<tr><td align='right' class='table_col1'><b>" . T_("AVATAR") . ":</b></td><td align='left' ><table class='table_col1' border='0'><tr><td class=table_col1><img src=$avatar hight='40' width='40'></td><td ><input name='avatar' size='50' value=\"" . htmlspecialchars($CURUSER["avatar"]) . "\"><br /><i>" . T_("AVATAR_LINK") . ": 80x80px</i> OR [ <a href=upavatar.php?action=upload><b>" . T_("UP_AVATAR") . "</b></a> ]</td></tr></table></td></tr>");
}
else {
print("<tr><td align='right' class='table_col1'><b>" . T_("AVATAR_UPLOAD") . ":</b> </td><td align='left' class='table_col1'><input type='text' name='avatar' size='50' value=\"" . htmlspecialchars($CURUSER["avatar"]) .
"\" /><br />\n<i>".T_("AVATAR_LINK")."</i><br /></td></tr>");
}
///END UPLOAD AVATAR ///
attached is my upavatar.php
[ATTACH]7289.IPB[/ATTACH]


"UFFENO1, post: 94040":Have you chmod 777 avatars/ ?

"tiloup, post: 94041":Hello,
You must have as such on functions.php ::
//[align=(center|left|right|justify)]text[/align]
$s = preg_replace("/\[align=([a-zA-Z]+)\]((\s|.)+?)\[\/align\]/i","<div style=\"text-align:\\1\">\\2</div>", $s);
// [left]Left[/left]
$s = preg_replace("/\[left\]((\s|.)+?)\[\/left\]/", "<div align=left>\\1</div>", $s);
$s = preg_replace("/\[LEFT\]((\s|.)+?)\[\/LEFT\]/", "<div align=left>\\1</div>", $s);
// [right]Right[/right]
$s = preg_replace("/\[right\]((\s|.)+?)\[\/right\]/", "<div align=right>\\1</div>", $s);
$s = preg_replace("/\[RIGHT\]((\s|.)+?)\[\/RIGHT\]/", "<div align=right>\\1</div>", $s);
//Center
$s = preg_replace("/\[center\]((\s|.)+?)\[\/center\]/", "<center>\\1</center>", $s);
$s = preg_replace("/\[CENTER\]((\s|.)+?)\[\/CENTER\]/", "<center>\\1</center>", $s);
Quote:
$action = $_REQUEST["action"];
"MicroMonkey, post: 94028":nice. I always meant to change that, but now that you posted this, its much easier now lol. Thanks for the edits. Also, adjust your size like this
<img align="center" src="images/banner.jpg" width='800' height='150'>