Example #1
0
function _torrenttable($rt, $frame_caption, $speed = false)
{
    global $STYLEPATH, $extratpl, $language;
    $torrent = array();
    $num = 0;
    foreach ($rt as $id => $a) {
        $num++;
        if ($a["leechers"] > 0) {
            $r = $a["seeds"] / $a["leechers"];
            $ratio = number_format($r, 2);
        } else {
            $ratio = $language["INFINITE"];
        }
        $torrent[$num - 1]["rank"] = $num;
        if ($GLOBALS["usepopup"]) {
            $torrent[$num - 1]["filename"] = "<a href=\"javascript:popdetails('index.php?page=details&amp;id=" . $a['hash'] . "');\">" . unesc($a["name"]) . "</a>";
        } else {
            $torrent[$num - 1]["filename"] = "<a href=\"index.php?page=details&amp;id=" . $a['hash'] . "\">" . unesc($a["name"]) . "</a>";
        }
        $torrent[$num - 1]["complete"] = number_format($a["finished"]);
        $torrent[$num - 1]["seeds"] = number_format($a["seeds"]);
        $torrent[$num - 1]["leechers"] = number_format($a["leechers"]);
        $torrent[$num - 1]["peers"] = number_format($a["leechers"] + $a["seeds"]);
        $torrent[$num - 1]["ratio"] = $ratio;
        if ($speed) {
            $torrent[$num - 1]["speed"] = makesize($a["speed"]);
        }
    }
    $extratpl->set("language", $language);
    $extratpl->set("torrent", $torrent);
    $extratpl->set("DISPLAY_SPEED", $speed, true);
    $extratpl->set("DISPLAY_SPEED1", $speed, true);
    return set_block($frame_caption, "center", $extratpl->fetch(load_template("extra-stats.torrent.tpl")));
}
function report($id, $name, $down, $up, $rank, $first, $last)
{
    global $CURUSER, $language;
    if ($down > 0) {
        $ratio = substr($up / $down, 0, 5);
    } else {
        $ratio = '&#8734;';
    }
    if ($down > $up) {
        $diff = "<b><font color=red>&#8595&nbsp;" . makesize($down - $up) . "</font></b>";
    } elseif ($up > $down) {
        $diff = "<b><font color=blue>&#8593&nbsp;" . makesize($up - $down) . "</font></b>";
    } else {
        $diff = "<b><font color=Cyan>0</font></b>";
    }
    $return = array();
    $return["id"] = $id;
    $return["username"] = "******"index.php?page=userdetails&amp;id=" . $id . "\">{$name}</a>";
    $return["down"] = makesize($down) . "</b></font></td>";
    $return["up"] = makesize($up) . "</b></font></td>";
    $return["ratio"] = $ratio . "</b></td>";
    $return["rank"] = $rank . "</b></td>";
    $return["diff"] = $diff . "</b></td>";
    $return["first"] = date("d/m/Y H:i:s", $first) . "</b></td>";
    $return["last"] = date("d/m/Y H:i:s", $last) . "</b></td>";
    $return["edit"] = "<a href=\"index.php?page=admin&amp;user="******"uid"] . "&amp;code=" . $CURUSER["random"] . "&amp;do=users&amp;action=edit&amp;uid={$id}&amp;returnto=admincp.php?user="******"uid"] . "&amp;code=" . $CURUSER["random"] . "&amp;do=searchdiff\">" . $language["EDIT"] . "</a>";
    $return["delete"] = "<a href=\"index.php?page=admin&amp;user="******"uid"] . "&amp;code=" . $CURUSER["random"] . "&amp;do=users&amp;action=delete&amp;uid={$id}&amp;returnto=admincp.php?user="******"uid"] . "&amp;code=" . $CURUSER["random"] . "&amp;do=searchdiff\">" . $language["DELETE"] . "</a>";
    return $return;
}
Example #3
0
$numtorrent = $ruploaded[0];
unset($ruploaded);
if ($numtorrent > 0) {
    list($pagertop, $pagerbottom, $limit) = pager($utorrents == 0 ? 15 : $utorrents, $numtorrent, "index.php?page=usercp&amp;uid={$uid}&amp;");
    $usercptpl->set("pagertop", $pagertop);
    $resuploaded = do_sqlquery("SELECT f.filename, UNIX_TIMESTAMP(f.data) as added, f.size, {$tseeds} as seeds, {$tleechs} as leechers, {$tcompletes} as finished, f.info_hash as hash FROM {$ttables} WHERE uploader={$uid} ORDER BY data DESC {$limit}", true);
}
if ($resuploaded && mysql_num_rows($resuploaded) > 0) {
    include "include/offset.php";
    $usercptpl->set("RESULTS", true, true);
    $uptortpl = array();
    $i = 0;
    while ($rest = mysql_fetch_assoc($resuploaded)) {
        $uptortpl[$i]["filename"] = cut_string(unesc($rest["filename"]), intval($btit_settings["cut_name"]));
        $uptortpl[$i]["added"] = date("d/m/Y", $rest["added"] - $offset);
        $uptortpl[$i]["size"] = makesize($rest["size"]);
        $uptortpl[$i]["seedcolor"] = linkcolor($rest["seeds"]);
        $uptortpl[$i]["seeds"] = $rest[seeds];
        $uptortpl[$i]["leechcolor"] = linkcolor($rest["leechers"]);
        $uptortpl[$i]["leechers"] = $rest[leechers];
        $uptortpl[$i]["completed"] = $rest["finished"] > 0 ? $rest["finished"] : "---";
        $uptortpl[$i]["editlink"] = "index.php?page=edit&amp;info_hash=" . $rest["hash"] . "&amp;returnto=" . urlencode("index.php?page=torrents") . "";
        $uptortpl[$i]["dellink"] = "index.php?page=delete&amp;info_hash=" . $rest["hash"] . "&amp;returnto=" . urlencode("index.php?page=torrents") . "";
        $uptortpl[$i]["editimg"] = image_or_link("{$STYLEPATH}/images/edit.png", "", $language["EDIT"]);
        $uptortpl[$i]["delimg"] = image_or_link("{$STYLEPATH}/images/delete.png", "", $language["DELETE"]);
        $i++;
    }
    $usercptpl->set("uptor", $uptortpl);
} else {
    $usercptpl->set("RESULTS", false, true);
    $usercptpl->set("pagertop", "");
//
////////////////////////////////////////////////////////////////////////////////////
if (!defined("IN_BTIT")) {
    die("non direct access!");
}
// load language file
require load_language("lang_lottery.php");
function get_value($what, $table, $area, $id)
{
    global $TABLE_PREFIX;
    $query = do_sqlquery("SELECT {$what} FROM {$TABLE_PREFIX}{$table} WHERE {$area}={$id}", true);
    $object_to_array = mysql_fetch_array($query) or sql_err(__FILE__, __LINE__);
    return $object_to_array[$what];
}
$query = do_sqlquery("SELECT * FROM `{$TABLE_PREFIX}lottery_winners`", true);
$ticketstpl = new bTemplate();
$ticketstpl->set("language", $language);
if (mysql_num_rows($query) == 0) {
    $ticketstpl->set("are_winners", false, true);
} else {
    $ticketstpl->set("are_winners", true, true);
    $won = array();
    $x = 0;
    while ($users = mysql_fetch_assoc($query)) {
        $won[$x]["winner"] = $users["win_user"];
        $won[$x]["date"] = $users["windate"];
        $won[$x]["price"] = makesize($users["price"]);
        $x++;
        $ticketstpl->set("winner", $won);
    }
}
Example #5
0
}
if ($now >= $expire || $enabled != 'yes') {
    err_msg($language["ERROR"], $language["CANNOT_SELL_CLOSED"]);
    stdfoot();
    die;
}
if ($_POST['number'] > $purchaseable || $_POST['number'] < 1) {
    err_msg($language["ERROR"], $language["LOTT_LIMIT_PURCHASE"] . " " . $purchaseable);
    stdfoot();
    die;
}
if ($_POST['number'] + $user_tickets > $limit_buy) {
    err_msg($language["ERROR"], $language["LOTT_LIMIT_BUY"] . " " . $limit_buy);
    stdfoot();
    die;
}
$upload = $result["uploaded"] - $minupload * $_POST['number'];
do_sqlquery("UPDATE `{$TABLE_PREFIX}users` SET `uploaded`=" . $upload . " WHERE `id`=" . $CURUSER['uid'] . "", true);
$tickets = $_POST['number'];
for ($i = 0; $i < $tickets; $i++) {
    do_sqlquery("INSERT INTO {$TABLE_PREFIX}lottery_tickets(user) VALUES(" . $CURUSER['uid'] . ")", true);
}
$me = mysqli_num_rows(do_sqlquery("SELECT * FROM `{$TABLE_PREFIX}lottery_tickets` WHERE user="******"", true));
// load language file
require load_language("lang_lottery.php");
$ticketstpl = new bTemplate();
$ticketstpl->set("language", $language);
$ticketstpl->set("nr_tickets", $tickets);
$ticketstpl->set("total_tickets", $me);
$ticketstpl->set("new_upload", makesize($upload));
header("Refresh: 5; URL=index.php?page=lottery_tickets");
Example #6
0
    die("non direct access!");
}
require_once "include/functions.php";
require_once "include/config.php";
dbconn();
global $CURUSER;
if (!$CURUSER || $CURUSER["view_torrents"] == "no") {
    // do nothing
} else {
    if ($btit_settings["req_onoff"] == true) {
        $maxallowed = $btit_settings["req_max"];
        $res3 = mysql_query("SELECT * FROM {$TABLE_PREFIX}requests as reqcount WHERE userid={$CURUSER['uid']}") or mysql_error();
        $arr3 = mysql_num_rows($res3);
        $numreqs = $arr3;
        $reqrem = $maxallowed - $numreqs;
        $reward = makesize($btit_settings["req_mb"]);
        $viewrequeststpl = new bTemplate();
        $viewrequeststpl->set("language", $language);
        if ($btit_settings["req_maxon"] == true) {
            $viewrequeststpl->set("vr0", "<br><div align=center ><font color=steelblue>Available Requests for <b>{$CURUSER['username']}: {$maxallowed}</b> | Posted Requests: <b>{$arr3}</b> | Remaining: <b>{$reqrem}</b></font></div><br>");
        }
        if ($btit_settings["req_rwon"] == true) {
            if ($btit_settings["req_sbmb"] == true) {
                $viewrequeststpl->set("vr01", "<br><div align=center ><font color=steelblue>If you furfill a request , you will recieve <b>{$reward}</b></font></div><br>");
                //mysql_query("UPDATE {$TABLE_PREFIX}users SET uploaded = uploaded + $btit_settings[req_mb]  WHERE id=$CURUSER[uid]");
            }
            if ($btit_settings["req_sbmb"] == false) {
                $viewrequeststpl->set("vr01", "<br><div align=center ><font color=steelblue>If you furfill a request , you will recieve <b>{$btit_settings['req_sb']}</b> seedbonus points</font></div><br>");
                //mysql_query("UPDATE {$TABLE_PREFIX}users SET seedbonus = seedbonus + $btit_settings[req_sb] WHERE id=$CURUSER[uid]");
            }
        }
Example #7
0
function outputTree($files, $indent = 1)
{
    //echo "<table style=\"font-size: 7pt; width: 100%;\"";
    foreach ($files as $k => $v) {
        $entry = isset($v['filename']) ? $v['filename'] : $k;
        $size = $v['size'];
        if ($indent == 0) {
            // root
            $is_folder = true;
        } elseif (is_array($v) && (!array_key_exists('filename', $v) && !array_key_exists('size', $v))) {
            // normal node
            $is_folder = true;
        } else {
            // leaf node, i.e. a file
            $is_folder = false;
        }
        if ($is_folder) {
            // we could output a folder icon here
        } else {
            // we could output an appropriate icon
            // based on file extension here
            $ext = pathinfo($entry, PATHINFO_EXTENSION);
        }
        // echo "<tr><td style=\"border: 1px solid #D2D2D2;\">";
        echo $entry;
        // output folder name or filename
        if (!$is_folder) {
            // if it’s not a folder, show file size
            echo " (" . makesize($size) . ")";
        }
        //echo "</td></tr>";
        if (is_array($v) && $is_folder) {
            outputTree($v, $indent + 1);
        }
    }
    //echo "</table>";
}
Example #8
0
$result['peers'] = $result['leechers'] + $result['seeders'];
echo '<table style="text-align: left;">';
echo '<tr><th>Torrents chargés : </th><td>' . $result['completed'] . '</td></tr>';
echo '<tr><th>Clients : </th><td>' . $result['peers'] . '</td></tr>';
if ($result['peers']) {
    printf('<tr><th>Leechs : <td>%d <span style="font-size:7pt;">(%d %%)</span>', $result['leechers'], $result['leechers'] * 100 / $result['peers'], '</td></tr>');
    printf('<tr><th>Seeds : <td>%d <span style="font-size:7pt;">(%d %%)</span>', $result['seeders'], $result['seeders'] * 100 / $result['peers'], '</td></tr>');
}
echo '<tr><th>Torrents actifs : <td>' . $result['torrents'] . '</td></tr>';
//$nbr = mysql_query("SELECT id_torr FROM torrents");
//$nbrtorrents = mysql_num_rows($nbr);
$stmt = $db->query('SELECT postID FROM blog_posts_seo');
$nbrtorrents = $stmt->rowCount();
printf('<tr><th>Torrents total : <td>%d</td>', $nbrtorrents, '<td></td></tr>');
//$res = mysql_query("select sum(downloaded) as down, sum(uploaded) as up from xbt_users");
//$row = mysql_fetch_array($res);
$stmt = $db->query('SELECT sum(downloaded) as down, sum(uploaded) as up FROM xbt_users');
$row = $stmt->fetch();
$dled = makesize($row['down']);
$upld = makesize($row['up']);
$traffic = makesize($row['down'] + $row['up']);
printf('<tr><th>Download total : <td>' . $dled . '</td></tr>');
printf('<tr><th>Upload total : <td>' . $upld . '</td></tr>');
printf('<tr><th>Trafic total : <td>' . $traffic . '</td></tr>');
print '</table>';
?>
		</ul>
</li>

</div>
Example #9
0
function print_debug($level = 3, $key = ' - ')
{
    global $time_start, $gzip, $num_queries, $cached_querys;
    $time_end = get_microtime();
    switch ($level) {
        case '4':
            if (function_exists('memory_get_usage')) {
                $memory = '[ Memory: ' . makesize(memory_get_usage());
                if (function_exists('memory_get_peak_usage')) {
                    $memory .= '|' . makesize(memory_get_peak_usage());
                }
                $return[] = $memory . ' ]';
            }
        case '3':
            $return[] = '[ GZIP: ' . $gzip . ' ]';
        case '2':
            $return[] = '[ Script Execution: ' . number_format($time_end - $time_start, 4) . ' sec. ]';
        case '1':
            $return[] = '[ Queries: ' . $num_queries . '|' . $cached_querys . ' ]';
            break;
        default:
            return '';
    }
    return implode($key, array_reverse($return));
}
Example #10
0
    die("non direct access!");
}
if (!defined("IN_ACP")) {
    die("non direct access!");
}
function get_value($what, $table, $area, $id)
{
    global $TABLE_PREFIX;
    $query = do_sqlquery("SELECT {$what} FROM {$TABLE_PREFIX}{$table} WHERE {$area}={$id}", true);
    $object_to_array = mysql_fetch_array($query) or sql_err(__FILE__, __LINE__);
    return $object_to_array[$what];
}
$admintpl->set("language", $language);
$query = do_sqlquery("SELECT DISTINCT `user` FROM `{$TABLE_PREFIX}lottery_tickets`", true);
if (mysql_num_rows($query) == 0) {
    $admintpl->set("no_tickets", true, true);
} else {
    $admintpl->set("no_tickets", false, true);
    $bought = array();
    $x = 0;
    while ($users = mysql_fetch_assoc($query)) {
        $bought[$x]["id"] = $users["user"];
        $bought[$x]["number_tickets"] = get_value("COUNT(user)", "lottery_tickets", "user", $users["user"]);
        $bought[$x]["username"] = get_value("username", "users", "id", $users["user"]);
        $bought[$x]["download"] = makesize(get_value("downloaded", "users", "id", $users["user"]));
        $bought[$x]["upload"] = makesize(get_value("uploaded", "users", "id", $users["user"]));
        $x++;
        $admintpl->set("ticket", $bought);
    }
}
$admintpl->set("back", "index.php?page=admin&user="******"uid"] . "&code=" . $CURUSER["random"] . "&do=lottery_settings");
Example #11
0
<?php

$language["BLACKJACK"] = "Blackjack";
$language["BJ_WELCOME_1"] = "<p><font color='#FFFFFF'>Le but est de possèder une main le plus proche de 21 sans la dépassé. Vous joué contre le Dealer, vous devez donc avoir une meilleure main que lui pour gagner.</font>";
$language["BJ_WELCOME_2"] = "<font color='yellow'><b> Chaque partie coûte " . makesize($btit_settings["bj_blackjack_stake"]) . " de crédit d'upload.</p></b></font><font size=2 color='#FFFFFF'><li><b>Le Blackjack paye " . makesize($btit_settings["bj_blackjack_stake"] * $btit_settings["bj_blackjack_prize"] + $btit_settings["bj_blackjack_stake"]) . "</li><li>Battre le dealer paye " . makesize($btit_settings["bj_blackjack_stake"] * $btit_settings["bj_normal_prize"] + $btit_settings["bj_blackjack_stake"]) . "</li><li>Un nul vous redonne votre mise.</li><li>Perdre ne vous redonne rien.</li></font>";
$language["CONTINUE"] = "Jouer";
$language["DEALER_HAND"] = "<font color='#FFFFFF' face='Arial'><b>Main du Dealer (";
$language["YOUR_HAND"] = "<font color='#FFFFFF' face='Arial'><b>Votre main (";
$language["HIT"] = "Nouvelle carte";
$language["STAND"] = "Conserver la main";
$language["ACTIVE_GAME_1"] = "Vous avez déjà une partie en cours, ";
$language["ACTIVE_GAME_2"] = " pour la terminée.";
$language["YOU_WIN"] = "<font color='lime' size='2'><b>Vous avez gagner!</b></font>";
$language["YOU_LOSE"] = "<font color='red' size='2'><b>Vous avez perdue!</b></font>";
$language["PUSH"] = "<font color='orange'><b>Push!</b></font>";
$language["INSUFFICIENT_UPLOAD_CREDIT"] = "<font color='#FF0000' size='2'><b>Vous n'avez pas assez de crédit d'upload pour pouvoir jouer!</b></font>";
$language["PLAY_AGAIN"] = "<font color='yellow' face='Arial' size='2'>Rejouer</font>";
Example #12
0
    $torrenttpl->set("DISPLAY_FILES", TRUE, TRUE);
    $ffile = fopen($row["url"], "rb");
    $content = fread($ffile, filesize($row["url"]));
    fclose($ffile);
    $content = BDecode($content);
    $numfiles = 0;
    if (isset($content["info"]) && $content["info"]) {
        $thefile = $content["info"];
        if (isset($thefile["length"])) {
            $dfiles[$numfiles]["filename"] = htmlspecialchars($thefile["name"]);
            $dfiles[$numfiles]["size"] = makesize($thefile["length"]);
            $numfiles++;
        } elseif (isset($thefile["files"])) {
            foreach ($thefile["files"] as $singlefile) {
                $dfiles[$numfiles]["filename"] = htmlspecialchars(implode("/", $singlefile["path"]));
                $dfiles[$numfiles]["size"] = makesize($singlefile["length"]);
                $numfiles++;
            }
        } else {
            // can't be but...
        }
    }
    $row["numfiles"] = $numfiles . ($numfiles == 1 ? " file" : " files");
    unset($content);
} else {
    $torrenttpl->set("DISPLAY_FILES", false, TRUE);
}
$torrenttpl->set("files", $dfiles);
// end files in torrents
include dirname(__FILE__) . "/include/offset.php";
$row["date"] = date("d/m/Y", $row["data"] - $offset);
Example #13
0
    }
    if ($row["warns"] == 3 or $row["warns"] == 4) {
        $wl = "<img src='images/warned/warn_2.png'>";
    }
    if ($row["warns"] == 5 or $row["warns"] == 6) {
        $wl = "<img src='images/warned/warn_3.png'>";
    }
    print "<tr><td><center>" . $wl . "</td></tr>";
    ?>
</table><table class="lista" width="100%">

<?php 
    $style = style_list();
    $langue = language_list();
    print "<tr><td><center><img src=\"images/speed_up.png\"><font size=\"1\" color=\"green\"> " . makesize($CURUSER['uploaded']);
    print "<img src=\"images/speed_down.png\"><font size=\"1\" color=\"red\"> " . makesize($CURUSER['downloaded']);
    print "</td></tr>";
    print "<tr><td><center><img src=\"images/arany.png\"><font size=\"1\" color=\"yellow\"> " . ($CURUSER['downloaded'] > 0 ? number_format($CURUSER['uploaded'] / $CURUSER['downloaded'], 2) : "---") . "</font>";
    print "<a href=index.php?page=modules&module=seedbonus><img src=\"images/bonus.png\"> " . ($CURUSER['seedbonus'] > 0 ? number_format($CURUSER['seedbonus'], 2) : "---") . "</a></center>\n";
    print "</td></tr>";
    ?>
</table> 

<table class="lista" border="0" align="center" width="100%">
<?php 
    print "<tr><td align=\"center\">";
    include "include/offset.php";
    print $language["USER_LASTACCESS"] . ":<br />" . date("d/m/Y H:i:s", $CURUSER["lastconnect"] - $offset);
    print "</select>";
    print "</td>\n</tr>\n";
    if ($btit_settings["hide_style"] == "visible") {
Example #14
0
function do_sanity($ts = 0)
{
    // Lets try upping the max_execution_time and memory_limit if we can (Code from Pet/FM)
    if (@ini_get("max_execution_time") < 300) {
        @ini_set("max_execution_time", 300);
    }
    if (trim(@ini_get("memory_limit"), "M") < 128) {
        @ini_set("memory_limit", "128M");
    }
    global $clean_interval, $BASEURL, $btit_settings, $XBTT_USE, $db_prefix, $autopruneusers, $email_on_prune, $days_members, $days_not_comfirm, $days_to_email, $PRIVATE_ANNOUNCE, $TORRENTSDIR, $CURRENTPATH, $LIVESTATS, $LOG_HISTORY, $TABLE_PREFIX, $DOXPATH, $DBDT;
    $THIS_BASEPATH = dirname(__FILE__);
    $days = 14;
    $time = time() - $days * 86400;
    mysqli_query($GLOBALS["___mysqli_ston"], "DELETE FROM {$TABLE_PREFIX}bugs WHERE status != 'na' AND added < {$time}") or sqlerr(__FILE__, __LINE__);
    //delete bots after 48 hours
    mysqli_query($GLOBALS["___mysqli_ston"], "DELETE FROM {$TABLE_PREFIX}bots WHERE visit < (NOW() - INTERVAL 2880 MINUTE)");
    //end bots
    //delete last up/downloads after 48 hours
    mysqli_query($GLOBALS["___mysqli_ston"], "DELETE FROM {$TABLE_PREFIX}downloads WHERE date < (NOW() - INTERVAL 2880 MINUTE)");
    //end last up/downloads
    //show images in shoutbox
    if ($btit_settings["endtch"] == TRUE) {
        $shout = mysqli_query($GLOBALS["___mysqli_ston"], "SELECT * FROM {$TABLE_PREFIX}chat ORDER BY id DESC LIMIT 1");
        $shoutrow = mysqli_fetch_assoc($shout);
        $fp = $btit_settings["fix_chat"];
        if ($shoutrow["count"] >= $btit_settings["don_chat"]) {
            if ($btit_settings["ran_chat"] == TRUE) {
                do_sqlquery("INSERT INTO {$TABLE_PREFIX}chat (uid, time, name, text) VALUES (0," . time() . ", 'System','[img]{$BASEURL}/images/shouts/shout.php[/img]')");
            } else {
                do_sqlquery("INSERT INTO {$TABLE_PREFIX}chat (uid, time, name, text) VALUES (0," . time() . ", 'System','[img]{$BASEURL}/images/shouts/" . $fp . "[/img]')");
            }
        }
    }
    //show images in shoutbox end
    //happy hour
    $happy_r = mysqli_query($GLOBALS["___mysqli_ston"], "SELECT UNIX_TIMESTAMP(value_s) AS happy , value_i AS happys from {$TABLE_PREFIX}avps where arg='happyhour'") or sqlerr(__FILE__, __LINE__);
    $happy_a = mysqli_fetch_array($happy_r);
    $curDate = time();
    $happyTime = $happy_a["happy"] + 3600;
    if ($happy_a["happys"] == 0) {
        $happyHour = happyHour();
        mysqli_query($GLOBALS["___mysqli_ston"], "UPDATE {$TABLE_PREFIX}avps set value_s=" . sqlesc($happyHour) . ", value_i='1' WHERE arg='happyhour' LIMIT 1 ") or sqlerr(__FILE__, __LINE__);
    } elseif ($happy_a["happys"] == 1 && $curDate > $happyTime) {
        mysqli_query($GLOBALS["___mysqli_ston"], "UPDATE {$TABLE_PREFIX}avps set value_i='0' WHERE arg='happyhour' LIMIT 1 ");
    }
    $switch = do_sqlquery("SELECT * FROM `{$TABLE_PREFIX}files` WHERE `external`='no'", true);
    $switch_happy = mysqli_fetch_array($switch);
    if ($switch_happy["happy_hour"] == "yes") {
        if (ishappyHour("check") && $happyTime > "0:00") {
            do_sqlquery("ALTER TABLE `{$TABLE_PREFIX}files` CHANGE `happy` `happy` ENUM( 'yes', 'no' ) NULL DEFAULT 'yes'") or sqlerr();
            do_sqlquery("UPDATE `{$TABLE_PREFIX}files` SET `happy`='yes' WHERE `external`='no'", true);
        } else {
            do_sqlquery("ALTER TABLE `{$TABLE_PREFIX}files` CHANGE `happy` `happy` ENUM( 'yes', 'no' ) NULL DEFAULT 'no'") or sqlerr();
            do_sqlquery("UPDATE `{$TABLE_PREFIX}files` SET `happy`='no' WHERE `external`='no'", true);
        }
    }
    // happy hour
    // featured
    if ($btit_settings["auto_feat"] == TRUE) {
        $feat = mysqli_query($GLOBALS["___mysqli_ston"], "SELECT info_hash , leechers , image from {$TABLE_PREFIX}files where image!='' ORDER BY leechers DESC limit 1");
        $resfeat = mysqli_fetch_array($feat);
        do_sqlquery("INSERT INTO {$TABLE_PREFIX}featured (fid,torrent_id) VALUES ('','{$resfeat['info_hash']}')");
    }
    //featured
    //sb
    if ($XBTT_USE) {
        $ressb = do_sqlquery("SELECT uid FROM xbt_files_users as u INNER JOIN xbt_files as x ON u.fid=x.fid WHERE u.left = '0' AND x.flags='0' AND u.active='1'");
        if (mysqli_num_rows($ressb) > 0) {
            while ($arrsb = mysqli_fetch_assoc($ressb)) {
                $x = $arrsb["uid"];
                quickQuery("UPDATE `{$TABLE_PREFIX}users` SET `seedbonus`=`seedbonus`+'" . number_format(($ts > 0 ? time() - $ts : $clean_interval) / 3600 * $GLOBALS["bonus"], 6, ".", "") . "' WHERE `id` = '{$x}'");
            }
        }
    } else {
        $ressb = do_sqlquery("SELECT pid FROM {$TABLE_PREFIX}peers WHERE status = 'seeder'");
        if (mysqli_num_rows($ressb) > 0) {
            while ($arrsb = mysqli_fetch_assoc($ressb)) {
                $x = $arrsb['pid'];
                quickQuery("UPDATE `{$TABLE_PREFIX}users` SET `seedbonus`=`seedbonus`+'" . number_format(($ts > 0 ? time() - $ts : $clean_interval) / 3600 * $GLOBALS["bonus"], 6, ".", "") . "' WHERE `pid`= '{$x}'");
            }
        }
    }
    //sb
    //warn
    $query = do_sqlquery("SELECT * FROM `{$TABLE_PREFIX}users` WHERE warn='yes'");
    while ($conf = mysqli_fetch_assoc($query)) {
        if (mysqli_num_rows($query) > 0) {
            $expire_dat = $conf['warnadded'];
            $expire2 = strtotime($expire_dat);
            $nown = strtotime("now");
            if ($nown >= $expire2) {
                $subj = sqlesc("Your Warning time is expired !!");
                $msg = sqlesc("You are not longer Warned , please be carefull to not make the same mistake again !!");
                send_pm(0, $conf[id], $subj, $msg);
                mysqli_query($GLOBALS["___mysqli_ston"], "UPDATE {$TABLE_PREFIX}users SET warn='no' WHERE id='{$conf['id']}'") or sqlerr();
            }
        }
    }
    //warn
    //remove boot after expiration
    require_once load_language("lang_userdetails.php");
    $datetime = gmdate("Y-m-d H:i:s");
    $bootedstats = mysqli_query($GLOBALS["___mysqli_ston"], "SELECT * FROM {$TABLE_PREFIX}users WHERE addbooted < '{$datetime}' AND booted='yes'");
    while ($arr = mysqli_fetch_assoc($bootedstats)) {
        if (mysqli_num_rows($bootedstats) > 0) {
            $sub = sqlesc($language["BOOT_SUB"]);
            $mess = sqlesc($language["BOOT_MSG"]);
            send_pm(0, $arr[id], $sub, $mess);
            mysqli_query($GLOBALS["___mysqli_ston"], "UPDATE {$TABLE_PREFIX}users SET booted='no' WHERE id='{$arr['id']}'") or sqlerr();
        }
    }
    //remove boot after expiration
    // DT request hack start
    $reqprune = $btit_settings["req_prune"];
    $request = mysqli_query($GLOBALS["___mysqli_ston"], "SELECT id FROM {$TABLE_PREFIX}requests WHERE filledby > '0' AND fulfilled < DATE_SUB(NOW(), INTERVAL {$reqprune} DAY)");
    $reqrow = mysqli_fetch_assoc($request);
    $reqid = $reqrow["id"];
    if (mysqli_num_rows($request) > 0) {
        mysqli_query($GLOBALS["___mysqli_ston"], "DELETE FROM {$TABLE_PREFIX}requests WHERE filledby > 0 AND id = {$reqid}");
        mysqli_query($GLOBALS["___mysqli_ston"], "DELETE FROM {$TABLE_PREFIX}addedrequests WHERE requestid = {$reqid}");
    }
    // DT request hack end
    if ($autopruneusers) {
        $timeout = $days_members * 60 * 60 * 24;
        $timeout2 = $days_not_comfirm * 60 * 60 * 24;
        if ($GLOBALS["FORUMLINK"] == "smf") {
            do_sqlquery("DELETE u,smfm FROM {$TABLE_PREFIX}users u INNER JOIN {$db_prefix}members smfm ON smfm.ID_MEMBER=u.smf_fid INNER JOIN {$TABLE_PREFIX}users_level ul ON ul.id=u.id_level WHERE (u.id_level = '2' AND UNIX_TIMESTAMP(u.lastconnect)<(UNIX_TIMESTAMP()-{$timeout2}) AND ul.auto_prune='yes') OR (UNIX_TIMESTAMP(lastconnect)<(UNIX_TIMESTAMP()-{$timeout}) AND ul.auto_prune='yes')");
        } else {
            do_sqlquery("DELETE u FROM {$TABLE_PREFIX}users u INNER JOIN {$TABLE_PREFIX}users_level ul ON ul.id=u.id_level WHERE (u.id_level = '2' AND UNIX_TIMESTAMP(u.lastconnect)<(UNIX_TIMESTAMP()-{$timeout2}) AND ul.auto_prune='yes') OR (UNIX_TIMESTAMP(lastconnect)<(UNIX_TIMESTAMP()-{$timeout}) AND ul.auto_prune='yes')");
        }
        if ($email_on_prune) {
            $timeout = $days_to_email * 60 * 60 * 24;
            $res = get_result("SELECT email, lastconnect FROM {$TABLE_PREFIX}users u INNER JOIN {$TABLE_PREFIX}users_level ul ON ul.id=u.id_level WHERE UNIX_TIMESTAMP()>=(UNIX_TIMESTAMP(lastconnect)+{$timeout}-{$clean_interval}/2) AND UNIX_TIMESTAMP()<(UNIX_TIMESTAMP(lastconnect)+{$timeout}+{$clean_interval}/2) AND UNIX_TIMESTAMP(lastconnect)<(UNIX_TIMESTAMP()-{$timeout}) AND ul.auto_prune='yes'", true);
            foreach ($res as $id => $rusers) {
                send_mail($rusers["email"], $language["EMAIL_INACTIVE_SUBJ"], $language["EMAIL_INACTIVE_MSG"] . "\n\n" . $BASEURL . "/index.php");
            }
        }
    }
    // Autoprune torrents
    if ($btit_settings["autotprune"] == TRUE) {
        quickQuery("UPDATE `{$TABLE_PREFIX}files` `f` " . ($XBTT_USE ? "LEFT JOIN `xbt_files` `xf` ON `f`.`bin_hash`=`xf`.`info_hash`" : "") . " SET `f`.`dead_time`=UNIX_TIMESTAMP() WHERE ((" . ($XBTT_USE ? "`xf`.`seeders`>0 OR `xf`.`leechers`>0" : "`f`.`seeds`>0 OR `f`.`leechers`>0") . ") OR `f`.`dead_time`=0) AND `f`.`external`='no'");
        $res = get_result("SELECT `info_hash`, `bin_hash` FROM `{$TABLE_PREFIX}files` WHERE `dead_time`<=" . (time() - $btit_settings["autotprundedays"] * 86400) . " AND `dead_time`!=0 AND `external`='no'");
        if (count($res) > 0) {
            foreach ($res as $row) {
                quickQuery("DELETE FROM `{$TABLE_PREFIX}files` WHERE `info_hash`='" . mysqli_real_escape_string($DBDT, $row["info_hash"]) . "'");
                quickQuery("DELETE FROM `{$TABLE_PREFIX}timestamps` WHERE `info_hash`='" . mysqli_real_escape_string($DBDT, $row["info_hash"]) . "'");
                quickQuery("DELETE FROM `{$TABLE_PREFIX}comments` WHERE `info_hash`='" . mysqli_real_escape_string($DBDT, $row["info_hash"]) . "'");
                quickQuery("DELETE FROM `{$TABLE_PREFIX}ratings` WHERE `infohash`='" . mysqli_real_escape_string($DBDT, $row["info_hash"]) . "'");
                quickQuery("DELETE FROM `{$TABLE_PREFIX}peers` WHERE `infohash`='" . mysqli_real_escape_string($DBDT, $row["info_hash"]) . "'");
                quickQuery("DELETE FROM `{$TABLE_PREFIX}history` WHERE `infohash`='" . mysqli_real_escape_string($DBDT, $row["info_hash"]) . "'");
                if ($XBTT_USE) {
                    quickQuery("UPDATE `xbt_files` SET `flags`=1 WHERE `info_hash`='" . mysqli_real_escape_string($DBDT, $row["bin_hash"]) . "'");
                }
            }
        }
    }
    // Autoprune torrents
    // timed registration
    $expire_datetr = $btit_settings["regi_d"];
    $expire_timetr = $btit_settings["regi_t"];
    $expire_datetrs = $expire_datetr . " " . $expire_timetr . ":00:00";
    $expiretr = strtotime($expire_datetrs);
    $nowtr = strtotime("now");
    if ($nowtr >= $expiretr) {
        do_sqlquery("UPDATE `{$TABLE_PREFIX}settings` SET `value`='true' WHERE `key`='regi'", true);
    }
    // end timed registration
    // Anti Hit and Run V2 based on CobraCRK's Anti Hit&Run Mod v1 Enhanced By IntelPentium4 & fatepower
    // converted ( and improved ) to XBTIT 2 by DiemThuy Nov 2008
    if (!$XBTT_USE) {
        // Get current time
        $timenow = time();
        // Get last time that dosanity() was run
        $timeres = mysqli_query($GLOBALS["___mysqli_ston"], "SELECT last_time FROM {$TABLE_PREFIX}anti_hit_run_tasks WHERE task='sanity'");
        if (mysqli_num_rows($timeres) > 0) {
            $timearr = mysqli_fetch_array($timeres);
            $lastrecordedtime = intval($timearr['last_time']);
        } else {
            $lastrecordedtime = $timenow - $clean_interval;
        }
        // Update Active Seeders' Seeding Clock
        $res = mysqli_query($GLOBALS["___mysqli_ston"], "SELECT pid, infohash FROM {$TABLE_PREFIX}peers WHERE status = 'seeder'");
        if (mysqli_num_rows($res) > 0) {
            while ($arr = mysqli_fetch_assoc($res)) {
                $x = $arr['pid'];
                $t = $arr['infohash'];
                $pl = mysqli_query($GLOBALS["___mysqli_ston"], "SELECT id FROM {$TABLE_PREFIX}users WHERE pid='" . $x . "'");
                if (mysqli_num_rows($pl) > 0) {
                    $ccc = mysqli_result($pl, 0, "id");
                } else {
                    $ccc = "Unknown";
                }
                mysqli_query($GLOBALS["___mysqli_ston"], "UPDATE {$TABLE_PREFIX}history SET seed = seed+" . $timenow . "-" . $lastrecordedtime . " WHERE uid = {$ccc} AND infohash='{$t}'");
            }
        }
        //Update table anti_hit_run_tasks with new time info.
        $hunden = mysqli_query($GLOBALS["___mysqli_ston"], "SELECT last_time FROM {$TABLE_PREFIX}anti_hit_run_tasks WHERE task='sanity'");
        $manneplutt = mysqli_fetch_row($hunden);
        if (!$manneplutt) {
            mysqli_query($GLOBALS["___mysqli_ston"], "INSERT INTO {$TABLE_PREFIX}anti_hit_run_tasks (task, last_time) VALUES ('sanity',{$timenow})");
        } else {
            $ts = $manneplutt[0];
            mysqli_query($GLOBALS["___mysqli_ston"], "UPDATE {$TABLE_PREFIX}anti_hit_run_tasks SET last_time={$timenow} WHERE task='sanity' AND last_time = {$ts}");
        }
        // Rank who has no anti-hit punishment rule should be excluded
        $levels = mysqli_query($GLOBALS["___mysqli_ston"], "select id from {$TABLE_PREFIX}users_level order by id");
        while ($SingleLevel = mysqli_fetch_array($levels)) {
            $hasAntiHitRecord = mysqli_query($GLOBALS["___mysqli_ston"], "select id_level from {$TABLE_PREFIX}anti_hit_run where id_level=" . $SingleLevel["id"]);
            if (mysqli_num_rows($hasAntiHitRecord) == 0) {
                @mysqli_query($GLOBALS["___mysqli_ston"], "UPDATE `{$TABLE_PREFIX}history`,`users` set hitchecked= 2 where history.uid=users.id and users.id_level=" . $SingleLevel["id"] . " and completed='yes' and hitchecked='0'");
            }
        }
        $hit_parameters = mysqli_query($GLOBALS["___mysqli_ston"], "select * from {$TABLE_PREFIX}anti_hit_run order by id_level");
        while ($hit = mysqli_fetch_array($hit_parameters)) {
            // Punishment
            $r = mysqli_query($GLOBALS["___mysqli_ston"], "SELECT DISTINCT uid,infohash FROM {$TABLE_PREFIX}history history inner join {$TABLE_PREFIX}users users on history.uid=users.id WHERE users.id_level=" . $hit["id_level"] . " AND active='no' AND completed='yes' AND hit='no' AND hitchecked= 0 AND date < ( UNIX_TIMESTAMP( ) - (86400 * " . $hit["tolerance_days_before_punishment"] . ")) AND history.downloaded>(1048576 * " . $hit["min_download_size"] . ") AND seed<( 3600 * " . $hit["min_seed_hours"] . ") AND (history.uploaded/history.downloaded)<" . $hit["min_ratio"]);
            while ($x = mysqli_fetch_array($r)) {
                @mysqli_query($GLOBALS["___mysqli_ston"], "Update {$TABLE_PREFIX}history SET hit='yes' WHERE uid=" . $x[uid] . " AND infohash='" . $x[infohash] . "' AND hitchecked=0");
                if (mysqli_affected_rows($GLOBALS["___mysqli_ston"]) > 0) {
                    if ($hit["reward"] == 'yes') {
                        $reward = "\n\n[color=red]If you want to get the lost amount back , you must seed for at least " . $hit["min_seed_hours"] . " hour(s) or until the file\\'s ratio becomes greater than " . $hit["min_ratio"] . " then your total upload will incremented by " . $hit["upload_punishment"] . " MB !! \n\n\\ [/color][color=purple]This is a automatic system message , so DO NOT reply ![/color]";
                    } else {
                        $reward = " ";
                    }
                    @mysqli_query($GLOBALS["___mysqli_ston"], "Update {$TABLE_PREFIX}history SET hitchecked= 1 ,punishment_amount=" . $hit["upload_punishment"] . " WHERE uid=" . $x[uid] . " AND infohash='" . $x[infohash] . "' AND hitchecked=0");
                    @mysqli_query($GLOBALS["___mysqli_ston"], "Update {$TABLE_PREFIX}users SET uploaded=(case when uploaded-(1048576 * " . $hit["upload_punishment"] . ")<0 then 0 else uploaded-(1048576 * " . $hit["upload_punishment"] . ") end) WHERE id={$x['uid']}");
                    send_pm(0, $x[uid], sqlesc("Auto Hit an Run warning"), sqlesc("You did Hit and Run on the following torrent :\n\n [url]" . $BASEURL . "/index.php?page=details&id={$x['infohash']}[/url] !\n\n\\We did take away " . $hit["upload_punishment"] . " MB as punishment\n\nBe carefull to not make the mistake once more ! " . $reward . ""));
                    // DT reputation system start
                    $reput = do_sqlquery("SELECT * FROM {$TABLE_PREFIX}reputation_settings WHERE id =1");
                    $setrep = mysqli_fetch_array($reput);
                    $plus = $setrep["rep_hit"];
                    if ($setrep["rep_is_online"] == FALSE) {
                        //do nothing
                    } else {
                        @mysqli_query($GLOBALS["___mysqli_ston"], "UPDATE {$TABLE_PREFIX}users SET reputation = reputation - '{$plus}' WHERE id='{$x['uid']}'");
                    }
                    // DT reputation system end
                    // warn at hit and run
                    if ($hit["warn"] == 'yes') {
                        $id = (int) $x[uid];
                        $warnreason = "Auto Hit & Run Warning";
                        $warnaddedby = "System";
                        $added = warn_expiration(mktime(date('H') + 2, date('i'), date('s'), date('m'), date('d') + addslashes($hit["days1"]), date('Y')));
                        quickQuery('UPDATE ' . $TABLE_PREFIX . 'users SET warn="yes",warns=warns+1,warnreason="' . $warnreason . '",warnaddedby="' . $warnaddedby . '",warnadded="' . $added . '" WHERE id=' . $id);
                    }
                    // end warn at hit and run
                    // boot at hit and run
                    if ($hit["boot"] == 'yes') {
                        $id = (int) $x[uid];
                        $whybooted = "Auto Hit & Run Ban";
                        $whobooted = "System";
                        $addbooted = booted_expiration(mktime(date('H') + 2, date('i'), date('s'), date('m'), date('d') + addslashes($hit["days2"]), date('Y')));
                        quickQuery('UPDATE ' . $TABLE_PREFIX . 'users SET booted="yes", whybooted="' . $whybooted . '",whobooted="' . $whobooted . '",addbooted="' . $addbooted . '" WHERE id=' . $id);
                    }
                    // end boot at hit and run
                    //Dox Hack Start
                    $r = mysqli_query($GLOBALS["___mysqli_ston"], "SELECT id, filename, added FROM {$TABLE_PREFIX}dox WHERE added < '" . date('Y-m-d', strtotime('-' . $btit_settings["dox_del"] . ' weeks')) . "'");
                    while ($del = mysqli_fetch_array($r)) {
                        $MANNE = "{$BASEURL}/{$DOXPATH}";
                        @unlink("{$MANNE}/{$del['filename']}");
                        quickQuery("DELETE FROM {$TABLE_PREFIX}dox WHERE id={$del['id']}");
                    }
                    //Dox Hack End
                    // boot after warn at hit and run
                    if ($hit["warnboot"] == 'yes') {
                        $diem = do_sqlquery("SELECT warns FROM {$TABLE_PREFIX}users WHERE id={$x['uid']}");
                        $thuy = mysqli_fetch_array($diem);
                        if ($thuy["warns"] >= $hit["days3"]) {
                        }
                        $id = (int) $x[uid];
                        $whybooted = "Auto Hit & Run Ban after beeing warned";
                        $whobooted = "System";
                        $addbooted = booted_expiration(mktime(date('H') + 2, date('i'), date('s'), date('m'), date('d') + addslashes($hit["days2"]), date('Y')));
                        quickQuery('UPDATE ' . $TABLE_PREFIX . 'users SET booted="yes", whybooted="' . $whybooted . '",whobooted="' . $whobooted . '",addbooted="' . $addbooted . '" WHERE id=' . $id);
                    }
                    // end boot after warn at hit and run
                }
            }
            mysqli_free_result($r) || is_object($r) && get_class($r) == "mysqli_result" ? true : false;
            // Reward
            if ($hit["reward"] == 'yes') {
                $rr = mysqli_query($GLOBALS["___mysqli_ston"], "SELECT DISTINCT uid,infohash,punishment_amount FROM {$TABLE_PREFIX}history history inner join {$TABLE_PREFIX}users users on history.uid=users.id WHERE users.id_level=" . $hit["id_level"] . " AND hit='yes' AND completed='yes' AND hitchecked= 1 AND (seed>=( 3600 * " . $hit["min_seed_hours"] . ") or (history.uploaded/history.downloaded)>=" . $hit["min_ratio"] . ")");
                while ($xr = mysqli_fetch_array($rr)) {
                    @mysqli_query($GLOBALS["___mysqli_ston"], "Update {$TABLE_PREFIX}history SET hitchecked= 3 WHERE uid=" . $xr[uid] . " AND infohash='" . $xr[infohash] . "' AND hitchecked=1");
                    if (mysqli_affected_rows($GLOBALS["___mysqli_ston"]) > 0) {
                        @mysqli_query($GLOBALS["___mysqli_ston"], "Update {$TABLE_PREFIX}users SET uploaded=uploaded+(1048576 * " . $xr["punishment_amount"] . ")  WHERE id={$xr['uid']}");
                        send_pm(0, $xr[uid], sqlesc("Thanks (Punishement Removed)"), sqlesc("Thank you very much for seeding back the following torrent:\n\n [url]" . $BASEURL . "/index.php?page=details&id={$xr['infohash']}[/url] !\n\n [color=green]The punishment is now removed and you total upload amount increased by " . $xr["punishment_amount"] . " MB!  [/color]\n\n [color=purple]This is a automatic system message , so DO NOT reply ![/color]"));
                        // DT reputation system start
                        if ($setrep["rep_is_online"] == FALSE) {
                            //do nothing
                        } else {
                            @mysqli_query($GLOBALS["___mysqli_ston"], "UPDATE {$TABLE_PREFIX}users SET reputation = reputation + '{$plus}' WHERE id='{$x['uid']}'");
                        }
                        // DT reputation system end
                        // warn at hit and run
                        if ($hit["warn"] == 'yes') {
                            quickQuery('UPDATE ' . $TABLE_PREFIX . 'users SET warn="no", warns=warns-1 WHERE id=' . $xr[uid]);
                        }
                        // end warn at hit and run
                        // boot at hit and run
                        if ($hit["boot"] == 'yes') {
                            quickQuery('UPDATE ' . $TABLE_PREFIX . 'users SET booted="no" WHERE id=' . $xr[uid]);
                        }
                        // end boot at hit and run
                    }
                }
                mysqli_free_result($rr) || is_object($rr) && get_class($rr) == "mysqli_result" ? true : false;
            }
            // Who are fine should not be punished
            @mysqli_query($GLOBALS["___mysqli_ston"], "Update {$TABLE_PREFIX}history,users SET hitchecked= 1 WHERE history.uid=users.id AND users.id_level = users.id_level=" . $hit["id_level"] . " AND completed='yes' AND date < ( UNIX_TIMESTAMP( ) - (86400 * " . $hit["tolerance_days_before_punishment"] . ")) AND hitchecked= 0");
        }
        mysqli_free_result($levels) || is_object($levels) && get_class($levels) == "mysqli_result" ? true : false;
        mysqli_free_result($hasAntiHitRecord) || is_object($hasAntiHitRecord) && get_class($hasAntiHitRecord) == "mysqli_result" ? true : false;
        mysqli_free_result($hit_parameters) || is_object($hit_parameters) && get_class($hit_parameters) == "mysqli_result" ? true : false;
    }
    // End of Anti Hit and Run
    //Invalid Login System Hack Start
    mysqli_query($GLOBALS["___mysqli_ston"], "DELETE FROM {$TABLE_PREFIX}bannedip WHERE comment='max_number_of_invalid_logins_reached'");
    //invalid Login System Hack Stop
    //start freeleech
    $queryd = do_sqlquery("SELECT free_expire_date, free FROM `{$TABLE_PREFIX}files` WHERE `external`='no'", true);
    $configd = mysqli_fetch_array($queryd);
    $expire_dated = $configd['free_expire_date'];
    $expired = strtotime($expire_dated);
    $nowd = strtotime("now");
    if ($nowd >= $expired && $configd['free'] == 'yes') {
        do_sqlquery("UPDATE `{$TABLE_PREFIX}files` SET `free`='no',free_expire_date='0000-00-00 00:00:00' WHERE `external`='no'", true);
        do_sqlquery("ALTER TABLE `{$TABLE_PREFIX}files` CHANGE `free` `free` ENUM( 'yes', 'no' ) NULL DEFAULT 'no'", true);
        // xbtt
        if ($XBTT_USE) {
            do_sqlquery("UPDATE xbt_files SET down_multi=0, flags=2");
            do_sqlquery("ALTER TABLE xbt_files CHANGE `down_multi` `down_multi` INT NULL DEFAULT '0'", true);
        }
    }
    // end freeleech
    $query = do_sqlquery("SELECT * FROM `{$TABLE_PREFIX}lottery_config` WHERE `id`=1", true);
    $config = mysqli_fetch_array($query);
    $expire_date = $config['lot_expire_date'];
    $expire = strtotime($expire_date);
    $now = strtotime("now");
    if ($now >= $expire) {
        $number_winners = $config['lot_number_winners'];
        $number_to_win = $config['lot_number_to_win'];
        $minupload = $config['lot_amount'];
        $res = do_sqlquery("SELECT `id`, `user` FROM `{$TABLE_PREFIX}lottery_tickets` ORDER BY RAND(NOW()) LIMIT " . $number_winners . "", true);
        //select number of winners
        $total = mysqli_num_rows(do_sqlquery("SELECT * FROM `{$TABLE_PREFIX}lottery_tickets`", true));
        //select total selled tickets
        $pot = $total * $minupload;
        //selled tickets * ticket price
        $pot += $number_to_win;
        // ticket prize + minimum win
        $win = $pot / $number_winners;
        // prize for each winner
        $subject = sqlesc("You have won a prize with the lottery");
        //subject in pm
        $msg = sqlesc("Congratulations you have won a prize with our Lottery. Your prize has been added to your account. You won " . makesize($win) . "");
        //next 3 rows are the msg for PM
        $sender = $config['sender_id'];
        // Sender id, in my case 0
        //print the winners and send them PM en give them price
        while ($row = mysqli_fetch_array($res)) {
            $ras = do_sqlquery("SELECT `smf_fid`, `id`, `username` FROM `{$TABLE_PREFIX}users` WHERE `id`=" . $row['user'] . "", true);
            $raw = mysqli_fetch_array($ras);
            $rec = sqlesc("{$raw['id']}");
            $lotid = $raw["id"];
            $lotname = $raw["username"];
            do_sqlquery("UPDATE `{$TABLE_PREFIX}users` SET `uploaded`=uploaded+" . $win . " WHERE `id`=" . $row['user'] . "", true);
            $smf = mysqli_fetch_assoc(do_sqlquery("SELECT smf_fid, username FROM `{$TABLE_PREFIX}users` WHERE `id`=" . $row["user"] . "", true));
            send_pm($sender, $rec, $subject, $msg);
            // begin - announce winner in shoutbox
            do_sqlquery("INSERT INTO {$TABLE_PREFIX}chat (uid, time, name, text) VALUES (0," . time() . ", 'System','[color=red]Lottery winner : [/color][url={$BASEURL}/index.php?page=userdetails&id={$lotid}]" . $lotname . " did win " . makesize($win) . "[/url]')");
            // end - announce winner in shoutbox
            do_sqlquery("INSERT INTO `{$TABLE_PREFIX}lottery_winners` (`id`, `win_user`, `windate`, `price`) VALUES ('', '" . $raw['username'] . "', '" . $expire_date . "', '" . $win . "')");
        }
        do_sqlquery("TRUNCATE TABLE `{$TABLE_PREFIX}lottery_tickets`", true);
        do_sqlquery("UPDATE `{$TABLE_PREFIX}lottery_config` SET `lot_status`='closed' WHERE `id`=1", true);
    }
    // lottery auto start
    if ($btit_settings["autolot"] == TRUE) {
        $date_end = lastOfMonth();
        $klaar = $config["lot_status"];
        if ($klaar == 'closed') {
            $expire_date = $date_end;
            $expire_time = 23;
            $val1 = $expire_date . " " . $expire_time . ":59:59";
            $val2 = 1;
            $val3 = 15 * 1024 * 1024 * 1024;
            // Gb
            $val4 = 500 * 1024 * 1024;
            // Mb
            $val5 = 'yes';
            $val6 = 1;
            $val7 = 2;
            do_sqlquery("UPDATE `{$TABLE_PREFIX}lottery_config` SET `lot_expire_date`='" . $val1 . "', `lot_number_winners`='" . $val2 . "', `lot_number_to_win`='" . $val3 . "', `lot_amount`='" . $val4 . "', `lot_status`='" . $val5 . "', `limit_buy`='" . $val6 . "', `sender_id`=" . $val7 . " WHERE `id`=1", true);
        }
        // lottery end
    }
    // SANITY FOR TORRENTS
    $results = do_sqlquery("SELECT info_hash, seeds, leechers, dlbytes, filename FROM {$TABLE_PREFIX}files WHERE external='no'");
    $i = 0;
    while ($row = mysqli_fetch_row($results)) {
        list($hash, $seeders, $leechers, $bytes, $filename) = $row;
        $timeout = time() - intval($GLOBALS["report_interval"] * 2);
        // for testing purpose -- begin
        $resupd = do_sqlquery("SELECT * FROM {$TABLE_PREFIX}peers where lastupdate < " . $timeout . " AND infohash='{$hash}'");
        if (mysqli_num_rows($resupd) > 0) {
            while ($resupdate = mysqli_fetch_array($resupd)) {
                $uploaded = max(0, $resupdate["uploaded"]);
                $downloaded = max(0, $resupdate["downloaded"]);
                $pid = $resupdate["pid"];
                $ip = $resupdate["ip"];
                // update user->peer stats only if not livestat
                if (!$LIVESTATS) {
                    if ($PRIVATE_ANNOUNCE) {
                        quickQuery("UPDATE {$TABLE_PREFIX}users SET uploaded=uploaded+{$uploaded}, downloaded=downloaded+{$downloaded} WHERE pid='{$pid}' AND id>1 LIMIT 1");
                    } else {
                        // ip
                        quickQuery("UPDATE {$TABLE_PREFIX}users SET uploaded=uploaded+{$uploaded}, downloaded=downloaded+{$downloaded} WHERE cip='{$ip}' AND id>1 LIMIT 1");
                    }
                }
                // update dead peer to non active in history table
                if ($LOG_HISTORY) {
                    $resuser = do_sqlquery("SELECT id FROM {$TABLE_PREFIX}users WHERE " . ($PRIVATE_ANNOUNCE ? "pid='{$pid}'" : "cip='{$ip}'") . " ORDER BY lastconnect DESC LIMIT 1");
                    $curu = @mysqli_fetch_row($resuser);
                    quickquery("UPDATE {$TABLE_PREFIX}history SET active='no' WHERE uid={$curu['0']} AND infohash='{$hash}'");
                }
            }
        }
        // for testing purpose -- end
        quickQuery("DELETE FROM {$TABLE_PREFIX}peers where lastupdate < " . $timeout . " AND infohash='{$hash}'");
        quickQuery("UPDATE {$TABLE_PREFIX}files SET lastcycle='" . time() . "' WHERE info_hash='{$hash}'");
        $results2 = do_sqlquery("SELECT status, COUNT(status) from {$TABLE_PREFIX}peers WHERE infohash='{$hash}' GROUP BY status");
        $counts = array();
        while ($row = mysqli_fetch_row($results2)) {
            $counts[$row[0]] = 0 + $row[1];
        }
        quickQuery("UPDATE {$TABLE_PREFIX}files SET leechers=" . (isset($counts["leecher"]) ? $counts["leecher"] : 0) . ",seeds=" . (isset($counts["seeder"]) ? $counts["seeder"] : 0) . " WHERE info_hash=\"{$hash}\"");
        if ($bytes < 0) {
            quickQuery("UPDATE {$TABLE_PREFIX}files SET dlbytes=0 WHERE info_hash=\"{$hash}\"");
        }
    }
    //Auto Seedbox Start
    do_sqlquery("UPDATE {$TABLE_PREFIX}files SET `seedbox`='0' ");
    $sid = do_sqlquery("select * FROM {$TABLE_PREFIX}peers WHERE `ip` =" . $btit_settings["seedip"]);
    while ($sow = mysqli_fetch_array($sid)) {
        do_sqlquery("UPDATE {$TABLE_PREFIX}files SET `seedbox`='1' WHERE `info_hash`='{$sow['infohash']}'");
    }
    //Auto Seedbox End
    // END TORRENT'S SANITY
    //DT Uploader Medals
    global $btit_settings;
    do_sqlquery("UPDATE {$TABLE_PREFIX}users SET `up_med`='0' ");
    $time_B = 86400 * $btit_settings['UPD'];
    $time_E = strtotime(now);
    $time_D = $time_E - $time_B;
    $res = mysqli_query($GLOBALS["___mysqli_ston"], "SELECT uploader,count( * ) AS Count FROM {$TABLE_PREFIX}files WHERE UNIX_TIMESTAMP(data) > " . $time_D . " GROUP by uploader");
    while ($fetch_U = mysqli_fetch_array($res)) {
        if ($fetch_U['Count'] >= $btit_settings['UPB'] and $fetch_U['Count'] < $btit_settings['UPS']) {
            do_sqlquery("UPDATE {$TABLE_PREFIX}users SET `up_med`='1' WHERE `id`='{$fetch_U['uploader']}'");
        }
        if ($fetch_U['Count'] >= $btit_settings['UPS'] and $fetch_U['Count'] < $btit_settings['UPG']) {
            do_sqlquery("UPDATE {$TABLE_PREFIX}users SET `up_med`='2' WHERE `id`='{$fetch_U['uploader']}'");
        }
        if ($fetch_U['Count'] >= $btit_settings['UPG']) {
            do_sqlquery("UPDATE {$TABLE_PREFIX}users SET `up_med`='3' WHERE `id`='{$fetch_U['uploader']}'");
        }
    }
    //DT end Uploader Medals
    // high speed report
    if ($btit_settings["highswitch"] == TRUE) {
        if ($GLOBALS["XBTT_USE"]) {
            $resch = do_sqlquery("SELECT `uid` `id`, `up_rate` FROM `xbt_files_users` WHERE `up_rate` >= (" . $btit_settings["highspeed"] . "*1024) AND `active`=1");
        } else {
            $resch = do_sqlquery("SELECT `p`.`upload_difference`, `p`.`announce_interval`, `u`.`id` FROM `{$TABLE_PREFIX}peers` `p` LEFT JOIN `{$TABLE_PREFIX}users` `u` ON " . ($PRIVATE_ANNOUNCE ? "`p`.`pid`=`u`.`pid`" : "`p`.`ip`=`u`.`cip`") . " WHERE (`p`.`upload_difference`/`p`.`announce_interval`) >= (" . $btit_settings["highspeed"] . "*1024)");
        }
        if (@mysqli_num_rows($resch) > 0) {
            while ($rowch = mysqli_fetch_assoc($resch)) {
                if (!is_null($rowch["id"])) {
                    if ($GLOBALS["XBTT_USE"]) {
                        $transferrate = "Upload speed " . round($rowch["up_rate"] / 1024, 2) . " KB/sec ?!";
                    } else {
                        $transferrate = "Upload speed " . round(round($rowch['upload_difference'] / $rowch['announce_interval']) / 1024, 2) . " KB/sec ?!";
                    }
                    $high = $rowch["id"];
                    if ($btit_settings["highonce"] == TRUE) {
                        $once = do_sqlquery("SELECT `id` FROM `{$TABLE_PREFIX}reports` WHERE `addedby` = 0 AND `votedfor` = {$high} AND `type` = 'user' AND reason LIKE 'Upload speed%'");
                        if (@mysqli_num_rows($once) === FALSE) {
                            do_sqlquery("INSERT INTO `{$TABLE_PREFIX}reports` (`addedby`,`votedfor`,`type`,`reason`) VALUES ('0','{$high}','user', '{$transferrate}')");
                        }
                    }
                    if ($btit_settings["highonce"] == FALSE) {
                        do_sqlquery("INSERT INTO `{$TABLE_PREFIX}reports` (`addedby`,`votedfor`,`type`,`reason`) VALUES ('0','{$high}','user', '{$transferrate}')");
                    }
                }
            }
        }
    }
    // end high speed report
    // DT reputation system start
    $reput = do_sqlquery("SELECT * FROM {$TABLE_PREFIX}reputation_settings WHERE id =1");
    $setrep = mysqli_fetch_array($reput);
    if ($setrep["rep_is_online"] == FALSE or $setrep["rep_en_sys"] == FALSE) {
        //do nothing
    } else {
        // demote
        $rep_sub = sqlesc("You are Demoted!");
        $rep_msg = sqlesc($setrep["rep_dm_text"]);
        $rep_demotelist = mysqli_query($GLOBALS["___mysqli_ston"], "SELECT id FROM {$TABLE_PREFIX}users WHERE reputation < " . $setrep["rep_dm"] . " AND id_level = " . $setrep["rep_pr_id"]);
        while ($rep_demote = mysqli_fetch_assoc($rep_demotelist)) {
            mysqli_query($GLOBALS["___mysqli_ston"], "UPDATE {$TABLE_PREFIX}users SET id_level=" . $setrep["rep_dm_id"] . " WHERE id=" . $rep_demote["id"]);
            send_pm(0, $rep_demote[id], $rep_sub, $rep_msg);
        }
        // promote
        $rep_subj = sqlesc("You are Promoted!");
        $rep_mesg = sqlesc($setrep["rep_pm_text"]);
        $rep_promotelist = mysqli_query($GLOBALS["___mysqli_ston"], "SELECT id FROM {$TABLE_PREFIX}users WHERE reputation > " . $setrep["rep_pr"] . " AND id_level = " . $setrep["rep_dm_id"]);
        while ($rep_promote = mysqli_fetch_assoc($rep_promotelist)) {
            mysqli_query($GLOBALS["___mysqli_ston"], "UPDATE {$TABLE_PREFIX}users SET id_level=" . $setrep["rep_pr_id"] . " WHERE id=" . $rep_promote["id"]);
            send_pm(0, $rep_promote[id], $rep_subj, $rep_mesg);
        }
    }
    // DT reputation system start
    // Client Log for XBT
    if ($GLOBALS["XBTT_USE"]) {
        $timeout = time() - intval($GLOBALS["report_interval"] * 2);
        quickQuery("DELETE FROM `xbt_announce_log` WHERE `mtime`<={$timeout}");
        $res = mysqli_query($GLOBALS["___mysqli_ston"], "SELECT `u`.`id`, INET_NTOA(`al`.`ipa`) `ip`, `al`.`port`, LOWER(HEX(`al`.`peer_id`)) `peer_id`, `u`.`clientinfo` FROM `xbt_announce_log` `al` LEFT JOIN `{$TABLE_PREFIX}users` `u` ON `al`.`uid`=`u`.`id` WHERE `al`.`event`=2 GROUP BY `al`.`peer_id` ORDER BY `u`.`id` ASC");
        if (@mysqli_num_rows($res) > 0) {
            $old_clients = array();
            $current_clients = array();
            while ($row = mysqli_fetch_assoc($res)) {
                $client = getagent("", $row["peer_id"]);
                if (!empty($row["clientinfo"])) {
                    if (!array_key_exists($row["id"], $old_clients)) {
                        $old_clients[$row["id"]] = unserialize($row["clientinfo"]);
                    }
                    if (!array_key_exists($row["id"], $current_clients)) {
                        $current_clients[$row["id"]] = unserialize($row["clientinfo"]);
                    }
                } else {
                    if (!array_key_exists($row["id"], $old_clients)) {
                        $old_clients[$row["id"]] = array();
                    }
                    if (!array_key_exists($row["id"], $current_clients)) {
                        $current_clients[$row["id"]] = array();
                    }
                }
                if (!in_array($client . "[X]" . $row["port"], $current_clients[$row["id"]])) {
                    if (count($current_clients[$row["id"]]) == 20) {
                        unset($current_clients[$row["id"]][0]);
                        unset($current_clients[$row["id"]][1]);
                        $newlist = array();
                        foreach ($current_clients[$row["id"]] as $v) {
                            $newlist[] = $v;
                        }
                        $current_clients[$row["id"]] = $newlist;
                    }
                    $current_clients[$row["id"]][] = $client . "[X]" . $row["port"];
                    $current_clients[$row["id"]][] = time() . "[X]" . $row["ip"];
                }
            }
            foreach ($current_clients as $k => $v) {
                $s_old_clients = serialize($old_clients[$k]);
                $s_current_clients = serialize($current_clients[$k]);
                if ($s_old_clients != $s_current_clients) {
                    mysqli_query($GLOBALS["___mysqli_ston"], "UPDATE `{$TABLE_PREFIX}users` SET `clientinfo`='" . mysqli_real_escape_string($DBDT, $s_current_clients) . "' WHERE `id`={$k}");
                }
            }
        }
    }
    // Client Log for XBT
    // banbutton
    $timeout = $btit_settings["bandays"] * 86400;
    @mysqli_query($GLOBALS["___mysqli_ston"], "DELETE FROM `{$TABLE_PREFIX}signup_ip_block` WHERE (UNIX_TIMESTAMP() - `added`) > {$timeout}");
    // end banbutton
    # global language, $clean_interval, $reload_cfg_interval;
    global $language, $clean_interval, $reload_cfg_interval;
    require dirname(__FILE__) . '/khez.php';
    quickQuery('OPTIMIZE TABLE `' . $TABLE_PREFIX . 'khez_configs`;');
    # hacks can start here ==Khez==
    // warn-ban system with acp by DT
    global $XBTT_USE;
    $resset = mysqli_query($GLOBALS["___mysqli_ston"], "SELECT * FROM {$TABLE_PREFIX}low_ratio_ban_settings WHERE id ='1'");
    $art = mysqli_fetch_assoc($resset);
    $resban = mysqli_query($GLOBALS["___mysqli_ston"], "SELECT * FROM {$TABLE_PREFIX}low_ratio_ban ");
    while ($ban = mysqli_fetch_assoc($resban)) {
        if ($art["wb_sys"] == TRUE) {
            if ($XBTT_USE) {
                $udownloaded = "u.downloaded+IFNULL(x.downloaded,0)";
                $uuploaded = "u.uploaded+IFNULL(x.uploaded,0)";
                $utables = "{$TABLE_PREFIX}users u LEFT JOIN xbt_users x ON x.uid=u.id";
            } else {
                $udownloaded = "u.downloaded";
                $uuploaded = "u.uploaded";
                $utables = "{$TABLE_PREFIX}users u";
            }
            $min_dl = $ban["wb_down"] * 1024 * 1024 * 1024;
            // find bad users 1
            $demotelist = mysqli_query($GLOBALS["___mysqli_ston"], "SELECT id FROM {$utables} WHERE {$udownloaded}  > " . $min_dl . " AND {$uuploaded}/{$udownloaded} <= " . $ban["wb_one"] . " AND id_level=" . $ban["wb_rank"] . " AND rat_warn_level = 0 ");
            while ($demote = mysqli_fetch_assoc($demotelist)) {
                // warn bad users 1
                do_sqlquery("UPDATE {$TABLE_PREFIX}users SET rat_warn_level = 1 , rat_warn_time = NOW() WHERE id=" . $demote["id"]);
                // DT reputation system start
                $reput = do_sqlquery("SELECT * FROM {$TABLE_PREFIX}reputation_settings WHERE id =1");
                $setrep = mysqli_fetch_array($reput);
                $plus = $setrep["rep_minrep"];
                if ($setrep["rep_is_online"] == FALSE) {
                    //do nothing
                } else {
                    @mysqli_query($GLOBALS["___mysqli_ston"], "UPDATE {$TABLE_PREFIX}users SET reputation = reputation - '{$plus}' WHERE id='{$demote['id']}'");
                }
                // DT reputation system end
                // send pm bad users 1
                $sub = sqlesc("Low Ratio Warning!");
                $msg = sqlesc($art["wb_text_one"]);
                send_pm(0, $demote[id], $sub, $msg);
                // add warn symbol 1
                if ($ban["wb_warn"] == TRUE) {
                    $id = $demote["id"];
                    $warnreason = "Low Ratio Warning";
                    $warnaddedby = "System";
                    $added = warn_expiration(mktime(date('H') + 2, date('i'), date('s'), date('m'), date('d') + addslashes($ban['wb_days_one']), date('Y')));
                    quickQuery('UPDATE ' . $TABLE_PREFIX . 'users SET warn="yes",warns=warns+1,warnreason="' . $warnreason . '",warnaddedby="' . $warnaddedby . '",warnadded="' . $added . '" WHERE id=' . $id);
                }
            }
            // time date stuff
            $time_AA = 86400 * $ban['wb_days_one'];
            $time_BB = strtotime(now);
            $time_CC = $time_BB - $time_AA;
            // find bad users 2
            $demotelistt = mysqli_query($GLOBALS["___mysqli_ston"], "SELECT id,rat_warn_time FROM {$utables} WHERE {$udownloaded}  > " . $min_dl . " AND {$uuploaded}/{$udownloaded} <= " . $ban["wb_two"] . " AND id_level=" . $ban["wb_rank"] . " AND rat_warn_level = 1 ");
            while ($demotee = mysqli_fetch_assoc($demotelistt)) {
                $time_DD = strtotime($demotee["rat_warn_time"]);
                if ($time_DD <= $time_CC) {
                    // warn bad users 2
                    do_sqlquery("UPDATE {$TABLE_PREFIX}users SET rat_warn_level = 2 , rat_warn_time = NOW() WHERE id=" . $demotee["id"]);
                    // DT reputation system start
                    $reput = do_sqlquery("SELECT * FROM {$TABLE_PREFIX}reputation_settings WHERE id =1");
                    $setrep = mysqli_fetch_array($reput);
                    $plus = $setrep["rep_minrep"];
                    if ($setrep["rep_is_online"] == FALSE) {
                        //do nothing
                    } else {
                        @mysqli_query($GLOBALS["___mysqli_ston"], "UPDATE {$TABLE_PREFIX}users SET reputation = reputation - '{$plus}' WHERE id='{$demotee['id']}'");
                    }
                    // DT reputation system end
                    // send pm bad users 2
                    $sub = sqlesc("Low Ratio Warning Two!");
                    $msg = sqlesc($art["wb_text_two"]);
                    send_pm(0, $demotee[id], $sub, $msg);
                    // add warn symbol 2
                    if ($ban["wb_warn"] == TRUE) {
                        $warnreason = "Low Ratio Warning";
                        $warnaddedby = "System";
                        $added = warn_expiration(mktime(date('H') + 2, date('i'), date('s'), date('m'), date('d') + addslashes($ban['wb_days_two']), date('Y')));
                        quickQuery('UPDATE ' . $TABLE_PREFIX . 'users SET warn="yes",warns=warns+1,warnreason="' . $warnreason . '",warnaddedby="' . $warnaddedby . '",warnadded="' . $added . '" WHERE id=' . $id);
                    }
                }
            }
            // unwarn user who did improve
            $unwarnone = mysqli_query($GLOBALS["___mysqli_ston"], "SELECT id,rat_warn_time FROM {$utables} WHERE {$udownloaded}  > " . $min_dl . " AND {$uuploaded}/{$udownloaded} > " . $ban["wb_one"] . " AND id_level=" . $ban["wb_rank"] . " AND rat_warn_level = 1 ");
            while ($unwarna = mysqli_fetch_assoc($unwarnone)) {
                $iid = $unwarna["id"];
                quickQuery('UPDATE ' . $TABLE_PREFIX . 'users SET rat_warn_level=rat_warn_level-1 WHERE id=' . $iid);
            }
            // time date stuff
            $time_EE = 86400 * $ban['wb_days_two'];
            $time_FF = $time_BB - $time_EE;
            // find bad users 3
            $demotelisttt = mysqli_query($GLOBALS["___mysqli_ston"], "SELECT id,rat_warn_time FROM {$utables} WHERE {$udownloaded}  > " . $min_dl . " AND {$uuploaded}/{$udownloaded} <= " . $ban["wb_three"] . " AND id_level=" . $ban["wb_rank"] . " AND rat_warn_level = 2 ");
            while ($demoteee = mysqli_fetch_assoc($demotelisttt)) {
                $time_GG = strtotime($demoteee["rat_warn_time"]);
                if ($time_GG <= $time_FF) {
                    // warn bad users 3
                    do_sqlquery("UPDATE {$TABLE_PREFIX}users SET rat_warn_level = 3 , rat_warn_time = NOW() WHERE id=" . $demoteee["id"]);
                    // DT reputation system start
                    $reput = do_sqlquery("SELECT * FROM {$TABLE_PREFIX}reputation_settings WHERE id =1");
                    $setrep = mysqli_fetch_array($reput);
                    $plus = $setrep["rep_minrep"];
                    if ($setrep["rep_is_online"] == FALSE) {
                        //do nothing
                    } else {
                        @mysqli_query($GLOBALS["___mysqli_ston"], "UPDATE {$TABLE_PREFIX}users SET reputation = reputation - '{$plus}' WHERE id='{$demoteee['id']}'");
                    }
                    // DT reputation system end
                    // send pm bad users 3
                    $sub = sqlesc("Final Low Ratio Warning!");
                    $msg = sqlesc($art["wb_text_fin"]);
                    send_pm(0, $demoteee[id], $sub, $msg);
                    // add warn symbol 3
                    if ($ban["wb_warn"] == TRUE) {
                        $id = $demoteee["id"];
                        $warnreason = "Low Ratio Warning";
                        $warnaddedby = "System";
                        $added = warn_expiration(mktime(date('H') + 2, date('i'), date('s'), date('m'), date('d') + addslashes($ban['wb_days_fin']), date('Y')));
                        quickQuery('UPDATE ' . $TABLE_PREFIX . 'users SET warn="yes",warns=warns+1,warnreason="' . $warnreason . '",warnaddedby="' . $warnaddedby . '",warnadded="' . $added . '" WHERE id=' . $id);
                    }
                }
            }
            // unwarn user who did improve 2
            $unwarntwo = mysqli_query($GLOBALS["___mysqli_ston"], "SELECT id,rat_warn_time FROM {$utables} WHERE {$udownloaded}  > " . $min_dl . " AND {$uuploaded}/{$udownloaded} > " . $ban["wb_two"] . " AND id_level=" . $ban["wb_rank"] . " AND rat_warn_level = 2 ");
            while ($unwarnb = mysqli_fetch_assoc($unwarntwo)) {
                $oid = $unwarnb["id"];
                quickQuery('UPDATE ' . $TABLE_PREFIX . 'users SET rat_warn_level=rat_warn_level-2 WHERE id=' . $oid);
            }
            // time date stuff
            $time_HH = 86400 * $ban['wb_days_fin'];
            $time_II = $time_BB - $time_HH;
            // find bad users 4
            $demotelistttt = mysqli_query($GLOBALS["___mysqli_ston"], "SELECT id,rat_warn_time FROM {$utables} WHERE {$udownloaded}  > " . $min_dl . " AND {$uuploaded}/{$udownloaded} <= " . $ban["wb_fin"] . " AND id_level=" . $ban["wb_rank"] . " AND rat_warn_level = 3 ");
            while ($demoteeee = mysqli_fetch_assoc($demotelistttt)) {
                $time_JJ = strtotime($demoteeee["rat_warn_time"]);
                if ($time_JJ <= $time_II) {
                    // ban bad users 4
                    if ($btit_settings["en_sys"] == TRUE) {
                        do_sqlquery("UPDATE {$TABLE_PREFIX}users SET rat_warn_level = 4 ,rat_warn_time = NOW(), id_level=" . $btit_settings["dm_id"] . " WHERE id=" . $demoteeee["id"]);
                    } else {
                        do_sqlquery("UPDATE {$TABLE_PREFIX}users SET rat_warn_level = 4 ,rat_warn_time = NOW(), bandt='yes' WHERE id=" . $demoteeee["id"]);
                    }
                }
            }
            // unwarn user who did improve last
            $unwarnthree = mysqli_query($GLOBALS["___mysqli_ston"], "SELECT id,rat_warn_time FROM {$utables} WHERE {$udownloaded}  > " . $min_dl . " AND {$uuploaded}/{$udownloaded} > " . $ban["wb_three"] . " AND id_level=" . $ban["wb_rank"] . " AND rat_warn_level = 3 ");
            while ($unwarnc = mysqli_fetch_assoc($unwarnthree)) {
                $lid = $unwarnc["id"];
                quickQuery('UPDATE ' . $TABLE_PREFIX . 'users SET rat_warn_level=rat_warn_level-3 WHERE id=' . $lid);
            }
        }
    }
    // warn-ban system with acp end
    //  optimize peers table
    quickQuery("OPTIMIZE TABLE {$TABLE_PREFIX}peers");
    // delete readposts when topic don't exist or deleted  *** should be done by delete, just in case
    quickQuery("DELETE readposts FROM {$TABLE_PREFIX}readposts LEFT JOIN topics ON readposts.topicid = topics.id WHERE topics.id IS NULL");
    // delete readposts when users was deleted *** should be done by delete, just in case
    quickQuery("DELETE readposts FROM {$TABLE_PREFIX}readposts LEFT JOIN users ON readposts.userid = users.id WHERE users.id IS NULL");
    // deleting orphan image in captcha folder (if image code is enabled)
    $CAPTCHA_FOLDER = realpath("{$CURRENTPATH}/../{$CAPTCHA_FOLDER}");
    if ($dir = @opendir($CAPTCHA_FOLDER . "/")) {
        while (false !== ($file = @readdir($dir))) {
            if ($ext = substr(strrchr($file, "."), 1) == "png") {
                unlink("{$CAPTCHA_FOLDER}/{$file}");
            }
        }
        @closedir($dir);
    }
    quickQuery("UPDATE `{$TABLE_PREFIX}users` SET `birthday_bonus`=0 WHERE DAYOFMONTH(`dob`)!=" . date('j'));
    $res = mysqli_query($GLOBALS["___mysqli_ston"], "SELECT `u`.`id`, `u`.`dob`,`l`.`language_url` FROM `{$TABLE_PREFIX}users` `u` LEFT JOIN `language` `l` ON `u`.`language`=`l`.`id` WHERE DAYOFMONTH(`u`.`dob`)=" . date('j') . " AND MONTH(`u`.`dob`)=" . date('n') . " AND `u`.`dob`!=CURDATE() AND `u`.`birthday_bonus`=0 ORDER BY `l`.`language_url` ASC");
    if (@mysqli_num_rows($res) > 0) {
        global $THIS_BASEPATH;
        $firstrun = 1;
        $englang = "language/english";
        $templang = $englang;
        require_once $THIS_BASEPATH . "/" . $englang . "/lang_main.php";
        while ($row = mysqli_fetch_assoc($res)) {
            if ($row["language_url"] != $templang) {
                if ($firstrun != 1) {
                    // Reset the language to English before loading the new language
                    require_once $THIS_BASEPATH . "/" . $englang . "/lang_main.php";
                }
                // Load the new language etc.
                require_once $THIS_BASEPATH . "/" . $row["language_url"] . "/lang_main.php";
                $templang = $row["language_url"];
                $firstrun = 0;
            }
            $dob = explode("-", $row["dob"]);
            $age = userage($dob[0], $dob[1], $dob[2]);
            $bonus = round($age * $btit_settings["birthday_bonus"] * 1073741824);
            $query1 = "UPDATE `{$TABLE_PREFIX}users` SET `uploaded`=`uploaded`+{$bonus}, `birthday_bonus`=1 WHERE `id`=" . $row["id"];
            quickQuery($query1);
            send_pm(0, $row["id"], addslashes($language["HB_SUBJECT"]), addslashes($language["HB_MESSAGE_1"] . makesize($bonus) . $language["HB_MESSAGE_2"] . $btit_settings["birthday_bonus"] . $language["HB_MESSAGE_3"]));
        }
    }
    //timed rank
    $datetimedt = date("Y-m-d H:i:s");
    $rankstats = mysqli_query($GLOBALS["___mysqli_ston"], "SELECT * FROM {$TABLE_PREFIX}users WHERE timed_rank < '{$datetimedt}' AND rank_switch='yes'");
    while ($arrdt = mysqli_fetch_assoc($rankstats)) {
        if (mysqli_num_rows($rankstats) > 0) {
            $res6 = mysqli_query($GLOBALS["___mysqli_ston"], "SELECT level FROM {$TABLE_PREFIX}users_level WHERE id ='{$arrdt['old_rank']}'");
            $arr6 = mysqli_fetch_assoc($res6);
            $oldrank = $arr6[level];
            $subj = sqlesc("Your timed rank is expired !");
            $msg = sqlesc("Your timed rank is expired !\n\n Your rank did changed back to " . $oldrank . "\n\n [color=red]This is a automatic system message , so DO NOT reply ![/color]");
            send_pm(0, $arrdt["id"], $subj, $msg);
            mysqli_query($GLOBALS["___mysqli_ston"], "UPDATE {$TABLE_PREFIX}users SET rank_switch='no', id_level = old_rank WHERE id='{$arrdt['id']}'") or sqlerr();
        }
    }
    //timed rank end
    //begin invitation system by dodge
    global $INV_EXPIRES;
    $deadtime = $INV_EXPIRES * 86400;
    $user = do_sqlquery("SELECT inviter FROM {$TABLE_PREFIX}invitations WHERE time_invited < DATE_SUB(NOW(), INTERVAL {$deadtime} SECOND)");
    @($arr = mysqli_fetch_assoc($user));
    if (mysqli_num_rows($user) > 0) {
        mysqli_query($GLOBALS["___mysqli_ston"], "UPDATE {$TABLE_PREFIX}users SET invitations=invitations+1 WHERE id = '" . $arr["inviter"] . "'");
        mysqli_query($GLOBALS["___mysqli_ston"], "DELETE FROM {$TABLE_PREFIX}invitations WHERE inviter = '" . $arr["inviter"] . "' AND time_invited < DATE_SUB(NOW(), INTERVAL {$deadtime} SECOND)");
    }
    //end invitation system
    do_updateranks();
    // auto ext update
    $num_torrents_to_update = 5;
    $torrents = get_result("SELECT `announces`, `info_hash` FROM `{$TABLE_PREFIX}files` WHERE `external`='yes' ORDER BY `lastupdate` DESC LIMIT " . $num_torrents_to_update);
    if (count($torrents) > 0) {
        require_once "getscrape.php";
        for ($i = 0; $i < count($torrents); $i++) {
            $announces = @unserialize($torrents[$i]['announces']) ? unserialize($torrents[$i]['announces']) : array();
            if (count($announces) > 0) {
                $keys = array_keys($announces);
                $random = mt_rand(0, count($keys) - 1);
                $url = $keys[$random];
                scrape($url, $torrents[$i]['info_hash']);
            }
        }
    }
    // auto ext update
    // OK We're finished, let's reset max_execution_time and memory_limit back to the php.ini defaults
    @ini_restore("max_execution_time");
    @ini_restore("memory_limit");
}
Example #15
0
$action = $_GET['action'];
$returnto = "index.php?page=admin&user="******"uid"] . "&code=" . $CURUSER["random"] . "&do=lottery_settings";
if ($action == 'send') {
    $expire_date = $_POST['expire_date'];
    $expire_time = $_POST['expire_time'];
    $val1 = $expire_date . " " . $expire_time . ":00:00";
    $val2 = $_POST['number_winners'];
    $val3 = $_POST['min_amout_to_win'] * 1024 * 1024 * 1024;
    // Gb
    $val4 = $_POST['amount_to_pay'] * 1024 * 1024;
    // Mb
    $val5 = $_POST["enabled"] ? "yes" : "no";
    $val6 = $_POST['limit_buy'];
    $val7 = $_POST['sender_id'];
    do_sqlquery("UPDATE `{$TABLE_PREFIX}lottery_config` SET `lot_expire_date`='" . $val1 . "', `lot_number_winners`='" . $val2 . "', `lot_number_to_win`='" . $val3 . "', `lot_amount`='" . $val4 . "', `lot_status`='" . $val5 . "', `limit_buy`='" . $val6 . "', `sender_id`=" . $val7 . " WHERE `id`=1", true);
    header("Location: {$BASEURL}/{$returnto}");
} else {
    $query = do_sqlquery("SELECT * FROM `{$TABLE_PREFIX}lottery_config` WHERE `id`=1", true);
    $row = mysqli_fetch_array($query);
    $admintpl->set("language", $language);
    $admintpl->set("frm_action", "index.php?page=admin&amp;user="******"uid"] . "&amp;code=" . $CURUSER["random"] . "&amp;do=lottery_settings&amp;action=send");
    $admintpl->set("expire_date", substr($row["lot_expire_date"], 0, -9));
    $admintpl->set("expire_time", substr($row["lot_expire_date"], -8, -6));
    $admintpl->set("number_winners", $row["lot_number_winners"]);
    $admintpl->set("amount_to_pay", substr(makesize($row["lot_amount"]), 0, -6));
    $admintpl->set("amount_to_win", substr(makesize($row["lot_number_to_win"]), 0, -6));
    $admintpl->set("limit_to_buy", $row["limit_buy"]);
    $admintpl->set("sender_id", $row["sender_id"]);
    $admintpl->set("lottery_enabled", $row["lot_status"] == "yes" ? "checked=\"checked\"" : "");
    $admintpl->set("view_selled_tickets", "index.php?page=admin&amp;user="******"uid"] . "&amp;code=" . $CURUSER["random"] . "&amp;do=view_selled_tickets");
}
Example #16
0
//echo $pagertop;
if (mysql_num_rows($res) == 0) {
    $votesviewtpl->set("vv2", "<p align=center><b>Nothing Found</b></p>\n");
} else {
    $votesviewtpl->set("vv3", "<center><table width=99% class=lista align=center cellpadding=3>\n");
    $votesviewtpl->set("vv4", "<tr><td class=header>Username</td><td class=header>Uploaded</td><td class=header>Downloaded</td>" . "<td class=header>Ratio</td>\n");
    while ($arr = mysql_fetch_assoc($res)) {
        if ($arr["downloaded"] > 0) {
            $ratio = number_format($arr["uploaded"] / $arr["downloaded"], 3);
            //$ratio = "<font color=" . get_ratio_color($ratio) . ">$ratio</font>";
        } else {
            if ($arr["uploaded"] > 0) {
                $ratio = "Inf.";
            } else {
                $ratio = "---";
            }
        }
        $uploaded = makesize($arr["uploaded"]);
        $joindate = "{$arr['added']} (" . get_elapsed_time(sql_timestamp_to_unix_timestamp($arr["added"])) . " ago)";
        $downloaded = makesize($arr["downloaded"]);
        if ($arr["enabled"] == 'no') {
            $enabled = "<font color = red>No</font>";
        } else {
            $enabled = "<font color = green>Yes</font>";
        }
        $req[$i]["vv5"] = "<tr><td class=lista><center><a href=index.php?page=userdetails&id={$arr['userid']}><b>{$arr['username']}</b></a></td><td align=left class=lista><center>{$uploaded}</td><td align=left class=lista><center>{$downloaded}</td><td align=left class=lista><center>{$ratio}</td></tr>\n";
        $i++;
    }
    $votesviewtpl->set("req", $req);
    $votesviewtpl->set("vv6", "</table></center><BR><BR>\n");
}
Example #17
0
         if ($results["visible"] == $row['id_level']) {
             $selected = 'selected';
         } else {
             $selected = '';
         }
         $torrent['visible'] .= "<option value=" . $row['id_level'] . " " . $selected . ">" . $row['level'] . "</option>";
     }
 }
 $torrent['visible'] .= "</select>";
 /*End sticky by losmi*/
 $torrent["link"] = "index.php?page=edit&info_hash=" . $results["info_hash"] . "&returnto=" . urlencode($link);
 $torrent["filename"] = $results["filename"];
 $torrent["tag"] = $results["tag"];
 $torrent["info_hash"] = $results["info_hash"];
 $torrent["description"] = textbbcode("edit", "comment", unesc($results["comment"]));
 $torrent["size"] = makesize($results["size"]);
 include dirname(__FILE__) . "/include/offset.php";
 $torrent["date"] = date("d/m/Y", $results["data"] - $offset);
 $torrent["complete"] = $results["finished"] . " " . $language["X_TIMES"];
 $torrent["peers"] = $language["SEEDERS"] . ": " . $results["seeds"] . "," . $language["LEECHERS"] . ": " . $results["leechers"] . "=" . ($results["leechers"] + $results["seeds"]) . " " . $language["PEERS"];
 $torrent["cat_combo"] = categories($results["cat_name"]);
 //$s;
 if ($CURUSER['edit_torrents'] == "yes" && $CURUSER['moderate_trusted'] == 'yes') {
     switch ($moder_status) {
         case 'ok':
             $checked1 = "SELECTED";
             break;
         case 'bad':
             $checked2 = "SELECTED";
             break;
         case 'um':
Example #18
0
                $ratio = "---";
            }
        }
        $uploaded = makesize($arr["uploaded"]);
        $downloaded = makesize($arr["downloaded"]);
        if ($CURUSER[uid] == $arr[userid]) {
            $bg = "class=blocklist";
        } else {
            $bg = "class=main";
        }
        $all = $arz[win] - $arz[lost];
        if ($all < 0) {
            $all = $all * -1;
            $minus = "-";
        }
        if ($arz[enableplay] == "yes") {
            $arz[enableplay] = "<font color=green>Yes</font>";
        } else {
            $arz[enableplay] = "<font color=red>No</font>";
        }
        if ($edit == 0) {
            print "<tr><td {$bg} align=center><a href=index.php?page=userdetails&id={$arr['userid']}><center><b>{$arr['username']}</b></a></center></td><td align=center {$bg}><center>{$uploaded}</center></td><td align=center {$bg}><center>{$downloaded}</center></td><td  align=center {$bg}><center>{$ratio}</center></td><td align=center {$bg}><center>" . makesize($arz[deposit]) . "</center></td><td  align=center {$bg}><center>" . makesize($arz[win]) . "</center></td><td  align=center {$bg}><center>" . makesize($arz[lost]) . "</center></td><td align=center {$bg}><center>{$arz['trys']}</center></td><td  align=center {$bg}><center> {$minus}" . makesize($all) . "</center></td><td  align=center {$bg}><center>{$arz['enableplay']}</center></td></tr>\n";
        } else {
            print "<tr><td {$bg} align=center><a href=index.php?page=userdetails&id={$arr['userid']}><center><b>{$arr['username']}</b></a></center></td><td  align=center {$bg}><center>{$uploaded}</center></td><td  align=center {$bg}><center>{$downloaded}</center></td><td  align=center {$bg}><center>{$ratio}</center></td><td align=center {$bg}><center>" . makesize($arz[deposit]) . "</center></td><td  align=center {$bg}><center>" . makesize($arz[win]) . "</center></td><td  align=center {$bg}><center>" . makesize($arz[lost]) . "</center></td><td  align=center {$bg}><center>{$arz['trys']}</center></td><td  align=center {$bg}><center> {$minus}" . makesize($all) . "</center></td><td  align=center {$bg}><center>{$arz['enableplay']}</center></td><td  align=center {$bg}><form name=edit-player method=post action=index.php?page=modules&module=casino&action=edit><input type=hidden name=userid value={$arr['userid']}> <input class=btn type=submit value=edit ></form></td></tr>\n";
        }
    }
    print "</table>\n";
    print "</div>";
    //end_frame();
    print "<br/>";
}
Example #19
0
        $lvl = $level[0];
        if (!$subrow[uid]) {
            $title = "orphaned";
        } elseif (!"{$subrow['custom_title']}") {
            $title = "" . $lvl['level'] . "";
        } else {
            $title = unesc($subrow["custom_title"]);
        }
        $comments[$count]["user"] = "******"index.php?page=userdetails&amp;id=" . $subrow["uid"] . "\">" . unesc($subrow["user"]) . warn($row) . "</a>";
        $comments[$count]["user"] .= "</a><br/> " . $title;
        $comments[$count]["date"] = date("d/m/Y H.i.s", $subrow["data"] - $offset);
        $comments[$count]["elapsed"] = "(" . get_elapsed_time($subrow["data"]) . " ago)";
        $comments[$count]["avatar"] = "<img onload=\"resize_avatar(this);\" src=\"" . ($subrow["avatar"] && $subrow["avatar"] != "" ? htmlspecialchars($subrow["avatar"]) : "{$STYLEURL}/images/default_avatar.gif") . "\" alt=\"\" />";
        $comments[$count]["ratio"] = "<img src=\"images/arany.png\">&nbsp;" . (intval($subrow['downloaded']) > 0 ? number_format($subrow['uploaded'] / $subrow['downloaded'], 2) : "---");
        $comments[$count]["uploaded"] = "<img src=\"images/speed_up.png\">&nbsp;" . makesize($subrow["uploaded"]);
        $comments[$count]["downloaded"] = "<img src=\"images/speed_down.png\">&nbsp;" . makesize($subrow["downloaded"]);
        // only users able to delete torrents can delete comments...
        if ($CURUSER["delete_torrents"] == "yes") {
            $comments[$count]["delete"] = "<a onclick=\"return confirm('" . str_replace("'", "\\'", $language["DELETE_CONFIRM"]) . "')\" href=\"index.php?page=comment&amp;id=" . $row["info_hash"] . "&amp;cid=" . $subrow["id"] . "&amp;action=delete\">" . image_or_link("{$STYLEPATH}/images/delete.png", "", $language["DELETE"]) . "</a>";
        }
        $comments[$count]["comment"] = format_comment($subrow["text"]);
        $count++;
    }
    unset($subrow);
    unset($subres);
}
$torrenttpl->set("current_username", $CURUSER["username"]);
if ($GLOBALS["usepopup"]) {
    $torrenttpl->set("torrent_footer", "<a href=\"javascript: window.close();\">" . $language["CLOSE"] . "</a>");
} else {
    $torrenttpl->set("torrent_footer", "<a href=\"javascript: history.go(-1);\">" . $language["BACK"] . "</a>");
Example #20
0
         }
         $torhistory[$i]["ratio"] = unesc($peerratio);
         $torhistory[$i]["seedscolor"] = linkcolor($torlist['seeds']);
         $torhistory[$i]["seeds"] = "<a href=\"javascript:poppeer('index.php?page=peers&amp;id=" . $torlist['info_hash'] . "')\">" . $torlist['seeds'] . "</a>";
         $torhistory[$i]["leechcolor"] = linkcolor($torlist['leechers']);
         $torhistory[$i]["leechs"] = "<a href=\"javascript:poppeer('index.php?page=peers&amp;id=" . $torlist['info_hash'] . "')\">" . $torlist['leechers'] . "</a>";
         $torhistory[$i]["completed"] = "<a href=\"javascript:poppeer('index.php?page=torrent_history&amp;id=" . $torlist['info_hash'] . "\">" . $torlist['finished'] . "</a>";
         $i++;
         $userdetailtpl->set("torhistory", $torhistory);
     } else {
         $torhistory[$i]["filename"] = "<a href=\"index.php?page=torrent-details&amp;id=" . $torlist['info_hash'] . "\" title=\"" . $language["VIEW_DETAILS"] . ": " . $torlist['filename'] . "\">" . $filename . "</a>";
         $torhistory[$i]["size"] = makesize($torlist['size']);
         $torhistory[$i]["agent"] = htmlspecialchars($torlist['agent']);
         $torhistory[$i]["status"] = $torlist['active'] == 'yes' ? $language["ACTIVATED"] : 'Stopped';
         $torhistory[$i]["downloaded"] = makesize($torlist['downloaded']);
         $torhistory[$i]["uploaded"] = makesize($torlist['uploaded']);
         if ($torlist['downloaded'] > 0) {
             $peerratio = number_format($torlist['uploaded'] / $torlist['downloaded'], 2);
         } else {
             $peerratio = '&#8734;';
         }
         $torhistory[$i]["ratio"] = unesc($peerratio);
         $torhistory[$i]["seedscolor"] = linkcolor($torlist['seeds']);
         $torhistory[$i]["seeds"] = "<a href=\"index.php?page=peers&amp;id=" . $torlist['info_hash'] . "\">" . $torlist['seeds'] . "</a>";
         $torhistory[$i]["leechcolor"] = linkcolor($torlist['leechers']);
         $torhistory[$i]["leechs"] = "<a href=\"index.php?page=peers&amp;id=" . $torlist['info_hash'] . "\">" . $torlist['leechers'] . "</a>";
         $torhistory[$i]["completed"] = "<a href=\"index.php?page=torrent_history&amp;id=" . $torlist['info_hash'] . "\">" . $torlist['finished'] . "</a>";
         $i++;
         $userdetailtpl->set("torhistory", $torhistory);
     }
 }
Example #21
0
            $admintpl->set("frm_action", "index.php?page=admin&amp;user="******"uid"] . "&amp;code=" . $CURUSER["random"] . "&amp;do=dbutil&amp;action=tables");
            $i = 0;
            $bytes = 0;
            $records = 0;
            $overhead = 0;
            $tables = array();
            // display current status for tables
            while ($tstatus = mysql_fetch_array($dbstatus)) {
                $tables[$i]["name"] = $tstatus['Name'];
                $tables[$i]["rows"] = $tstatus['Rows'];
                $tables[$i]["length"] = makesize($tstatus['Data_length'] + $tstatus['Index_length']);
                $tables[$i]["overhead"] = $tstatus['Data_free'] == 0 ? "-" : makesize($tstatus['Data_free']);
                $i++;
                $bytes += $tstatus['Data_length'] + $tstatus['Index_length'];
                $records += $tstatus['Rows'];
                $overhead += $tstatus['Data_free'];
            }
            $admintpl->set("language", $language);
            $admintpl->set("tables", $tables);
            $admintpl->set("db_status", true, true);
            $admintpl->set("table_count", $i);
            $admintpl->set("table_bytes", makesize($bytes));
            $admintpl->set("table_records", $records);
            $admintpl->set("table_overhead", makesize($overhead));
            unset($tables);
            unset($bytes);
            unset($records);
            unset($overhead);
        }
        break;
}
Example #22
0
 $idi = mysqli_query($GLOBALS["___mysqli_ston"], "select prefixcolor, suffixcolor FROM {$TABLE_PREFIX}users_level WHERE id =" . $rowt["id_level"]);
 $rowti = mysqli_fetch_array($idi);
 $seedbox[$i]["sw15"] = "</td>";
 if ($GLOBALS["usepopup"]) {
     $seedbox[$i]["sw16"] = "<td width=60% class=\"lista\" style=\"padding-left:10px;\"><a href=\"javascript:popdetails('index.php?page=torrent-details&amp;id=" . $data['hash'] . "');\" title=\"" . $language["VIEW_DETAILS"] . ": " . $data["filename"] . "\">" . $data["filename"] . "</a></td>";
 } else {
     $seedbox[$i]["sw17"] = "<TD align=\"left\" class=\"lista\" style=\"padding-left:10px;\"><A HREF=\"index.php?page=torrent-details&amp;id=" . $data["hash"] . "\" title=\"" . $language["VIEW_DETAILS"] . ": " . $data["filename"] . "\">" . $data["filename"] . "</A></td>";
 }
 $seedbox[$i]["sw18"] = "<td align=\"center\" class=\"lista\" style=\"text-align: center;\"><a href=\"index.php?page=torrents&amp;category={$data['catid']}\">" . image_or_link($data["image"] == "" ? "" : "{$STYLEPATH}/images/categories/" . $data["image"], "", $data["cname"]) . "</a></td>";
 if (max(0, $CURUSER["WT"]) > 0) {
     $seedbox[$i]["sw19"] = "<td align=\"center\" class=\"lista\" style=\"text-align: center;\">" . $wait . " h</td>";
 }
 include "include/offset.php";
 $seedbox[$i]["sw20"] = "<td nowrap=\"nowrap\" class=\"lista\" align=\"center\" style=\"text-align: center;\">" . date("d/m/Y", $data["added"] - $offset) . "</td>";
 $seedbox[$i]["sw20.5"] = "<td nowrap=\"nowrap\" class=\"lista\" align=\"center\" style=\"text-align: center;\">" . $rowti['prefixcolor'] . $rowt["username"] . $rowti['suffixcolor'] . "</td>";
 $seedbox[$i]["sw21"] = "<td nowrap=\"nowrap\" align=\"center\" class=\"lista\" style=\"text-align: center;\">" . makesize($data["size"]) . "</td>";
 if ($data["external"] == "no") {
     if ($GLOBALS["usepopup"]) {
         $seedbox[$i]["sw22"] = "<td align=\"center\" class=\"" . linkcolor($data["seeds"]) . "\" style=\"text-align: center;\"><a href=\"javascript:poppeer('index.php?page=peers&amp;id=" . $data["hash"] . "');\" title=\"" . $language["PEERS_DETAILS"] . "\">" . $data["seeds"] . "</a></td>\n";
         $seedbox[$i]["sw23"] = "<td align=\"center\" class=\"" . linkcolor($data["leechers"]) . "\" style=\"text-align: center;\"><a href=\"javascript:poppeer('index.php?page=peers&amp;id=" . $data["hash"] . "');\" title=\"" . $language["PEERS_DETAILS"] . "\">" . $data["leechers"] . "</a></td>\n";
         if ($data["finished"] > 0) {
             $seedbox[$i]["sw24"] = "<td align=\"center\" class=\"lista\" style=\"text-align: center;\"><a href=\"javascript:poppeer('index.php?page=torrent_history&amp;id=" . $data["hash"] . "');\" title=\"History - " . $data["filename"] . "\">" . $data["finished"] . "</a></td>";
         } else {
             $seedbox[$i]["sw24"] = "<td align=\"center\" class=\"lista\" style=\"text-align: center;\">---</td>";
         }
     } else {
         $seedbox[$i]["sw25"] = "<td align=\"center\" class=\"" . linkcolor($data["seeds"]) . "\" style=\"text-align: center;\"><a href=\"index.php?page=peers&amp;id=" . $data["hash"] . "\" title=\"" . $language["PEERS_DETAILS"] . "\">" . $data["seeds"] . "</a></td>\n";
         $seedbox[$i]["sw26"] = "<td align=\"center\" class=\"" . linkcolor($data["leechers"]) . "\" style=\"text-align: center;\"><a href=\"index.php?page=peers&amp;id=" . $data["hash"] . "\" title=\"" . $language["PEERS_DETAILS"] . "\">" . $data["leechers"] . "</a></td>\n";
         if ($data["finished"] > 0) {
             $seedbox[$i]["sw27"] = "<td align=\"center\" class=\"lista\" style=\"text-align: center;\"><a href=\"index.php?page=torrent_history&amp;id=" . $data["hash"] . "\" title=\"History - " . $data["filename"] . "\">" . $data["finished"] . "</a></td>";
         } else {
Example #23
0
     // $added = mysql_fetch_array($res2);
     $vz = $data['added'];
     //sql_timestamp_to_unix_timestamp($data["data"]);
     $timer = floor((time() - $vz) / 3600);
     if ($ratio < 1.0 && $CURUSER['uid'] != $data["uploader"]) {
         $wait = $CURUSER["WT"];
     }
     $wait -= $timer;
     if ($wait <= 0) {
         $wait = 0;
     }
     echo "\n\t<td align=\"center\" width=\"20\" class=\"lista\" style=\"text-align: center;\">" . $wait . " h</td>";
 }
 //end waitingtime
 echo "\n\t<td nowrap=\"nowrap\" class=\"lista\" align=\"center\" width=\"85\" style=\"text-align: center;\">" . get_elapsed_time($data["added"]) . " ago</td>";
 echo "\n\t<td nowrap=\"nowrap\" class=\"lista\" align=\"center\" width=\"60\" style=\"text-align: center;\">" . makesize($data["size"]) . "</td>";
 if ($data["external"] == "no") {
     if ($GLOBALS["usepopup"]) {
         echo "\n\t<td align=\"center\" class=\"lista\"" . linkcolor($data["seeds"]) . "\" style=\"text-align: center;\"><a class=\"lasttor\" href=\"javascript:poppeer('index.php?page=peers&amp;id=" . $data["hash"] . "');\" title=\"" . $language["PEERS_DETAILS"] . "\">" . $data["seeds"] . "</a></td>\n";
         echo "\n\t<td align=\"center\" class=\"lista\"" . linkcolor($data["leechers"]) . "\" style=\"text-align: center;\"><a class=\"lasttor\" href=\"javascript:poppeer('index.php?page=peers&amp;id=" . $data["hash"] . "');\" title=\"" . $language["PEERS_DETAILS"] . "\">" . $data["leechers"] . "</a></td>\n";
         if ($data["finished"] > 0) {
             echo "\n\t<td align=\"center\" class=\"lista\" style=\"text-align: center;\"><a class=\"lasttor\" href=\"javascript:poppeer('index.php?page=torrent_history&amp;id=" . $data["hash"] . "');\" title=\"History - " . $data["filename"] . "\">" . $data["finished"] . "</a></td>";
         } else {
             echo "\n\t<td align=\"center\" class=\"lista\" style=\"text-align: center;\">---</td>";
         }
     } else {
         echo "\n\t<td align=\"center\" class=\"lista\"" . linkcolor($data["seeds"]) . "\" style=\"text-align: center;\"><a class=\"lasttor\" href=\"index.php?page=peers&amp;id=" . $data["hash"] . "\" title=\"" . $language["PEERS_DETAILS"] . "\">" . $data["seeds"] . "</a></td>\n";
         echo "\n\t<td align=\"center\" class=\"lista\"" . linkcolor($data["leechers"]) . "\" style=\"text-align: center;\"><a class=\"lasttor\" href=\"index.php?page=peers&amp;id=" . $data["hash"] . "\" title=\"" . $language["PEERS_DETAILS"] . "\">" . $data["leechers"] . "</a></td>\n";
         if ($data["finished"] > 0) {
             echo "\n\t<td align=\"center\" class=\"lista\" style=\"text-align: center;\"><a class=\"lasttor\" href=\"index.php?page=torrent_history&amp;id=" . $data["hash"] . "\" title=\"History - " . $data["filename"] . "\">" . $data["finished"] . "</a></td>";
         } else {
Example #24
0
$language['HACK_FTP_PORT'] = 'Port FTP';
$language['HACK_FTP_USERNAME'] = '******';
$language['HACK_FTP_PASSWORD'] = '******';
$language['HACK_FTP_BASEDIR'] = 'Chemin local de XBTIT (chemin de root quand vous vous connectez par FTP)';
// USERS TOOLS
$language['USER_NOT_DELETE'] = 'Vous ne pouvez pas supprimé un invité ou vous-même!';
$language['USER_NOT_EDIT'] = 'Vous ne pouvez pas édité les invités ou vous-même!';
$language['USER_NOT_DELETE_HIGHER'] = 'Vous ne pouvez pas supprimé quelqu\'un plus grader que vous.';
$language['USER_NOT_EDIT_HIGHER'] = 'Vous ne pouvez pas édité quelqu\'un plus grader que vous.';
$language['USER_NO_CHANGE'] = 'Aucun changement de fait.';
$language["BLACKJACK_ADMIN"] = "Administration du Blackjack";
$language["BLACKJACK_STAKE"] = "Coût par partie (Mo)";
$language["BLACKJACK_PRIZE"] = "Battre le dealer avec Blackjack paye";
$language["NORMAL_PRIZE"] = "Battre le dealer normalement paye";
$language["BLACKJACK_UPDATED"] = "Configuration du Blackjack mis à jour, la configuration peut mettre quelque minutes à être prise en compte .<br /><br /><a href='javascript: history.go(-1);'>Retourner à la page précedante</a>";
$language["BLACKJACK_INFO"] = "<br />Le Blackjack typique paye 1:1 en battant le dealer ou 3:2 (1.5:1) en battant le dealer avec Blackjack<br />mais vous pouvez définir le prix vous même. Voici les prix de la configuration actuelle:<br /><br /><li>Pour une mise de " . makesize($btit_settings["bj_blackjack_stake"]) . " - Battre le dealer avec Blackjack paye " . makesize($btit_settings["bj_blackjack_stake"] * $btit_settings["bj_blackjack_prize"] + $btit_settings["bj_blackjack_stake"]) . "</li><li>Pour une mise de " . makesize($btit_settings["bj_blackjack_stake"]) . " - Battre le dealer paye " . makesize($btit_settings["bj_blackjack_stake"] * $btit_settings["bj_normal_prize"] + $btit_settings["bj_blackjack_stake"]) . "</li>";
//Manual Hack Install
$language['MHI_VIEW_INSRUCT'] = 'Voir les instructions manuelles d\'installation ?';
$language['MHI_MAN_INSRUCT_FOR'] = 'Instructions manuelles d\'installation pour';
$language['MHI_RUN_QUERY'] = 'Exécuté la requête SQL ci dessous via phpMyAdmin';
$language['MHI_IN'] = 'Dans';
$language['MHI_ALSO_IN'] = 'Aussi dans';
$language['MHI_FIND_THIS'] = 'trouver ceci';
$language['MHI_ADD_THIS'] = 'Ajouter ceci';
$language['MHI_IT'] = 'il';
$language['MHI_REPLACE'] = 'Remplacer par';
$language['MHI_COPY'] = 'Copier';
$language['MHI_AS'] = 'comme';
$language["ACP_SECSUI_SET"] = "Configurer la Suite de Sécuritée";
$language["SECSUI_QUAR_SETTING"] = "Configuration de la quarantaine pour les fichiés uploadés";
$language["SECSUI_QUAR_TERMS_1"] = "Tèrmes a rechercher (un par ligne)";
Example #25
0
 }
 // group image
 //nat - max torrents
 $resuser = do_sqlquery("SELECT connectable , id_level, pid FROM {$TABLE_PREFIX}users WHERE id=" . $CURUSER["uid"]);
 $con = mysqli_fetch_array($resuser);
 if ($con["connectable"] == "yes") {
     $conn = "<img src=\"images/good.png\">";
 } elseif ($con["connectable"] == "no") {
     $conn = "<img src=\"images/nat.png\">";
 } else {
     $conn = "<img src=\"images/unknow.png\">";
 }
 //nat
 print "<td style=\"text-align:center;\" align=\"center\">" . $xx . "</td>\n";
 print "<td class=\"green\" align=\"center\"> <img src=\"images/speed_up.png\"> " . makesize($CURUSER['uploaded']);
 print "</td><td class=\"red\" align=\"center\"> <img src=\"images/speed_down.png\">  " . makesize($CURUSER['downloaded']);
 print "</td><td class=\"yellow\" align=\"center\"> <img src=\"images/arany.png\"> " . ($CURUSER['downloaded'] > 0 ? number_format($CURUSER['uploaded'] / $CURUSER['downloaded'], 2) : "---") . "</td>\n";
 print "<td class=\"green\" align=\"center\"><a href=index.php?page=modules&module=seedbonus><img src=\"images/bonus.png\"> " . ($CURUSER['seedbonus'] > 0 ? number_format($CURUSER['seedbonus'], 2) : "---") . "</a></td>\n";
 //slots hack
 $set = do_sqlquery("SELECT maxtorrents FROM {$TABLE_PREFIX}users_level WHERE id =" . $con["id_level"]);
 $seti = mysqli_fetch_array($set);
 $slots = mysqli_query($GLOBALS["___mysqli_ston"], "SELECT COUNT(*) FROM {$TABLE_PREFIX}peers WHERE pid ='" . $con["pid"] . "'");
 if ($slots && mysqli_num_rows($slots) > 0) {
     $seta = mysqli_fetch_row($slots);
     if ($seta[0] > 0) {
         print "<td align=\"center\"><a href=index.php?page=modules&module=slots><font color=\"steelblue\"><img src=\"images/slots.png\"><font color=\"red\">&nbsp;{$seta['0']}&nbsp;<font color=\"steelblue\"> /<font color=green>" . $seti['maxtorrents'] . "<font color=\"steelblue\"></font></a></td>\n";
     } else {
         print "<td align=\"center\"><a href=index.php?page=modules&module=slots><font color=\"steelblue\"><img src=\"images/slots.png\"><font color=\"red\">&nbsp;0&nbsp;<font color=\"steelblue\">/<font color=green>" . $seti['maxtorrents'] . "<font color=\"steelblue\"></font></a></td>\n";
     }
 } else {
     print "<td align=\"center\"><a href=index.php?page=modules&module=slots><font color=\"steelblue\"><img src=\"images/slots.png\"><font color=\"red\">&nbsp;0&nbsp;<font color=\"steelblue\">/<font color=green>" . $seti['maxtorrents'] . "<font color=\"steelblue\"></font></a></td>\n";
Example #26
0
        unlink($TORRENTSDIR . "/{$hash}.btf");
        redirect($link);
        exit;
    } else {
        redirect($link);
        exit;
    }
}
$torrenttpl = new bTemplate();
$torrenttpl->set("language", $language);
$torrent = array();
$torrent["filename"] = $row["filename"];
$torrent["info_hash"] = $row["info_hash"];
$torrent["description"] = format_comment($row["comment"]);
$torrent["catname"] = $row["cat_name"];
$torrent["size"] = makesize($row["size"]);
include dirname(__FILE__) . "/include/offset.php";
$torrent["date"] = date("d/m/Y", $row["data"] - $offset);
if (!$XBT_USE) {
    if ($row["speed"] < 0) {
        $speed = "N/D";
    } else {
        if ($row["speed"] > 2097152) {
            $speed = round($row["speed"] / 1048576, 2) . " MB/sec";
        } else {
            $speed = round($row["speed"] / 1024, 2) . " KB/sec";
        }
    }
    $torrenttpl->set("NO_XBBT", true, true);
} else {
    $torrenttpl->set("NO_XBBT", false, true);
Example #27
0
    }
    if ($leechers > 0) {
        $percent = number_format($seeds / $leechers * 100, 0);
    } else {
        $percent = number_format($seeds * 100, 0);
    }
    $peers = $seeds + $leechers;
    if ($XBTT_USE) {
        $res = get_result("select sum(u.downloaded+x.downloaded) as dled, sum(u.uploaded+x.uploaded) as upld FROM {$TABLE_PREFIX}users u LEFT JOIN xbt_users x ON x.uid=u.id", true, $btit_settings['cache_duration']);
    } else {
        $res = get_result("select sum(downloaded) as dled, sum(uploaded) as upld FROM {$TABLE_PREFIX}users", true, $btit_settings['cache_duration']);
    }
    $row = $res[0];
    $dled = 0 + $row["dled"];
    $upld = 0 + $row["upld"];
    $traffic = makesize($dled + $upld);
    ?>
<table class="tool" cellpadding="2" cellspacing="0" width="100%">
<tr><br>
<td  style="text-align:center;" align="center">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
<td  style="text-align:center;" align="center"><font color = steelblue><?php 
    echo $language["BLOCK_INFO"];
    ?>
:</font></td>
<td class="lista" style="text-align:center;" align="center"><?php 
    echo $language["MEMBERS"];
    ?>
:</td><td style="text-align:center;" align="right"><?php 
    echo $users;
    ?>
</td>
Example #28
0
 $profile["friendt"] = unesc($btit_settings["text_fri"]);
 $profile["friendi"] = unesc($curu['friend'] == "yes" ? "checked=\"checked\"" : "");
 $profile["junkieimg"] = "<img src='images/user_images/" . $ju . "' alt='" . $btit_settings["text_jun"] . "' title='" . $btit_settings["text_jun"] . "' />";
 $profile["junkiet"] = unesc($btit_settings["text_jun"]);
 $profile["junkiei"] = unesc($curu['junkie'] == "yes" ? "checked=\"checked\"" : "");
 $profile["staffimg"] = "<img src='images/user_images/" . $st . "' alt='" . $btit_settings["text_sta"] . "' title='" . $btit_settings["text_sta"] . "' />";
 $profile["stafft"] = unesc($btit_settings["text_sta"]);
 $profile["staffi"] = unesc($curu['staff'] == "yes" ? "checked=\"checked\"" : "");
 $profile["sysopimg"] = "<img src='images/user_images/" . $sy . "' alt='" . $btit_settings["text_sys"] . "' title='" . $btit_settings["text_sys"] . "' />";
 $profile["sysopt"] = unesc($btit_settings["text_sys"]);
 $profile["sysopi"] = unesc($curu['sysop'] == "yes" ? "checked=\"checked\"" : "");
 // user images
 $profile['uploaded'] = $curu['uploaded'];
 $profile['downloaded'] = $curu['downloaded'];
 $profile['down'] = makesize($curu['downloaded']);
 $profile['up'] = makesize($curu['uploaded']);
 $profile['ratio'] = $curu['downloaded'] > 0 ? $curu['uploaded'] / $curu['downloaded'] : '';
 $profile["forumbanned"] = $curu["forumbanned"] == "yes" ? "checked=\"checked\"" : "";
 # init options
 $opts['name'] = 'level';
 $opts['complete'] = true;
 $opts['id'] = 'id';
 $opts['value'] = 'level';
 $opts['default'] = $curu['id_level'];
 $profile['seedbonus'] = unesc($curu['seedbonus']);
 $profile['custom_title'] = unesc($curu['custom_title']);
 $profile["helpdesk"] = unesc($curu['helpdesk'] == "yes" ? "checked=\"checked\"" : "");
 $profile["helped"] = unesc($curu['helped']);
 $profile["helplang"] = unesc($curu['helplang']);
 # rank list
 $profile["donor"] = $curu["donor"] == "yes" ? "checked=\"checked\"" : "";
Example #29
0
        } else {
            $peers[$i]["FLAG"] = "<img src=\"images/flag/unknown.gif\" alt=\"" . $language["UNKNOWN"] . "\" />";
        }
        if (!$XBTT_USE) {
            $peers[$i]["PORT"] = $row["port"];
        }
        $stat = floor(($tsize - $row["bytes"]) / $tsize * 100);
        $progress = "<table width=\"100\" cellspacing=\"0\" cellpadding=\"0\"><tr><td class=\"progress\" align=\"left\">";
        $progress .= "<img height=\"10\" width=\"" . number_format($stat, 0) . "\" src=\"{$STYLEURL}/images/progress.jpg\" alt=\"\" /></td></tr></table>";
        $peers[$i]["PROGRESS"] = $stat . "%<br />" . $progress;
        $peers[$i]["STATUS"] = $row["status"];
        if (!$XBTT_USE) {
            $peers[$i]["CLIENT"] = htmlspecialchars(getagent(unesc($row["client"]), unesc($row["peer_id"])));
        }
        $dled = makesize($row["downloaded"]);
        $upld = makesize($row["uploaded"]);
        $peers[$i]["DOWNLOADED"] = $dled;
        $peers[$i]["UPLOADED"] = $upld;
        //Peer Ratio
        if (intval($row["downloaded"]) > 0) {
            $ratio = number_format($row["uploaded"] / $row["downloaded"], 2);
        } else {
            $ratio = '&#8734;';
        }
        $peers[$i]["RATIO"] = $ratio;
        //End Peer Ratio
        $peers[$i]["SEEN"] = get_elapsed_time($row["lastupdate"]) . " ago";
        $i++;
    }
}
if ($GLOBALS["usepopup"]) {
Example #30
0
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
////////////////////////////////////////////////////////////////////////////////////
$res = mysqli_query($GLOBALS["___mysqli_ston"], "SELECT `blackjack_stats` FROM `{$TABLE_PREFIX}users` WHERE id=" . $CURUSER["uid"]);
$row = mysqli_fetch_assoc($res);
if (!empty($row["blackjack_stats"])) {
    $bjstats = unserialize($row["blackjack_stats"]);
} else {
    $bjstats["playcount"] = 0;
    $bjstats["wincount"] = 0;
    $bjstats["losscount"] = 0;
    $bjstats["drawcount"] = 0;
    $bjstats["bjcount"] = 0;
    $bjstats["winloss"] = 0;
}
if ($bjstats["wincount"] == 0) {
    $bjstats["percent"] = 0;
} else {
    $bjstats["percent"] = number_format($bjstats["wincount"] / $bjstats["playcount"] * 100, 2);
}
print "<table width='100%' class='lista' cellspacing='0'>\n";
print "<tr>\n<td class='lista' style='border-bottom: solid 1px #9BAEBF;width:50%;'>" . $language["PLAYED"] . ":</td><td class='lista' style='border-bottom: solid 1px #9BAEBF;width:50%;'>" . $bjstats["playcount"] . "<td></tr>";
print "<tr>\n<td class='lista' style='border-bottom: solid 1px #9BAEBF;width:50%;'>" . $language["WINS"] . ":</td><td class='lista' style='border-bottom: solid 1px #9BAEBF;width:50%;'>" . $bjstats["wincount"] . "<td></tr>";
print "<tr>\n<td class='lista' style='border-bottom: solid 1px #9BAEBF;width:50%;'>" . $language["LOSSES"] . ":</td><td class='lista' style='border-bottom: solid 1px #9BAEBF;width:50%;'>" . $bjstats["losscount"] . "<td></tr>";
print "<tr>\n<td class='lista' style='border-bottom: solid 1px #9BAEBF;width:50%;'>" . $language["DRAWS"] . ":</td><td class='lista' style='border-bottom: solid 1px #9BAEBF;width:50%;'>" . $bjstats["drawcount"] . "<td></tr>";
print "<tr>\n<td class='lista' style='border-bottom: solid 1px #9BAEBF;width:50%;'>" . $language["WON_WITH_BLACKJACK"] . ":</td><td class='lista' style='border-bottom: solid 1px #9BAEBF;width:50%;'>" . $bjstats["bjcount"] . "<td></tr>";
print "<tr>\n<td class='lista' style='border-bottom: solid 1px #9BAEBF;width:50%;'>" . $language["WIN_LOSS_TOTAL"] . ":</td><td class='lista' style='border-bottom: solid 1px #9BAEBF;width:50%;'>" . ($bjstats["winloss"] > 0 ? "+ " : "") . makesize($bjstats["winloss"]) . "<td></tr>";
print "<tr>\n<td class='lista' style='border-bottom: solid 1px #9BAEBF;width:50%;'>" . $language["WIN_PERCENTAGE"] . ":</td><td class='lista' style='border-bottom: solid 1px #9BAEBF;width:50%;'>" . $bjstats["percent"] . "%<td></tr>";
print "</table>";