Exemplo n.º 1
0
function commenttable_new($rows)
{
    global $CURUSER, $HTTP_SERVER_VARS;
    begin_main_frame();
    begin_frame();
    $count = 0;
    foreach ($rows as $row) {
        $subres = mysql_query("SELECT name from torrents where id=" . unsafeChar($row["torrent"])) or sqlerr(__FILE__, __LINE__);
        $subrow = mysql_fetch_array($subres);
        print "<br /><a href=\"details.php?id=" . safeChar($row["torrent"]) . "\">" . safeChar($subrow["name"]) . "</a><br />\n";
        print "<p class=sub>#" . $row["id"] . " by ";
        if (isset($row["username"])) {
            print "<a name=comm" . $row["id"] . " href=userdetails.php?id=" . safeChar($row["user"]) . "><b>" . safechar($row["username"]) . "</b></a>" . ($row["warned"] == "yes" ? "<img src=" . "pic/warned.gif alt=\"Warned\">" : "");
        } else {
            print "<a name=\"comm" . safeChar($row["id"]) . "\"><i>(orphaned)</i></a>\n";
        }
        print " at " . safeChar($row["added"]) . " GMT" . "- [<a href=comment.php?action=edit&cid={$row['id']}>Edit</a>]" . "- [<a href=deletecomment.php?id={$row['id']}>Delete</a>]</p>\n";
        $avatar = $CURUSER["avatars"] == "yes" ? safechar($row["avatar"]) : "";
        if (!$avatar) {
            $avatar = "pic/default_avatar.gif";
        }
        begin_table(true);
        print "<tr valign=top>\n";
        print "<td align=center width=150 style='padding: 0px'><img width=150 src={$avatar}></td>\n";
        print "<td class=text>" . format_comment($row["text"]) . "</td>\n";
        print "</tr>\n";
        end_table();
    }
    end_frame();
    end_main_frame();
}
Exemplo n.º 2
0
 public static function updatePass($username, $password, $secret)
 {
     $passhash = md5($secret . $wantpassword . $secret);
     $sql = "UPDATE `users` SET  `passhash` =  '{$passhash}'  WHERE  `username` = '{$username}'";
     print $sql;
     sql_query($sql) or sqlerr(__FILE__, __LINE__);
 }
Exemplo n.º 3
0
function cleanup_show_main()
{
    $count1 = get_row_count('cleanup');
    $perpage = 15;
    $pager = pager($perpage, $count1, 'staffpanel.php?tool=cleanup_manager&amp;');
    $htmlout = "<h2>Current Cleanup Tasks</h2>\n    <table class='torrenttable' bgcolor='#333333' border='1' cellpadding='5px' width='80%'>\n    <tr>\n      <td class='colhead'>Cleanup Title &amp; Description</td>\n      <td class='colhead' width='150px'>Runs every</td>\n      <td class='colhead' width='150px'>Next Clean Time</td>\n      <td class='colhead' width='40px'>Edit</td>\n      <td class='colhead' width='40px'>Delete</td>\n      <td class='colhead' width='40px'>Off/On</td>\n      <td class='colhead' style='width: 40px;'>Run&nbsp;now</td>\n    </tr>";
    $sql = sql_query("SELECT * FROM cleanup ORDER BY clean_time ASC " . $pager['limit']) or sqlerr(__FILE__, __LINE__);
    if (!mysqli_num_rows($sql)) {
        stderr('Error', 'F*****g panic now!');
    }
    while ($row = mysqli_fetch_assoc($sql)) {
        $row['_clean_time'] = get_date($row['clean_time'], 'LONG');
        $row['clean_increment'] = $row['clean_increment'];
        $row['_class'] = $row['clean_on'] != 1 ? " style='color:red'" : '';
        $row['_title'] = $row['clean_on'] != 1 ? " (Locked)" : '';
        $row['_clean_time'] = $row['clean_on'] != 1 ? "<span style='color:red'>{$row['_clean_time']}</span>" : $row['_clean_time'];
        $htmlout .= "<tr>\n          <td{$row['_class']}><strong>{$row['clean_title']}{$row['_title']}</strong><br />{$row['clean_desc']}</td>\n          <td>" . mkprettytime($row['clean_increment']) . "</td>\n          <td>{$row['_clean_time']}</td>\n          <td align='center'><a href='staffpanel.php?tool=cleanup_manager&amp;action=cleanup_manager&amp;mode=edit&amp;cid={$row['clean_id']}'>\n            <img src='./pic/aff_tick.gif' alt='Edit Cleanup' title='Edit' border='0' height='12' width='12' /></a></td>\n\n          <td align='center'><a href='staffpanel.php?tool=cleanup_manager&amp;action=cleanup_manager&amp;mode=delete&amp;cid={$row['clean_id']}'>\n            <img src='./pic/aff_cross.gif' alt='Delete Cleanup' title='Delete' border='0' height='12' width='12' /></a></td>\n          <td align='center'><a href='staffpanel.php?tool=cleanup_manager&amp;action=cleanup_manager&amp;mode=unlock&amp;cid={$row['clean_id']}&amp;clean_on={$row['clean_on']}'>\n            <img src='./pic/warned.png' alt='On/Off Cleanup' title='on/off' border='0' height='12' width='12' /></a></td>\n<td align='center'><a href='staffpanel.php?tool=cleanup_manager&amp;action=cleanup_manager&amp;mode=run&amp;cid={$row['clean_id']}'>Run it now</a></td>\n </tr>";
    }
    $htmlout .= "</table>";
    if ($count1 > $perpage) {
        $htmlout .= $pager['pagerbottom'];
    }
    $htmlout .= "<br />\n                <span class='btn'><a href='./staffpanel.php?tool=cleanup_manager&amp;action=cleanup_manager&amp;mode=new'>Add New</a></span>";
    echo stdhead('Cleanup Manager - View') . $htmlout . stdfoot();
}
Exemplo n.º 4
0
function show_form($type = 'edit')
{
    global $input;
    $html = "This allows you to add a new reputation level or edit an existing reputation level.";
    if ($type == 'edit') {
        $query = mysql_query('SELECT * FROM reputationlevel WHERE reputationlevelid=' . intval($input['reputationlevelid'])) or sqlerr(__LINE__, __FILE__);
        if (!($res = mysql_fetch_assoc($query))) {
            stderr("Error:", "Please specify an ID.");
        }
        $title = "Edit Reputation Level";
        $html .= "<br /><span style='font-weight:normal;'>{$res['level']} (ID:#{$res['reputationlevelid']})</span><br />";
        $button = "Update";
        $extra = "<input type='button' class='button' value='Back' accesskey='b' id='button' onclick='javascript:history.back(1)' />";
        $mode = 'doedit';
    } else {
        $title = "Add New Reputation Level";
        $button = "Save";
        $mode = 'doadd';
        $extra = "<input type='button' value='Back' accesskey='b' id='button' onclick='javascript:history.back(1)' />";
    }
    $css = "style='font-weight: bold;color: #ffffff;background-color: #0055A4;padding: 5px;'";
    $replevid = isset($res['reputationlevelid']) ? $res['reputationlevelid'] : '';
    $replevel = isset($res['level']) ? $res['level'] : '';
    $minrep = isset($res['minimumreputation']) ? $res['minimumreputation'] : '';
    $html .= "<form action='reputation_ad.php' name='show_rep_form' method='post'>\r\n\t\t\t\t<input name='reputationlevelid' value='{$replevid}' type='hidden' />\r\n\t\t\t\t<input name='mode' value='{$mode}' type='hidden' />";
    $html .= "<h2>{$title}</h2><table width='500px' cellpadding='5px'><tr>\n\t\t<td width='67%' {$css}>&nbsp;</td>\n\t\t<td width='33%' {$css}>&nbsp;</td></tr>";
    $html .= "<tr><td>Level Description<div class='desctext'>This is what is displayed for the user when their reputation points are above the amount entered as the minimum.</div></td>";
    $html .= "<td><input type='text' name='level' value=\"{$replevel}\" size='35' maxlength='250' /></td></tr>";
    $html .= "<tr><td>Minimum amount of reputation points required for this level<div>This can be a positive or a negative amount. When the user's reputation points reaches this amount, the above description will be displayed.</div></td>";
    $html .= "<td><input type='text' name='minimumreputation' value=\"{$minrep}\" size='35' maxlength='10' /></td></tr>";
    $html .= "<tr><td colspan='2' align='center'><input type='submit' value='{$button}' accesskey='s' id='button' /> <input type='reset' value='Reset' accesskey='r' id='button' /> {$extra}</td></tr>";
    $html .= "</table>";
    $html .= "</form>";
    html_out($html, $title);
}
Exemplo n.º 5
0
/**
|--------------------------------------------------------------------------|
|   https://github.com/Bigjoos/                			    |
|--------------------------------------------------------------------------|
|   Licence Info: GPL			                                    |
|--------------------------------------------------------------------------|
|   Copyright (C) 2010 U-232 V5					    |
|--------------------------------------------------------------------------|
|   A bittorrent tracker source based on TBDev.net/tbsource/bytemonsoon.   |
|--------------------------------------------------------------------------|
|   Project Leaders: Mindless, Autotron, whocares, Swizzles.					    |
|--------------------------------------------------------------------------|
 _   _   _   _   _     _   _   _   _   _   _     _   _   _   _
/ \ / \ / \ / \ / \   / \ / \ / \ / \ / \ / \   / \ / \ / \ / \
( U | - | 2 | 3 | 2 )-( S | o | u | r | c | e )-( C | o | d | e )
\_/ \_/ \_/ \_/ \_/   \_/ \_/ \_/ \_/ \_/ \_/   \_/ \_/ \_/ \_/
*/
function docleanup($data)
{
    global $INSTALLER09, $queries, $mc1;
    set_time_limit(0);
    ignore_user_abort(1);
    //=== Clean silver
    $res = sql_query("SELECT id, silver FROM torrents WHERE silver > 1 AND silver < " . TIME_NOW) or sqlerr(__FILE__, __LINE__);
    $Silver_buffer = array();
    if (mysqli_num_rows($res) > 0) {
        while ($arr = mysqli_fetch_assoc($res)) {
            $Silver_buffer[] = '(' . $arr['id'] . ', \'0\')';
            $mc1->begin_transaction('torrent_details_' . $arr['id']);
            $mc1->update_row(false, array('silver' => 0));
            $mc1->commit_transaction($INSTALLER09['expires']['torrent_details']);
        }
        $count = count($Silver_buffer);
        if ($count > 0) {
            sql_query("INSERT INTO torrents (id, silver) VALUES " . implode(', ', $Silver_buffer) . " ON DUPLICATE key UPDATE silver=values(silver)") or sqlerr(__FILE__, __LINE__);
            write_log("Cleanup - Removed Silver from " . $count . " torrents");
        }
        unset($Silver_buffer, $count);
    }
    //==End
    if ($queries > 0) {
        write_log("Free clean-------------------- Silver Torrents cleanup Complete using {$queries} queries --------------------");
    }
    if (false !== mysqli_affected_rows($GLOBALS["___mysqli_ston"])) {
        $data['clean_desc'] = mysqli_affected_rows($GLOBALS["___mysqli_ston"]) . " items updated";
    }
    if ($data['clean_log']) {
        cleanup_log($data);
    }
}
Exemplo n.º 6
0
function docleanup($data)
{
    global $INSTALLER09, $queries, $bdir;
    set_time_limit(0);
    ignore_user_abort(1);
    $mysql_host = $INSTALLER09['mysql_host'];
    $mysql_user = $INSTALLER09['mysql_user'];
    $mysql_pass = $INSTALLER09['mysql_pass'];
    $mysql_db = $INSTALLER09['mysql_db'];
    $bdir = $_SERVER["DOCUMENT_ROOT"] . "/include/backup";
    $c1 = "mysqldump -h " . $mysql_host . " -u " . $mysql_user . " -p" . $mysql_pass . " " . $mysql_db . " -d > " . $bdir . "/db_structure.sql";
    $c = "mysqldump -h " . $mysql_host . " -u " . $mysql_user . " -p" . $mysql_pass . " " . $mysql_db . " " . tables("peers|messages|sitelog") . " | bzip2 -cq9 > " . $bdir . "/db_" . date("m_d_y", TIME_NOW) . ".sql.bz2";
    system($c1);
    system($c);
    $files = glob($bdir . "/db_*");
    foreach ($files as $file) {
        if (TIME_NOW - filemtime($file) > 3 * 86400) {
            unlink($file);
        }
    }
    $ext = "db_" . date("m_d_y", TIME_NOW) . ".sql.bz2";
    sql_query("INSERT INTO dbbackup (name, added, userid) VALUES (" . sqlesc($ext) . ", " . TIME_NOW . ", " . $INSTALLER09['site']['owner'] . ")") or sqlerr(__FILE__, __LINE__);
    if ($queries > 0) {
        write_log("Auto-dbbackup----------------------Auto Back Up Complete using {$queries} queries---------------------");
    }
    if (false !== mysqli_affected_rows($GLOBALS["___mysqli_ston"])) {
        $data['clean_desc'] = mysqli_affected_rows($GLOBALS["___mysqli_ston"]) . " items deleted/updated";
    }
    if ($data['clean_log']) {
        cleanup_log($data);
    }
}
Exemplo n.º 7
0
/**
|--------------------------------------------------------------------------|
|   https://github.com/Bigjoos/                                |
|--------------------------------------------------------------------------|
|   Licence Info: GPL                                              |
|--------------------------------------------------------------------------|
|   Copyright (C) 2010 U-232 V5                        |
|--------------------------------------------------------------------------|
|   A bittorrent tracker source based on TBDev.net/tbsource/bytemonsoon.   |
|--------------------------------------------------------------------------|
|   Project Leaders: Mindless, Autotron, whocares, Swizzles.                       |
|--------------------------------------------------------------------------|
 _   _   _   _   _     _   _   _   _   _   _     _   _   _   _
/ \ / \ / \ / \ / \   / \ / \ / \ / \ / \ / \   / \ / \ / \ / \
( U | - | 2 | 3 | 2 )-( S | o | u | r | c | e )-( C | o | d | e )
\_/ \_/ \_/ \_/ \_/   \_/ \_/ \_/ \_/ \_/ \_/   \_/ \_/ \_/ \_/
*/
function docleanup($data)
{
    global $INSTALLER09, $queries, $mc1;
    set_time_limit(0);
    ignore_user_abort(1);
    //== Delete snatched
    $dt = TIME_NOW - 30 * 86400;
    sql_query("DELETE FROM snatched WHERE complete_date < " . sqlesc($dt)) or sqlerr(__FILE__, __LINE__);
    if (false !== mysqli_affected_rows($GLOBALS["___mysqli_ston"])) {
        $data['clean_desc'] = mysqli_affected_rows($GLOBALS["___mysqli_ston"]) . " items deleted/updated";
    }
    $snatchedcounts = array();
    $snatchedres = sql_query("SELECT torrentid, COUNT(*) AS count FROM snatched WHERE complete_date > 0 GROUP BY torrentid");
    while ($row = mysqli_fetch_assoc($snatchedres)) {
        $snatchedcounts[$row['torrentid']] = (int) $row['count'];
    }
    $tcompletedres = sql_query("SELECT id, times_completed FROM torrents");
    while ($row2 = mysqli_fetch_assoc($tcompletedres)) {
        if (!array_key_exists($row2['id'], $snatchedcounts) || array_key_exists($row2['id'], $snatchedcounts) && $row2['times_completed'] != $snatchedcounts[$row2['id']]) {
            sql_query("UPDATE torrents SET times_completed = " . $snatchedcounts[$row2['id']] . " WHERE id = " . $row2['id']);
            ++$snatchedcounts;
        }
    }
    if ($queries > 0) {
        write_log("Snatch list clean-------------------- Removed snatches not seeded for 99 days. Cleanup Complete using {$queries} queries --------------------");
    }
    if ($data['clean_log']) {
        cleanup_log($data);
    }
}
Exemplo n.º 8
0
function comment_like_unlike()
{
    global $CURUSER, $type, $tb_fields, $the_id, $banned_users, $disabled_time;
    $userip = $_SERVER['REMOTE_ADDR'];
    $res = sql_query("SELECT user_likes,disabled_time FROM " . $tb_fields[$type[0]] . " LEFT OUTER JOIN manage_likes ON manage_likes.user_id = " . sqlesc($CURUSER['id']) . " WHERE " . $tb_fields[$type[0]] . ".id = " . sqlesc($the_id) . "") or sqlerr(__FILE__, __LINE__);
    $data = mysqli_fetch_row($res);
    if ($data[1] + $disabled_time > time()) {
        die($lang['ajlike_you_been_disabled']);
    } elseif (in_array($CURUSER['id'], $banned_users)) {
        die($lang['ajlike_you_been_banned']);
    }
    $exp = explode(',', $data[0]);
    if ($res && $type[1] == 'like' && array_key_exists($type[0], $tb_fields)) {
        if (!in_array($CURUSER['id'], $exp)) {
            $res2 = sql_query("UPDATE " . $tb_fields[$type[0]] . " SET user_likes = IF(LENGTH(user_likes),CONCAT(user_likes,','," . sqlesc((string) $CURUSER['id']) . ")," . sqlesc((string) $CURUSER['id']) . ") WHERE id = " . sqlesc($the_id) . "") or sqlerr(__FILE__, __LINE__);
        } else {
            die($lang['ajlike_you_already_liked']);
        }
    } elseif ($res && $type[1] == 'unlike' && array_key_exists($type[0], $tb_fields)) {
        if (in_array($CURUSER['id'], $exp)) {
            $key = array_search($CURUSER['id'], $exp);
            unset($exp[$key]);
            $exp = implode(",", $exp);
            $res2 = sql_query("UPDATE " . $tb_fields[$type[0]] . " SET user_likes = " . sqlesc($exp) . "WHERE id = " . sqlesc($the_id) . "") or sqlerr(__FILE__, __LINE__);
        } else {
            die($lang['ajlike_you_already_unliked']);
        }
    } else {
        die($lang['ajlike_get_lost']);
    }
}
Exemplo n.º 9
0
function docleanup($data)
{
    global $INSTALLER09, $queries, $mc1;
    set_time_limit(1200);
    ignore_user_abort(1);
    sql_query("UPDATE `freeslots` SET `addedup` = 0 WHERE `addedup` != 0 AND `addedup` < " . TIME_NOW) or sqlerr(__FILE__, __LINE__);
    sql_query("UPDATE `freeslots` SET `addedfree` = 0 WHERE `addedfree` != 0 AND `addedfree` < " . TIME_NOW) or sqlerr(__FILE__, __LINE__);
    sql_query("DELETE FROM `freeslots` WHERE `addedup` = 0 AND `addedfree` = 0") or sqlerr(__FILE__, __LINE__);
    sql_query("UPDATE `users` SET `free_switch` = 0 WHERE `free_switch` > 1 AND `free_switch` < " . TIME_NOW) or sqlerr(__FILE__, __LINE__);
    sql_query("UPDATE `torrents` SET `free` = 0 WHERE `free` > 1 AND `free` < " . TIME_NOW) or sqlerr(__FILE__, __LINE__);
    sql_query("UPDATE `users` SET `downloadpos` = 1 WHERE `downloadpos` > 1 AND `downloadpos` < " . TIME_NOW) or sqlerr(__FILE__, __LINE__);
    sql_query("UPDATE `users` SET `uploadpos` = 1 WHERE `uploadpos` > 1 AND `uploadpos` < " . TIME_NOW) or sqlerr(__FILE__, __LINE__);
    sql_query("UPDATE `users` SET `chatpost` = 1 WHERE `chatpost` > 1 AND `chatpost` < " . TIME_NOW) or sqlerr(__FILE__, __LINE__);
    sql_query("UPDATE `users` SET `avatarpos` = 1 WHERE `avatarpos` > 1 AND `avatarpos` < " . TIME_NOW) or sqlerr(__FILE__, __LINE__);
    sql_query("UPDATE `users` SET `immunity` = 0 WHERE `immunity` > 1 AND `immunity` < " . TIME_NOW) or sqlerr(__FILE__, __LINE__);
    sql_query("UPDATE `users` SET `warned` = 0 WHERE `warned` > 1 AND `warned` < " . TIME_NOW) or sqlerr(__FILE__, __LINE__);
    sql_query("UPDATE `users` SET `pirate` = 0 WHERE `pirate` > 1 AND `pirate` < " . TIME_NOW) or sqlerr(__FILE__, __LINE__);
    sql_query("UPDATE `users` SET `king` = 0 WHERE `king` > 1 AND `king` < " . TIME_NOW) or sqlerr(__FILE__, __LINE__);
    if ($queries > 0) {
        write_log("User Clean -------------------- User Clean Complete using {$queries} queries--------------------");
    }
    if (false !== mysqli_affected_rows($GLOBALS["___mysqli_ston"])) {
        $data['clean_desc'] = mysqli_affected_rows($GLOBALS["___mysqli_ston"]) . " items deleted/updated";
    }
    if ($data['clean_log']) {
        cleanup_log($data);
    }
}
function docleanup($data)
{
    global $INSTALLER09, $queries, $mc1;
    set_time_limit(0);
    ignore_user_abort(1);
    //== Delete old backup's
    $days = 3;
    $res = sql_query("SELECT id, name FROM dbbackup WHERE added < " . sqlesc(TIME_NOW - $days * 86400)) or sqlerr(__FILE__, __LINE__);
    if (mysqli_num_rows($res) > 0) {
        $ids = array();
        while ($arr = mysqli_fetch_assoc($res)) {
            $ids[] = (int) $arr['id'];
            $filename = $INSTALLER09['backup_dir'] . '/' . $arr['name'];
            if (is_file($filename)) {
                unlink($filename);
            }
        }
        sql_query('DELETE FROM dbbackup WHERE id IN (' . implode(', ', $ids) . ')') or sqlerr(__FILE__, __LINE__);
    }
    //== end
    if ($queries > 0) {
        write_log("Backup Clean -------------------- Backup Clean Complete using {$queries} queries--------------------");
    }
    if (false !== mysqli_affected_rows($GLOBALS["___mysqli_ston"])) {
        $data['clean_desc'] = mysqli_affected_rows($GLOBALS["___mysqli_ston"]) . " items deleted/updated";
    }
    if ($data['clean_log']) {
        cleanup_log($data);
    }
}
Exemplo n.º 11
0
function deletetorrent($tid)
{
    global $INSTALLER09, $mc1, $CURUSER;
    sql_query("DELETE peers.*, files.*,comments.*,snatched.*, thanks.*, bookmarks.*, coins.*, ratings.*, torrents.* FROM torrents \r\n\t\t\t\t LEFT JOIN peers ON peers.torrent = torrents.id\r\n\t\t\t\t LEFT JOIN files ON files.torrent = torrents.id\r\n\t\t\t\t LEFT JOIN comments ON comments.torrent = torrents.id\r\n\t\t\t\t LEFT JOIN thanks ON thanks.torrentid = torrents.id\r\n\t\t\t\t LEFT JOIN bookmarks ON bookmarks.torrentid = torrents.id\r\n\t\t\t\t LEFT JOIN coins ON coins.torrentid = torrents.id\r\n\t\t\t\t LEFT JOIN ratings ON ratings.torrent = torrents.id\r\n\t\t\t\t LEFT JOIN snatched ON snatched.torrentid = torrents.id\r\n\t\t\t\t WHERE torrents.id = {$tid}") or sqlerr(__FILE__, __LINE__);
    unlink("{$INSTALLER09['torrent_dir']}/{$id}.torrent");
    $mc1->delete('MyPeers_' . $CURUSER['id']);
}
Exemplo n.º 12
0
function commenttable($rows, $redaktor = "comment")
{
    global $CURUSER, $avatar_max_width;
    $count = 0;
    foreach ($rows as $row) {
        if ($row["downloaded"] > 0) {
            $ratio = $row['uploaded'] / $row['downloaded'];
            $ratio = number_format($ratio, 2);
        } elseif ($row["uploaded"] > 0) {
            $ratio = "Inf.";
        } else {
            $ratio = "---";
        }
        if (strtotime($row["last_access"]) > gmtime() - 600) {
            $online = "online";
            $online_text = "В сети";
        } else {
            $online = "offline";
            $online_text = "Не в сети";
        }
        print "<table class=maibaugrand width=100% border=1 cellspacing=0 cellpadding=3>";
        print "<tr><td class=colhead align=\"left\" colspan=\"2\" height=\"24\">";
        if (isset($row["username"])) {
            $title = $row["title"];
            if ($title == "") {
                $title = get_user_class_name($row["class"]);
            } else {
                $title = htmlspecialchars_uni($title);
            }
            print ":: <img src=\"pic/buttons/button_" . $online . ".gif\" alt=\"" . $online_text . "\" title=\"" . $online_text . "\" style=\"position: relative; top: 2px;\" border=\"0\" height=\"14\">" . " <a name=comm" . $row["id"] . " href=userdetails.php?id=" . $row["user"] . " class=altlink_white><b>" . get_user_class_color($row["class"], htmlspecialchars_uni($row["username"])) . "</b></a> ::" . ($row["donor"] == "yes" ? "<img src=pic/star.gif alt='Donor'>" : "") . ($row["warned"] == "yes" ? "<img src=\"/pic/warned.gif\" alt=\"Warned\">" : "") . " {$title} ::\n" . " <img src=\"pic/upl.gif\" alt=\"upload\" border=\"0\" width=\"12\" height=\"12\"> " . mksize($row["uploaded"]) . " :: <img src=\"pic/down.gif\" alt=\"download\" border=\"0\" width=\"12\" height=\"12\"> " . mksize($row["downloaded"]) . " :: <font color=\"" . get_ratio_color($ratio) . "\">{$ratio}</font> :: ";
        } else {
            print "<a name=\"comm" . $row["id"] . "\"><i>[Anonymous]</i></a>\n";
        }
        $avatar = $CURUSER["avatars"] == "yes" ? htmlspecialchars_uni($row["avatar"]) : "";
        if (!$avatar) {
            $avatar = "pic/default_avatar.gif";
        }
        if (md5($row['text']) == $row['text_hash']) {
            $text = $row['text_parsed'];
        } else {
            $text = format_comment($row['text']);
            sql_query('INSERT INTO comments_parsed (cid, text_hash, text_parsed) VALUES (' . implode(', ', array_map('sqlesc', array($row['id'], md5($row['text']), $text))) . ')') or sqlerr(__FILE__, __LINE__);
        }
        if ($row["editedby"]) {
            //$res = mysql_fetch_assoc(sql_query("SELECT * FROM users WHERE id = $row[editedby]")) or sqlerr(__FILE__,__LINE__);
            $text .= "<p><font size=1 class=small>Последний раз редактировалось <a href=userdetails.php?id={$row['editedby']}><b>{$row['editedbyname']}</b></a> в {$row['editedat']}</font></p>\n";
        }
        print "</td></tr>";
        print "<tr valign=top>\n";
        print "<td style=\"padding: 0px; width: 5%;\" align=\"center\"><img src={$avatar} width=\"{$avatar_max_width}\"> </td>\n";
        print "<td width=100% class=text>";
        //print("<span style=\"float: right\"><a href=\"#top\"><img title=\"Top\" src=\"pic/top.gif\" alt=\"Top\" border=\"0\" width=\"15\" height=\"13\"></a></span>");
        print "{$text}</td>\n";
        print "</tr>\n";
        print "<tr><td class=colhead align=\"center\" colspan=\"2\">";
        print "<div style=\"float: left; width: auto;\">" . ($CURUSER ? " [<a href=\"" . $redaktor . ".php?action=quote&amp;cid={$row['id']}\" class=\"altlink_white\">Цитата</a>]" : "") . ($row["user"] == $CURUSER["id"] || get_user_class() >= UC_MODERATOR ? " [<a href=" . $redaktor . ".php?action=edit&amp;cid={$row['id']} class=\"altlink_white\">Изменить</a>]" : "") . (get_user_class() >= UC_MODERATOR ? " [<a href=\"" . $redaktor . ".php?action=delete&amp;cid={$row['id']}\" class=\"altlink_white\">Удалить</a>]" : "") . ($row["editedby"] && get_user_class() >= UC_MODERATOR ? " [<a href=\"" . $redaktor . ".php?action=vieworiginal&amp;cid={$row['id']}\" class=\"altlink_white\">Оригинал</a>]" : "") . (get_user_class() >= UC_MODERATOR ? " IP: " . ($row["ip"] ? "<a href=\"usersearch.php?ip={$row['ip']}\" class=\"altlink_white\">" . $row["ip"] . "</a>" : "Неизвестен") : "") . "</div>";
        print "<div align=\"right\"><!--<font size=1 class=small>-->Комментарий добавлен: " . $row["added"] . " GMT<!--</font>--></td></tr>";
        print "</table><br>";
    }
}
function docleanup($data)
{
    global $INSTALLER09, $queries, $mc1;
    set_time_limit(1200);
    ignore_user_abort(1);
    //== delete torrents - ????
    $days = 30;
    $dt = TIME_NOW - $days * 86400;
    sql_query("UPDATE torrents SET flags='1' WHERE added < {$dt} AND seeders='0' AND leechers='0'") or sqlerr(__FILE__, __LINE__);
    $res = sql_query("SELECT id, name FROM torrents WHERE mtime < {$dt} AND seeders='0' AND leechers='0' AND flags='1'") or sqlerr(__FILE__, __LINE__);
    while ($arr = mysqli_fetch_assoc($res)) {
        sql_query("DELETE files.*, comments.*, thankyou.*, thanks.*, thumbsup.*, bookmarks.*, coins.*, rating.*, xbt_files_users.* FROM xbt_files_users\n                                 LEFT JOIN files ON files.torrent = xbt_files_users.fid\n                                 LEFT JOIN comments ON comments.torrent = xbt_files_users.fid\n                                 LEFT JOIN thankyou ON thankyou.torid = xbt_files_users.fid\n                                 LEFT JOIN thanks ON thanks.torrentid = xbt_files_users.fid\n                                 LEFT JOIN bookmarks ON bookmarks.torrentid = xbt_files_users.fid\n                                 LEFT JOIN coins ON coins.torrentid = xbt_files_users.fid\n                                 LEFT JOIN rating ON rating.torrent = xbt_files_users.fid\n                                 LEFT JOIN thumbsup ON thumbsup.torrentid = xbt_files_users.fid\n                                 WHERE xbt_files_users.fid =" . sqlesc($arr['id'])) or sqlerr(__FILE__, __LINE__);
        @unlink("{$INSTALLER09['torrent_dir']}/{$arr['id']}.torrent");
        write_log("Torrent " . (int) $arr['id'] . " (" . htmlsafechars($arr['name']) . ") was deleted by system (older than {$days} days and no seeders)");
    }
    if ($queries > 0) {
        write_log("Delete Old Torrents XBT Clean -------------------- Delete Old XBT Torrents cleanup Complete using {$queries} queries --------------------");
    }
    if (false !== mysqli_affected_rows($GLOBALS["___mysqli_ston"])) {
        $data['clean_desc'] = mysqli_affected_rows($GLOBALS["___mysqli_ston"]) . " items deleted/updated";
    }
    if ($data['clean_log']) {
        cleanup_log($data);
    }
}
Exemplo n.º 14
0
function write_staffs2()
{
    global $lang;
    //==ids
    $t = '$INSTALLER09';
    $iconfigfile = "<" . "?php\n/**\n{$lang['staffcfg_file_created']}" . date('M d Y H:i:s') . ".\n{$lang['staffcfg_mod_by']}\n**/\n";
    $ri = sql_query("SELECT id, username, class FROM users WHERE class BETWEEN " . UC_STAFF . " AND " . UC_MAX . " ORDER BY id ASC") or sqlerr(__FILE__, __LINE__);
    $iconfigfile .= "" . $t . "['allowed_staff']['id'] = array(";
    while ($ai = mysqli_fetch_assoc($ri)) {
        $ids[] = $ai['id'];
        $usernames[] = "'" . $ai["username"] . "' => 1";
    }
    $iconfigfile .= "" . join(",", $ids);
    $iconfigfile .= ");";
    $iconfigfile .= "\n?" . ">";
    $filenum = fopen('./cache/staff_settings.php', 'w');
    ftruncate($filenum, 0);
    fwrite($filenum, $iconfigfile);
    fclose($filenum);
    //==names
    $t = '$INSTALLER09';
    $nconfigfile = "<" . "?php\n/**\n{$lang['staffcfg_file_created']}" . date('M d Y H:i:s') . ".\n{$lang['staffcfg_mod_by']}\n**/\n";
    $nconfigfile .= "" . $t . "['staff']['allowed'] = array(";
    $nconfigfile .= "" . join(",", $usernames);
    $nconfigfile .= ");";
    $nconfigfile .= "\n?" . ">";
    $filenum1 = fopen('./cache/staff_settings2.php', 'w');
    ftruncate($filenum1, 0);
    fwrite($filenum1, $nconfigfile);
    fclose($filenum1);
    stderr($lang['staffcfg_success'], $lang['staffcfg_updated']);
}
Exemplo n.º 15
0
function iUsers($iname, $ipass, $imail)
{
    global $admin_file, $CURUSER;
    if ($_SERVER["REQUEST_METHOD"] == "POST") {
        list($iclass) = mysql_fetch_row(sql_query('SELECT class FROM users WHERE username = '******'Администратор ' . $CURUSER['username'] . ' пробовал изменить учетные данные пользователя ' . $iname . ' классом выше!', 'red', 'error');
        } else {
            $updateset = array();
            if (!empty($ipass)) {
                $secret = mksecret();
                $hash = md5($secret . $ipass . $secret);
                $updateset[] = "secret = " . sqlesc($secret);
                $updateset[] = "passhash = " . sqlesc($hash);
            }
            if (!empty($imail) && validemail($imail)) {
                $updateset[] = "email = " . sqlesc($imail);
            }
            if (count($updateset)) {
                $res = sql_query("UPDATE users SET " . implode(", ", $updateset) . " WHERE username = "******"Ошибка", "Смена пароля завершилась неудачей! Возможно указано несуществующее имя пользователя.", "error");
            } else {
                stdmsg("Изменения пользователя прошло успешно", "Имя пользователя: " . $iname . (!empty($hash) ? "<br />Новый пароль: " . $ipass : "") . (!empty($imail) ? "<br />Новая почта: " . $imail : ""));
            }
        }
    } else {
        echo "<form method=\"post\" action=\"" . $admin_file . ".php?op=iUsers\">" . "<table border=\"0\" cellspacing=\"0\" cellpadding=\"3\">" . "<tr><td class=\"colhead\" colspan=\"2\">Смена пароля</td></tr>" . "<tr>" . "<td><b>Пользователь</b></td>" . "<td><input name=\"iname\" type=\"text\"></td>" . "</tr>" . "<tr>" . "<td><b>Новый пароль</b></td>" . "<td><input name=\"ipass\" type=\"password\"></td>" . "</tr>" . "<tr>" . "<td><b>Новая почта</b></td>" . "<td><input name=\"imail\" type=\"text\"></td>" . "</tr>" . "<tr><td colspan=\"2\" align=\"center\"><input type=\"submit\" name=\"isub\" value=\"Сделать\"></td></tr>" . "</table>" . "<input type=\"hidden\" name=\"op\" value=\"iUsers\" />" . "</form>";
    }
}
Exemplo n.º 16
0
function print_list()
{
    global $uid, $tid, $ajax;
    $target = $ajax ? '_self' : '_parent';
    $qt = sql_query("SELECT th.userid, u.username, u.seedbonus FROM thanks as th INNER JOIN users as u ON u.id=th.userid WHERE th.torrentid=" . sqlesc($tid) . " ORDER BY u.class DESC") or sqlerr(__FILE__, __LINE__);
    $list = array();
    $hadTh = false;
    if (mysqli_num_rows($qt) > 0) {
        while ($a = mysqli_fetch_assoc($qt)) {
            $list[] = '<a href=\'userdetails.php?id=' . (int) $a['userid'] . '\' target=\'' . $target . '\'>' . htmlsafechars($a['username']) . '</a>';
            $ids[] = (int) $a['userid'];
        }
        $hadTh = in_array($uid, $ids) ? true : false;
    }
    if ($ajax) {
        return json_encode(array('list' => count($list) > 0 ? join(', ', $list) : 'Not yet', 'hadTh' => $hadTh, 'status' => true));
    } else {
        $form = !$hadTh ? "<br/><form action='thanks.php' method='post'><input type='submit' class='btn' name='submit' value='Say thanks' /><input type='hidden' name='torrentid' value='{$tid}' /><input type='hidden' name='action' value='add' /></form>" : "";
        $out = count($list) > 0 ? join(', ', $list) : 'Not yet';
        return <<<IFRAME
        
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<style type='text/css'>
body { margin:0;padding:0; 
\t   font-size:12px;
\t   font-family:arial,sans-serif;
\t   color: #FFFFFF;
}
a, a:link, a:visited {
  text-decoration: none;
  color: #FFFFFF;
  font-size:12px;
}
a:hover {
  color: #FFFFFF
  text-decoration:underline;
  
}
.btn {
background-color:#890537;
border:1px solid #000000;
color:#FFFFFF;
font-family:arial,sans-serif;
font-size:12px;
padding:1px 3px;
}
</style>
<title>::</title>
</head>
<body>
{$out}{$form}
</body>
</html>

IFRAME;
    }
}
Exemplo n.º 17
0
function deletetorrent_xbt($id)
{
    global $INSTALLER09, $mc1, $CURUSER, $lang;
    sql_query("UPDATE torrents SET flags = 1 WHERE id = " . sqlesc($id)) or sqlerr(__FILE__, __LINE__);
    sql_query("DELETE files.*, comments.*, thankyou.*, thanks.*, thumbsup.*, bookmarks.*, coins.*, rating.*, xbt_files_users.* FROM xbt_files_users\n                                     LEFT JOIN files ON files.torrent = xbt_files_users.fid\n                                     LEFT JOIN comments ON comments.torrent = xbt_files_users.fid\n                                     LEFT JOIN thankyou ON thankyou.torid = xbt_files_users.fid\n                                     LEFT JOIN thanks ON thanks.torrentid = xbt_files_users.fid\n                                     LEFT JOIN bookmarks ON bookmarks.torrentid = xbt_files_users.fid\n                                     LEFT JOIN coins ON coins.torrentid = xbt_files_users.fid\n                                     LEFT JOIN rating ON rating.torrent = xbt_files_users.fid\n                                     LEFT JOIN thumbsup ON thumbsup.torrentid = xbt_files_users.fid\n                                     WHERE xbt_files_users.fid =" . sqlesc($id)) or sqlerr(__FILE__, __LINE__);
    unlink("{$INSTALLER09['torrent_dir']}/{$id}.torrent");
    $mc1->delete_value('MyPeers_XBT_' . $CURUSER['id']);
}
Exemplo n.º 18
0
 function addbookmark($torrentid)
 {
     global $CURUSER;
     if (get_row_count("bookmarks", "WHERE userid={$CURUSER['id']} AND torrentid = {$torrentid}") > 0) {
         stderr("Error", "Torrent already bookmarked");
     }
     sql_query("INSERT INTO bookmarks (userid, torrentid) VALUES ({$CURUSER['id']}, {$torrentid})") or sqlerr(__FILE__, __LINE__);
 }
Exemplo n.º 19
0
function cleanup_log($data)
{
    $text = sqlesc($data['clean_title']);
    $added = TIME_NOW;
    $ip = sqlesc($_SERVER['REMOTE_ADDR']);
    $desc = sqlesc($data['clean_desc']);
    sql_query("INSERT INTO cleanup_log (clog_event, clog_time, clog_ip, clog_desc) VALUES ({$text}, {$added}, {$ip}, {$desc})") or sqlerr(__FILE__, __LINE__);
}
Exemplo n.º 20
0
function getpage()
{
    global $CURUSER;
    $page = getenv("SCRIPT_NAME");
    if ($CURUSER && $CURUSER["page_now"] != $page) {
        sql_query("UPDATE users SET page_now = " . sqlesc($page) . " WHERE id = {$CURUSER['id']}") or sqlerr(__FILE__, __LINE__);
    }
}
function docleanup($data)
{
    global $INSTALLER09, $queries;
    set_time_limit(0);
    ignore_user_abort(1);
    $lconf = sql_query('SELECT * FROM lottery_config') or sqlerr(__FILE__, __LINE__);
    while ($aconf = mysqli_fetch_assoc($lconf)) {
        $lottery_config[$aconf['name']] = $aconf['value'];
    }
    if ($lottery_config['enable'] && TIME_NOW > $lottery_config['end_date']) {
        $q = mysqli_query($GLOBALS["___mysqli_ston"], 'SELECT t.user as uid, u.seedbonus, u.modcomment FROM tickets as t LEFT JOIN users as u ON u.id = t.user ORDER BY RAND() ') or sqlerr(__FILE__, __LINE__);
        while ($a = mysqli_fetch_assoc($q)) {
            $tickets[] = $a;
        }
        shuffle($tickets);
        $lottery['winners'] = array();
        $lottery['total_tickets'] = count($tickets);
        for ($i = 0; $i < $lottery['total_tickets']; $i++) {
            if (!isset($lottery['winners'][$tickets[$i]['uid']])) {
                $lottery['winners'][$tickets[$i]['uid']] = $tickets[$i];
            }
            if ($lottery_config['total_winners'] == count($lottery['winners'])) {
                break;
            }
        }
        if ($lottery_config['use_prize_fund']) {
            $lottery['total_pot'] = $lottery_config['prize_fund'];
        } else {
            $lottery['total_pot'] = $lottery['total_tickets'] * $lottery_config['ticket_amount'];
        }
        $lottery['user_pot'] = round($lottery['total_pot'] / $lottery_config['total_winners'], 2);
        $msg['subject'] = sqlesc('You have won the lottery');
        $msg['body'] = sqlesc('Congratulations, You have won : ' . $lottery['user_pot'] . '. This has been added to your seedbonus total amount. Thanks for playing Lottery.');
        foreach ($lottery['winners'] as $winner) {
            $_userq[] = '(' . $winner['uid'] . ',' . ($winner['seedbonus'] + $lottery['user_pot']) . ',' . sqlesc("User won the lottery: " . $lottery['user_pot'] . " at " . get_date(TIME_NOW, 'LONG') . "\n" . $winner['modcomment']) . ')';
            $_pms[] = '(0,' . $winner['uid'] . ',' . $msg['subject'] . ',' . $msg['body'] . ',' . TIME_NOW . ')';
        }
        $lconfig_update = array('(\'enable\',0)', '(\'lottery_winners_time\',' . TIME_NOW . ')', '(\'lottery_winners_amount\',' . $lottery['user_pot'] . ')', '(\'lottery_winners\',\'' . join('|', array_keys($lottery['winners'])) . '\')');
        if (count($_userq)) {
            sql_query('INSERT INTO users(id,seedbonus,modcomment) VALUES ' . join(',', $_userq) . ' ON DUPLICATE KEY UPDATE seedbonus = values(seedbonus), modcomment = values(modcomment)') or die(is_object($GLOBALS["___mysqli_ston"]) ? mysqli_error($GLOBALS["___mysqli_ston"]) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false));
        }
        if (count($_pms)) {
            sql_query('INSERT INTO messages(sender, receiver, subject, msg, added) VALUES ' . join(',', $_pms)) or die(is_object($GLOBALS["___mysqli_ston"]) ? mysqli_error($GLOBALS["___mysqli_ston"]) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false));
        }
        sql_query('INSERT INTO lottery_config(name,value) VALUES ' . join(',', $lconfig_update) . ' ON DUPLICATE KEY UPDATE value=values(value)') or die(is_object($GLOBALS["___mysqli_ston"]) ? mysqli_error($GLOBALS["___mysqli_ston"]) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false));
        sql_query('DELETE FROM tickets') or die(is_object($GLOBALS["___mysqli_ston"]) ? mysqli_error($GLOBALS["___mysqli_ston"]) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false));
    }
    //==End 09 seedbonus lottery by putyn
    if ($queries > 0) {
        write_log("Lottery clean-------------------- lottery Complete using {$queries} queries --------------------");
    }
    if (false !== mysqli_affected_rows($GLOBALS["___mysqli_ston"])) {
        $data['clean_desc'] = mysqli_affected_rows($GLOBALS["___mysqli_ston"]) . " items deleted";
    }
    if ($data['clean_log']) {
        cleanup_log($data);
    }
}
Exemplo n.º 22
0
function kaupa($PRI)
{
    global $CURUSER, $lang;
    if ($PRI > $CURUSER['coins']) {
        stderr($lang['shop_error'], $lang['shop_notenn']);
    } else {
        sql_query("UPDATE users SET coins=coins-{$PRI} WHERE id={$CURUSER['id']}") or sqlerr(__FILE__, __LINE__);
    }
}
Exemplo n.º 23
0
function changestealstatus($userid, $num, $reset)
{
    $userid = sqlesc($userid);
    if ($reset == 'no') {
        sql_query("UPDATE users SET stealstatus = stealstatus + {$num} WHERE id={$userid}") or sqlerr(__FILE__, __LINE__);
    } else {
        sql_query("UPDATE users SET stealstatus = {$reset} WHERE id={$userid}") or sqlerr(__FILE__, __LINE__);
    }
}
Exemplo n.º 24
0
function safe_query($query, $id, $where = '')
{
    $query = sprintf("{$query} WHERE id ='%s'", mysql_real_escape_string($id));
    $result = sql_query($query);
    if (!$result) {
        return sqlerr(__FILE__, __LINE__);
    }
    redirect("maxlogin.php?update=" . htmlspecialchars($where));
}
Exemplo n.º 25
0
function add_egg($cnt)
{
    for ($i = 0; $i < $cnt; $i++) {
        $key = md5(mt_rand(0, 3000000) . time() . mt_rand(0, 3000000) . "easteregg");
        $sql = "INSERT INTO easteregg (eggkey, userid) VALUES (\"{$key}\", 0)";
        //echo $sql;
        sql_query($sql) or sqlerr(__FILE__, __LINE__);
    }
}
Exemplo n.º 26
0
function docleanup($data)
{
    global $INSTALLER09, $queries, $mc1;
    set_time_limit(1200);
    ignore_user_abort(1);
    // ===Clear funds on first day of the month
    if (date("d") == 1) {
        sql_query("TRUNCATE funds");
    }
    //if (mysqli_affected_rows() > 0)
    $mc1->delete_value('totalfunds_');
    // ===End
    //== Donation Progress Mod Updated For Tbdev 2009/2010 by Bigjoos/pdq
    $res = sql_query("SELECT id, modcomment, vipclass_before FROM users WHERE donor='yes' AND donoruntil < " . TIME_NOW . " AND donoruntil <> '0'") or sqlerr(__FILE__, __LINE__);
    $msgs_buffer = $users_buffer = array();
    if (mysqli_num_rows($res) > 0) {
        $subject = "Donor status removed by system.";
        $msg = "Your Donor status has timed out and has been auto-removed by the system, and your Vip status has been removed. We would like to thank you once again for your support to {$INSTALLER09['site_name']}. If you wish to re-new your donation, Visit the site paypal link. Cheers!\n";
        while ($arr = mysqli_fetch_assoc($res)) {
            $modcomment = $arr['modcomment'];
            $modcomment = get_date(TIME_NOW, 'DATE', 1) . " - Donation status Automatically Removed By System.\n" . $modcomment;
            $modcom = sqlesc($modcomment);
            $msgs_buffer[] = '(0,' . $arr['id'] . ',' . TIME_NOW . ', ' . sqlesc($msg) . ',' . sqlesc($subject) . ')';
            $users_buffer[] = '(' . $arr['id'] . ',' . $arr['vipclass_before'] . ',\'no\',\'0\', ' . $modcom . ')';
            $update['class'] = $arr['vipclass_before'];
            $mc1->begin_transaction('user' . $arr['id']);
            $mc1->update_row(false, array('class' => $update['class'], 'donor' => 'no', 'donoruntil' => 0));
            $mc1->commit_transaction($INSTALLER09['expires']['user_cache']);
            $mc1->begin_transaction('user_stats_' . $arr['id']);
            $mc1->update_row(false, array('modcomment' => $modcomment));
            $mc1->commit_transaction($INSTALLER09['expires']['user_stats']);
            $mc1->begin_transaction('MyUser_' . $arr['id']);
            $mc1->update_row(false, array('class' => $update['class'], 'donor' => 'no', 'donoruntil' => 0));
            $mc1->commit_transaction($INSTALLER09['expires']['curuser']);
            $mc1->delete_value('inbox_new_' . $arr['id']);
            $mc1->delete_value('inbox_new_sb_' . $arr['id']);
        }
        $count = count($users_buffer);
        if ($count > 0) {
            sql_query("INSERT INTO messages (sender,receiver,added,msg,subject) VALUES " . implode(', ', $msgs_buffer)) or sqlerr(__FILE__, __LINE__);
            sql_query("INSERT INTO users (id, class, donor, donoruntil, modcomment) VALUES " . implode(', ', $users_buffer) . " ON DUPLICATE key UPDATE class=values(class),\n            donor=values(donor),donoruntil=values(donoruntil),modcomment=concat(values(modcomment),modcomment)") or sqlerr(__FILE__, __LINE__);
            write_log("Cleanup: Donation status expired - " . $count . " Member(s)");
        }
        unset($users_buffer, $msgs_buffer, $update, $count);
    }
    //===End===//
    if ($queries > 0) {
        write_log("Delete Old Funds Clean -------------------- Delete Old Funds cleanup Complete using {$queries} queries --------------------");
    }
    if (false !== mysqli_affected_rows($GLOBALS["___mysqli_ston"])) {
        $data['clean_desc'] = mysqli_affected_rows($GLOBALS["___mysqli_ston"]) . " items deleted/updated";
    }
    if ($data['clean_log']) {
        cleanup_log($data);
    }
}
Exemplo n.º 27
0
function safe_query($query, $id)
{
    $query = sprintf("{$query} WHERE id ='%s'", mysql_real_escape_string($id));
    $result = sql_query($query);
    if (!$result) {
        return sqlerr(__FILE__, __LINE__);
    } else {
        redirect('maxlogin.php');
    }
}
Exemplo n.º 28
0
 function addbookmark($torrentid)
 {
     global $CURUSER, $mc1, $INSTALLER09;
     if (get_row_count("bookmarks", "WHERE userid=" . sqlesc($CURUSER['id']) . " AND torrentid = " . sqlesc($torrentid)) > 0) {
         stderr("Error", "Torrent already bookmarked");
     }
     sql_query("INSERT INTO bookmarks (userid, torrentid) VALUES (" . sqlesc($CURUSER['id']) . ", " . sqlesc($torrentid) . ")") or sqlerr(__FILE__, __LINE__);
     $mc1->delete_value('bookmm_' . $CURUSER['id']);
     make_bookmarks($CURUSER['id'], 'bookmm_');
 }
Exemplo n.º 29
0
function docleanup($data)
{
    global $INSTALLER09, $queries, $mc1;
    set_time_limit(1200);
    ignore_user_abort(1);
    //== Updated promote power users
    $limit = 25 * 1024 * 1024 * 1024;
    $minratio = 1.05;
    $maxdt = TIME_NOW - 86400 * 28;
    $res = sql_query("SELECT id, uploaded, downloaded, invites, modcomment FROM users WHERE class = " . UC_USER . " AND uploaded >= {$limit} AND uploaded / downloaded >= {$minratio} AND enabled='yes' AND added < {$maxdt}") or sqlerr(__FILE__, __LINE__);
    $msgs_buffer = $users_buffer = array();
    if (mysqli_num_rows($res) > 0) {
        $subject = "Auto Promotion";
        $msg = "Congratulations, you have been Auto-Promoted to [b]Power User[/b]. :)\n You get one extra invite.\n";
        while ($arr = mysqli_fetch_assoc($res)) {
            $ratio = number_format($arr['uploaded'] / $arr['downloaded'], 3);
            $modcomment = $arr['modcomment'];
            $modcomment = get_date(TIME_NOW, 'DATE', 1) . " - Promoted to Power User by System (UL=" . mksize($arr['uploaded']) . ", DL=" . mksize($arr['downloaded']) . ", R=" . $ratio . ").\n" . $modcomment;
            $modcom = sqlesc($modcomment);
            $msgs_buffer[] = '(0,' . $arr['id'] . ', ' . TIME_NOW . ', ' . sqlesc($msg) . ', ' . sqlesc($subject) . ')';
            $users_buffer[] = '(' . $arr['id'] . ', 1, 1, ' . $modcom . ')';
            $update['invites'] = $arr['invites'] + 1;
            $mc1->begin_transaction('user' . $arr['id']);
            $mc1->update_row(false, array('class' => 1, 'invites' => $update['invites']));
            $mc1->commit_transaction($INSTALLER09['expires']['user_cache']);
            $mc1->begin_transaction('user_stats_' . $arr['id']);
            $mc1->update_row(false, array('modcomment' => $modcomment));
            $mc1->commit_transaction($INSTALLER09['expires']['user_stats']);
            $mc1->begin_transaction('MyUser_' . $arr['id']);
            $mc1->update_row(false, array('class' => 1, 'invites' => $update['invites']));
            $mc1->commit_transaction($INSTALLER09['expires']['curuser']);
            $mc1->delete_value('inbox_new_' . $arr['id']);
            $mc1->delete_value('inbox_new_sb_' . $arr['id']);
        }
        $count = count($users_buffer);
        if ($count > 0) {
            sql_query("INSERT INTO messages (sender,receiver,added,msg,subject) VALUES " . implode(', ', $msgs_buffer)) or sqlerr(__FILE__, __LINE__);
            sql_query("INSERT INTO users (id, class, invites, modcomment) VALUES " . implode(', ', $users_buffer) . " ON DUPLICATE key UPDATE class=values(class), invites = invites+values(invites), modcomment=concat(values(modcomment),modcomment)") or sqlerr(__FILE__, __LINE__);
            write_log("Cleanup: Promoted " . $count . " member(s) from User to Power User");
        }
        unset($users_buffer, $msgs_buffer, $update, $count);
        status_change($arr['id']);
        //== For Retros announcement mod
    }
    //==
    if ($queries > 0) {
        write_log("Power User Updates -------------------- Power User Updates Clean Complete using {$queries} queries--------------------");
    }
    if (false !== mysqli_affected_rows($GLOBALS["___mysqli_ston"])) {
        $data['clean_desc'] = mysqli_affected_rows($GLOBALS["___mysqli_ston"]) . " items deleted/updated";
    }
    if ($data['clean_log']) {
        cleanup_log($data);
    }
}
Exemplo n.º 30
0
/**
 *   https://github.com/Bigjoos/
 *   Licence Info: GPL
 *   Copyright (C) 2010 U-232 v.3
 *   A bittorrent tracker source based on TBDev.net/tbsource/bytemonsoon.
 *   Project Leaders: Mindless, putyn.
 *
 */
function check_banned_emails($email)
{
    global $lang;
    $expl = explode("@", $email);
    $wildemail = "*@" . $expl[1];
    /* Ban emails by x0r @tbdev.net */
    $res = sql_query("SELECT id, comment FROM bannedemails WHERE email = " . sqlesc($email) . " OR email = " . sqlesc($wildemail)) or sqlerr(__FILE__, __LINE__);
    if ($arr = mysqli_fetch_assoc($res)) {
        stderr("{$lang['takesignup_user_error']}", "{$lang['takesignup_bannedmail']}" . htmlsafechars($arr['comment']));
    }
}