Login
Username: Password:
Remember me

[Sign Up] / [Recover Password]

Theme / Language

Popular
New Torrents
new name
Size: 18.40 MB
Most active
new name
S: 74 L: 3
New Posters
User Posts

Go to Profile

ADAPTED TO V2.8

LANGUAGE.PHP

[spoiler]


$LANG["IMAGE_AVATAR"] = "Image";

$LANG["TXT_AVATAR"] = "<b>Do not upload unauthorized or illegal pictures</b>.<br>You avatar will be automatically resized to <b>80x80</b>px.<br>Maximum file size must be <b>500</b>kb.";



/// START UPLOAD AVATAR ///

define("UP_AVATAR", "Upload Avatar");

define("AVATAR_LINC", "Link to your avatar image");

define("NO_AVATAR", "<font color=red><b>Error</b></font><br><br> You have not specified a avatar file! <br><br> Back to ");

define("AVATAR_OK", "You have successfull updated your avatar! <br><br>Back to ");

/// END UPLOAD AVATAR ///



?>

[/spoiler]





ACCOUNT.PHP



[spoiler]


/// START UPLOAD AVATAR ///

if ($site_config['AVATARUPLOAD']){

   $avatar = htmlspecialchars($CURUSER["avatar"]);

   if (!$avatar)

       $avatar = "".$site_config["SITEURL"]."/images/default_avatar.gif";



   print("<tr><td align=right class=table_col2><B>" . AVATAR . ":</b></td><td align=left class=table_col1><table border=0><tr><td rowspan=2 width=90><img src=$avatar></td><td><input name=avatar size=50 value="" . htmlspecialchars($CURUSER["avatar"]) . ""><br />n<i>" . AVATAR_LINC . ": 80x80px</i></td></tr><tr><td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[ <a href=upavatar.php?action=upload><b>" . UP_AVATAR . "</b></a> ]</td></tr></table></td></tr>");

}

else{

print("<TR><TD align=right class=table_col2><B>" . AVATAR_URL . ":</b> </td><TD align=left class=table_col2><input name=avatar size=50 value="" . htmlspecialchars($CURUSER["avatar"]) . ""><br />n<i>" . AVATAR_LINC . ": 80x80px</i></td></tr>");

}

/// END UPLOAD AVATAR ///


[/spoiler]





UPAVATAR.PHP



[spoiler]


<?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 = 768000;



   if ($_FILES[avatar]['size'] > $max_avatar_size)

   show_error_msg("Invalid file size!", "Image must be less than " . mksize($max_avatar_size),1);



   if (preg_match('/^(.+).(jpg|gif|png|jpeg)$/si', $_FILES[avatar]['name'])){

   define("MAX_WIDTH", 90);   // Define width sizes what you want.

   define("MAX_HEIGHT", 90);  // Define height sizes what you want.

   $avatar_dir = "".str_replace("","/",getcwd())."".$site_config['avatar_dir']."";

   $avatar_url = "".$site_config['SITEURL']."".$site_config['avatar_dir']."";

   $type = strtolower(end(explode('.', $_FILES[avatar]['name'])));



   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' OR $type == 'jpeg'){

   $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(T_("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(T_("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(T_("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(T_("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>Reinstal 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(T_("UP_AVATAR"));

begin_frame(T_("UP_AVATAR"), center);



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>");

   }

}



if ($action == "upload") {

   print ("<form method=post action=?action=post enctype=multipart/form-data><table width=550 border=0><tr><td>". T_("IMAGE_AVATAR") ."</td><td><input type=file name=avatar size=60></td></tr><tr><td>". DISCLAIMER .":</td><td><table width=99%><td>" . T_("TXT_AVATAR") . "</td><td align=right colspan=4><input type=submit class=btn name=Submit value=".UPLOAD." class=btn></td></table></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 (T_("ERROR"), "<p><font color=red>Avatar uploading, disabled by site admin !</font></p>");

}



end_frame();

stdfoot();

?>

[/spoiler]
Users online

No users online

Search



Statistics

    Torrents

  • Tracking: 3
  • Todays torrents: 0
  • Seeders: 0
  • Leechers: 0
  • Peers: 0
  • Downloaded: 89.96 GB
  • Uploaded: 9.86 GB

  • Members

  • We have: 838
  • New today: 0
  • Guest today: 9

  • Online

  • Total online: 1
  • Members: 0
  • Guests online: 1
  • Comments: 3
  • Messages: 1,728