Bravo List
Register
Go Back   > Bravo List > Source Code > Archived Trackers > TBDev
Reply
Thread Tools
  #1  
Old 25th April 2012, 21:43
H4CKS0R H4CKS0R is offline
Senior Member
 
Join Date: Sep 2008
Posts: 28
Default HELP BY AN Problem please !!!
Hello i have this Problem ...
Can everybody Help me by this ...

Click the image to open in full size.
this is my bittorrent.php
PHP Code:
<?
error_reporting
(E_ALL^E_NOTICE);
ini_set('display_errors',1);
include 
"ctracker.php";

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

function 
maxsysop () {
global 
$CURUSER;
// Check Staff Names
$lmaxclass  19;
$lsysopnames = array("Steckel","newarea","Amun"); // 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'19); // Minumum Staff Level (4= UC_MODERATOR)
if ($CURUSER['class'] >= UC_TECH) {
    
$allowed_ID = array(1,4,21); // 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!");            
        }        
    }
}

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 45 rand(0,900);
$signup_timeout 86400;
$minvotes 1;
$max_dead_torrent_time 2600;
$invites 30000;
$autoclean_interval 30;

// Max users on site
$maxusers 30000;

// ONLY USE ONE OF THE FOLLOWING DEPENDING ON YOUR O/S!!!
$torrent_dir "xtorrents";    # 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://scenerace.in/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://scenerace.in";

// For USER AGREEMENT purpose only!
$DEFAULTBASEURL1 "http://scenerace.in";

////////Site donation email
$DONATEMAIL "costy22it@yahoo.it";

//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 9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999;

// Email for sender/return path.
$SITEEMAIL "no-reply@scenerace.in";

$SITENAME "SceneRace";

$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(
"xxsecrets.php");
require_once(
"xxcleanup.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 ip = $nip") or sqlerr(__FILE____LINE__);
    
//$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 Forbidden");
      print(
"<html><body><h1>403 Forbidden</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 
getrow($id$value$arr)
{
    foreach(
$arr as $row)
    if (
$row[$id] == $value)
        return 
$row;
    return 
false;
}

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

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

    
//header("Content-Type: text/html; charset=utf-8");
    //header("Pragma: No-cache");
    
if ($title == "")
        
$title $SITENAME .(isset($_GET['tbv'])?" (".TBVERSION.")":'');
    else
        
$title $SITENAME .(isset($_GET['tbv'])?" (".TBVERSION.")":''). " :: " htmlspecialchars($title);

    
$_ss = ($CURUSER $CURUSER["stylesheet"] : 4);
    
$res2 mysql_query("SELECT * from stylesheets where id = ".$_ss);
    
$arr2 mysql_fetch_assoc($res2);
    
    
$GLOBALS["ss_uri"] = $arr2["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];
    }

    require_once(
"themes/" $ss_uri "/stdhead.php");
// stdhead

function stdfoot() {
    global 
$CURUSER;
    global 
$ss_uri;
    require_once(
"themes/" $ss_uri "/stdfoot.php");
}

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 
loggedin() {
    global 
$CURUSER;
    if (
$CURUSER) {
        
header("Location: $BASEURL/index.php");
        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 "<class=\"prevpager\"><img src=\"pic/pager/1pxX1.gif\" class=\"prevpager\" width=\"26\" height=\"26\" border=\"0\" alt=\"Prev page\"/></div></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 "<class=\"nextpager\"><img src=\"pic/pager/1pxX1.gif\" class=\"nextpager\"  width=\"26\" height=\"26\" border=\"0\" alt=\"Next page\"/></div>";
    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:26px\" width=\"50%\"><tr>$pager $pagerstr</td>$pager2</tr></table>\n";
        
$pagerbottom "<table class=\"pager\" style=\"height:26px\" width=\"50%\"><tr>$pager $pagerstr</td>$pager2</tr></table>\n";
    }
    else {
        
$pagertop "<table class=\"pager\" style=\"height:26px\" width=\"0%\"><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 
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 
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);
}

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 
"xxglobal.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=login.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=login.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=2>".$remaining."</font>";
    else
        
$remaining "<font color=green size=2>".$remaining."</font>";
        
    return 
$remaining;
}

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

function mksize1($bytes){
return 
number_format($bytes 10242);
   
}
?>
Mysql

Code:
-- ----------------------------
-- Table structure for `users`
-- ----------------------------
DROP TABLE IF EXISTS `users`;
CREATE TABLE `users` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `username` varchar(40) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL DEFAULT '',
  `old_password` varchar(40) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL DEFAULT '',
  `passhash` varchar(32) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL DEFAULT '',
  `secret` varchar(20) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL DEFAULT '',
  `email` varchar(80) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL DEFAULT '',
  `status` enum('pending','confirmed') CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL DEFAULT 'pending',
  `added` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `last_login` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `last_access` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `last_catchup` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `editsecret` varchar(20) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL DEFAULT '',
  `privacy` enum('normal','strong') CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL DEFAULT 'normal',
  `stylesheet` int(10) DEFAULT '4',
  `info` text CHARACTER SET latin1 COLLATE latin1_general_ci,
  `acceptpms` enum('yes','friends','no') CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL DEFAULT 'yes',
  `ip` varchar(15) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL DEFAULT '',
  `class` tinyint(2) unsigned NOT NULL DEFAULT '1',
  `avatar` varchar(100) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL DEFAULT '',
  `uploaded` bigint(20) unsigned NOT NULL DEFAULT '0',
  `downloaded` bigint(20) unsigned NOT NULL DEFAULT '0',
  `title` varchar(60) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `country` int(10) unsigned NOT NULL DEFAULT '0',
  `notifs` varchar(100) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL DEFAULT '',
  `modcomment` text CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `enabled` enum('yes','no') NOT NULL DEFAULT 'yes',
  `disable_reason` text NOT NULL,
  `imunity` enum('yes','no') NOT NULL DEFAULT 'no',
  `avatars` enum('yes','no') CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL DEFAULT 'yes',
  `donor` enum('yes','no') CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL DEFAULT 'no',
  `warned` enum('yes','no') CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL DEFAULT 'no',
  `warneduntil` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `torrentsperpage` int(3) unsigned NOT NULL DEFAULT '0',
  `topicsperpage` int(3) unsigned NOT NULL DEFAULT '0',
  `postsperpage` int(3) unsigned NOT NULL DEFAULT '0',
  `deletepms` enum('yes','no') CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL DEFAULT 'yes',
  `savepms` enum('yes','no') CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL DEFAULT 'no',
  `parked` enum('yes','no') CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL DEFAULT 'no',
  `announce` enum('yes','no') CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL DEFAULT 'yes',
  `passkey` varchar(32) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL DEFAULT '',
  `last_browse` int(11) NOT NULL DEFAULT '0',
  `last_browsex` int(11) NOT NULL DEFAULT '0',
  `last_browsem` int(11) NOT NULL DEFAULT '0',
  `fader` enum('yes','no') CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL DEFAULT 'yes',
  `fadecolor` varchar(255) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL DEFAULT 'FF0000',
  `support` enum('yes','no') CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL DEFAULT 'no',
  `supportfor` text CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL,
  `supportlang` varchar(50) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL DEFAULT '',
  `invited_by` int(10) NOT NULL DEFAULT '0',
  `invitees` varchar(100) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL DEFAULT '',
  `invites` varchar(100) NOT NULL DEFAULT '0',
  `gender` enum('Male','Female','N/A') CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL DEFAULT 'N/A',
  `invitedate` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `advertisename` enum('yes','no') CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL DEFAULT 'no',
  `signatures` enum('yes','no') CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL DEFAULT 'yes',
  `signature` varchar(225) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL DEFAULT '',
  `uploadpos` enum('yes','no') NOT NULL DEFAULT 'no',
  `downloadpos` enum('yes','no') NOT NULL DEFAULT 'yes',
  `forumpost` enum('yes','no') NOT NULL DEFAULT 'yes',
  `chatpost` enum('yes','no') NOT NULL DEFAULT 'no',
  `chatdisable` enum('yes','no') NOT NULL DEFAULT 'no',
  `donated` decimal(8,2) NOT NULL DEFAULT '0.00',
  `last_pm` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `last_comment` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `last_post` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `forum_access` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `last_staffmsg` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `timezone` smallint(3) NOT NULL DEFAULT '120',
  `dst` tinyint(2) NOT NULL DEFAULT '0',
  `commentpm` enum('yes','no') NOT NULL DEFAULT 'yes',
  `staff_chat_access` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `groups` int(10) unsigned NOT NULL DEFAULT '0',
  `rangclass` int(10) unsigned NOT NULL DEFAULT '0',
  `zodiac` int(10) unsigned NOT NULL DEFAULT '0',
  `donoruntil` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `total_donated` decimal(8,2) NOT NULL DEFAULT '0.00',
  `last_check` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `leechwarn` enum('yes','no') NOT NULL DEFAULT 'no',
  `reputation` int(10) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`),
  UNIQUE KEY `username` (`username`) ,
  KEY `status_added` (`status`,`added`) ,
  KEY `ip` (`ip`) ,
  KEY `uploaded` (`uploaded`) ,
  KEY `downloaded` (`downloaded`) ,
  KEY `country` (`country`) ,
  KEY `last_access` (`last_access`) ,
  KEY `warned` (`warned`) ,
  KEY `passkey` (`passkey`) ,
  KEY `id` (`id`,`username`,`old_password`,`passhash`,`secret`) ,
  KEY `stylesheet` (`stylesheet`) 
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
Reply With Quote
  #2  
Old 15th May 2012, 14:27
costy22it costy22it is offline
Senior Member
 
Join Date: Oct 2010
Romania
Posts: 35
Default u cab help
you need a pool to be maded to work and nesw in the news in te news table
Reply With Quote
  #3  
Old 15th May 2012, 15:37
xe84's Avatar
xe84 xe84 is offline
Senior Member
 
Join Date: Jan 2012
Sweden
Posts: 38
Default EXAKT
I have the exact same problem as you have. I cant get it to work at all =(
Reply With Quote
  #4  
Old 16th May 2012, 10:53
costy22it costy22it is offline
Senior Member
 
Join Date: Oct 2010
Romania
Posts: 35
Default that source code is mine :D
if you have the same code source its mine and here is the wotking sql

and i recomand do not delete thne news and pools from sql

Bump: if the sql dint help pm me i will give to you the same source code 100% working
Attached Files
File Type: sql m49635d1.sql (1.91 MB, 11 views)
Reply With Quote
  #5  
Old 16th May 2012, 15:20
xe84's Avatar
xe84 xe84 is offline
Senior Member
 
Join Date: Jan 2012
Sweden
Posts: 38
Default
Quote:
Originally Posted by costy22it View Post
if you have the same code source its mine and here is the wotking sql

and i recomand do not delete thne news and pools from sql

Bump: if the sql dint help pm me i will give to you the same source code 100% working
u

Thanks costy22. I had the same problem but with your SQL file the syntax error disappeared

Now the only problem is to get my user id to be admin
Reply With Quote
  #6  
Old 16th May 2012, 18:26
costy22it costy22it is offline
Senior Member
 
Join Date: Oct 2010
Romania
Posts: 35
Default pm for help
send me private mesager or add me to messenger newarea_eu at yahoo.com

This are the lines you must edit for admin

Quote:
// Check Staff Names
$lmaxclass = 19
;
$lsysopnames = array("the staff name goes here");
// Case sensitive. Change this (YOUR SYSOP-ADMIN

}
// Check Staff IDS
define ('UC_TECH', 19);
// Minumum Staff Level (4= UC_MODERATOR)
if ($CURUSER['class'] >= UC_TECH
) {
$allowed_ID = array(Your id goes here);
// Change this (YOUR SYSOP-ADMIN IDS GOES HERE) (example: array(1,2,3,4,5))


Last edited by costy22it; 16th May 2012 at 18:30. Reason: update post
Reply With Quote
Reply

Tags
problem


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



All times are GMT +2. The time now is 16:29. vBulletin skin by ForumMonkeys. Powered by vBulletin® Version 3.8.11 Beta 3
Copyright ©2000 - 2024, vBulletin Solutions Inc.