当前位置: 首页>>代码示例>>PHP>>正文


PHP KPS函数代码示例

本文整理汇总了PHP中KPS函数的典型用法代码示例。如果您正苦于以下问题:PHP KPS函数的具体用法?PHP KPS怎么用?PHP KPS使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了KPS函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: get_single_value

    $Cache->delete_value('topic_' . $topicid . '_post_count');
    // update forum
    $forumid = get_single_value("topics", "forumid", "WHERE id=" . sqlesc($topicid));
    if (!$forumid) {
        die;
    } else {
        sql_query("UPDATE forums SET postcount=postcount-1 WHERE id=" . sqlesc($forumid));
    }
    $forum_last_replied_topic_row = $Cache->get_value('forum_' . $forumid . '_last_replied_topic_content');
    if ($forum_last_replied_topic_row && $forum_last_replied_topic_row['lastpost'] == $postid) {
        $Cache->delete_value('forum_' . $forumid . '_last_replied_topic_content');
    }
    //------- Update topic
    update_topic_last_post($topicid);
    //===remove karma
    KPS("-", $makepost_bonus, $userid);
    header("Location: " . get_protocol_prefix() . "{$BASEURL}/forums.php?action=viewtopic&topicid={$topicid}{$redirtopost}");
    die;
}
//-------- Action: Set locked on/off
if ($action == "setlocked") {
    $topicid = 0 + $_POST["topicid"];
    $ismod = is_forum_moderator($topicid, 'topic');
    if (!$topicid || get_user_class() < $postmanage_class && !$ismod) {
        permissiondenied();
    }
    $locked = sqlesc($_POST["locked"]);
    sql_query("UPDATE topics SET locked={$locked} WHERE id={$topicid}") or sqlerr(__FILE__, __LINE__);
    header("Location: {$_POST['returnto']}");
    die;
}
开发者ID:CptTZ,项目名称:NexusPHP-1,代码行数:31,代码来源:forums.php

示例2: bark

    bark("mysql puked: " . mysql_error());
    //bark("mysql puked: ".preg_replace_callback('/./s', "hex_esc2", mysql_error()));
}
$id = mysql_insert_id();
@sql_query("DELETE FROM files WHERE torrent = {$id}");
foreach ($filelist as $file) {
    @sql_query("INSERT INTO files (torrent, filename, size) VALUES ({$id}, " . sqlesc($file[0]) . "," . $file[1] . ")");
}
//move_uploaded_file($tmpname, "$torrent_dir/$id.torrent");
$fp = fopen("{$torrent_dir}/{$id}.torrent", "w");
if ($fp) {
    @fwrite($fp, benc($dict), strlen(benc($dict)));
    fclose($fp);
}
//===add karma
KPS("+", $uploadtorrent_bonus, $CURUSER["id"]);
//===end
write_log("Torrent {$id} ({$torrent}) was uploaded by {$anon}");
//===notify people who voted on offer thanks CoLdFuSiOn :)
if ($is_offer) {
    $res = sql_query("SELECT `userid` FROM `offervotes` WHERE `userid` != " . $CURUSER["id"] . " AND `offerid` = " . sqlesc($offerid) . " AND `vote` = 'yeah'") or sqlerr(__FILE__, __LINE__);
    while ($row = mysql_fetch_assoc($res)) {
        $pn_msg = $lang_takeupload_target[get_user_lang($row["userid"])]['msg_offer_you_voted'] . $torrent . $lang_takeupload_target[get_user_lang($row["userid"])]['msg_was_uploaded_by'] . $CURUSER["username"] . $lang_takeupload_target[get_user_lang($row["userid"])]['msg_you_can_download'] . "[url=" . get_protocol_prefix() . "{$BASEURL}/details.php?id={$id}&hit=1]" . $lang_takeupload_target[get_user_lang($row["userid"])]['msg_here'] . "[/url]";
        //=== use this if you DO have subject in your PMs
        $subject = $lang_takeupload_target[get_user_lang($row["userid"])]['msg_offer'] . $torrent . $lang_takeupload_target[get_user_lang($row["userid"])]['msg_was_just_uploaded'];
        //=== use this if you DO NOT have subject in your PMs
        //$some_variable .= "(0, $row[userid], '" . date("Y-m-d H:i:s") . "', " . sqlesc($pn_msg) . ")";
        //=== use this if you DO have subject in your PMs
        sql_query("INSERT INTO messages (sender, subject, receiver, added, msg) VALUES (0, " . sqlesc($subject) . ", {$row['userid']}, " . sqlesc(date("Y-m-d H:i:s")) . ", " . sqlesc($pn_msg) . ")") or sqlerr(__FILE__, __LINE__);
        //=== use this if you do NOT have subject in your PMs
        //sql_query("INSERT INTO messages (sender, receiver, added, msg) VALUES ".$some_variable."") or sqlerr(__FILE__, __LINE__);
开发者ID:CptTZ,项目名称:NexusPHP-1,代码行数:31,代码来源:takeupload.php

示例3: funreward

function funreward($funvote, $totalvote, $title, $posterid, $bonus)
{
    global $lang_fun_target, $lang_fun;
    KPS("+", $bonus, $posterid);
    $subject = $lang_fun_target[get_user_lang($posterid)]['msg_fun_item_reward'];
    $msg = $funvote . $lang_fun_target[get_user_lang($posterid)]['msg_out_of'] . $totalvote . $lang_fun_target[get_user_lang($posterid)]['msg_people_think'] . $title . $lang_fun_target[get_user_lang($posterid)]['msg_is_fun'] . $bonus . $lang_fun_target[get_user_lang($posterid)]['msg_bonus_as_reward'];
    $sql = "INSERT INTO messages (sender, subject, receiver, added, msg) VALUES(0, " . sqlesc($subject) . "," . $posterid . ",'" . date("Y-m-d H:i:s") . "', " . sqlesc($msg) . ")";
    sql_query($sql) or sqlerr(__FILE__, __LINE__);
    $Cache->delete_value('user_' . $posterid . '_unread_message_count');
    $Cache->delete_value('user_' . $posterid . '_inbox_count');
}
开发者ID:CptTZ,项目名称:NexusPHP,代码行数:11,代码来源:fun.php

示例4: sql_query

        if ($CURUSER && $choice != "" && $choice < 256 && $choice == floor($choice)) {
            $res = sql_query("SELECT * FROM polls ORDER BY added DESC LIMIT 1") or sqlerr(__FILE__, __LINE__);
            $arr = mysql_fetch_assoc($res) or die($lang_index['std_no_poll']);
            $pollid = $arr["id"];
            $hasvoted = get_row_count("pollanswers", "WHERE pollid=" . sqlesc($pollid) . " && userid=" . sqlesc($CURUSER["id"]));
            if ($hasvoted) {
                stderr($lang_index['std_error'], $lang_index['std_duplicate_votes_denied']);
            }
            sql_query("INSERT INTO pollanswers VALUES(0, " . sqlesc($pollid) . ", " . sqlesc($CURUSER["id"]) . ", " . sqlesc($choice) . ")") or sqlerr(__FILE__, __LINE__);
            $Cache->delete_value('current_poll_content');
            $Cache->delete_value('current_poll_result', true);
            if (mysql_affected_rows() != 1) {
                stderr($lang_index['std_error'], $lang_index['std_vote_not_counted']);
            }
            //add karma
            KPS("+", $pollvote_bonus, $userid);
            header("Location: " . get_protocol_prefix() . "{$BASEURL}/");
            die;
        } else {
            stderr($lang_index['std_error'], $lang_index['std_option_unselected']);
        }
    }
}
stdhead($lang_index['head_home']);
begin_main_frame();
// ------------- start: recent news ------------------//
print "<h2>" . $lang_index['text_recent_news'] . (get_user_class() >= $newsmanage_class ? " - <font class=\"small\">[<a class=\"altlink\" href=\"news.php\"><b>" . $lang_index['text_news_page'] . "</b></a>]</font>" : "") . "</h2>";
$Cache->new_page('recent_news', 86400, true);
if (!$Cache->get_page()) {
    $res = sql_query("SELECT * FROM news ORDER BY added DESC LIMIT " . (int) $maxnewsnum_main) or sqlerr(__FILE__, __LINE__);
    if (mysql_num_rows($res) > 0) {
开发者ID:CptTZ,项目名称:NexusPHP,代码行数:31,代码来源:index.php

示例5: docleanup

function docleanup($forceAll = 0, $printProgress = false)
{
    //require_once(get_langfile_path("cleanup.php",true));
    global $lang_cleanup_target;
    global $torrent_dir, $signup_timeout, $max_dead_torrent_time, $autoclean_interval_one, $autoclean_interval_two, $autoclean_interval_three, $autoclean_interval_four, $autoclean_interval_five, $SITENAME, $bonus, $invite_timeout, $offervotetimeout_main, $offeruptimeout_main, $iniupload_main;
    global $donortimes_bonus, $perseeding_bonus, $maxseeding_bonus, $tzero_bonus, $nzero_bonus, $bzero_bonus, $l_bonus;
    global $expirehalfleech_torrent, $expirefree_torrent, $expiretwoup_torrent, $expiretwoupfree_torrent, $expiretwouphalfleech_torrent, $expirethirtypercentleech_torrent, $expirenormal_torrent, $hotdays_torrent, $hotseeder_torrent, $halfleechbecome_torrent, $freebecome_torrent, $twoupbecome_torrent, $twoupfreebecome_torrent, $twouphalfleechbecome_torrent, $thirtypercentleechbecome_torrent, $normalbecome_torrent, $deldeadtorrent_torrent;
    global $neverdelete_account, $neverdeletepacked_account, $deletepacked_account, $deleteunpacked_account, $deletenotransfer_account, $deletenotransfertwo_account, $deletepeasant_account, $psdlone_account, $psratioone_account, $psdltwo_account, $psratiotwo_account, $psdlthree_account, $psratiothree_account, $psdlfour_account, $psratiofour_account, $psdlfive_account, $psratiofive_account, $putime_account, $pudl_account, $puprratio_account, $puderatio_account, $eutime_account, $eudl_account, $euprratio_account, $euderatio_account, $cutime_account, $cudl_account, $cuprratio_account, $cuderatio_account, $iutime_account, $iudl_account, $iuprratio_account, $iuderatio_account, $vutime_account, $vudl_account, $vuprratio_account, $vuderatio_account, $exutime_account, $exudl_account, $exuprratio_account, $exuderatio_account, $uutime_account, $uudl_account, $uuprratio_account, $uuderatio_account, $nmtime_account, $nmdl_account, $nmprratio_account, $nmderatio_account, $getInvitesByPromotion_class;
    global $enablenoad_advertisement, $noad_advertisement;
    global $Cache;
    set_time_limit(0);
    ignore_user_abort(1);
    $now = time();
    //Priority Class 1: cleanup every 15 mins
    //2.update peer status
    $deadtime = deadtime();
    $deadtime = date("Y-m-d H:i:s", $deadtime);
    sql_query("DELETE FROM peers WHERE last_action < " . sqlesc($deadtime)) or sqlerr(__FILE__, __LINE__);
    if ($printProgress) {
        printProgress('update peer status');
    }
    //11.calculate seeding bonus
    $res = sql_query("SELECT DISTINCT userid FROM peers WHERE seeder = 'yes'") or sqlerr(__FILE__, __LINE__);
    if (mysql_num_rows($res) > 0) {
        $sqrtof2 = sqrt(2);
        $logofpointone = log(0.1);
        $valueone = $logofpointone / $tzero_bonus;
        $pi = 3.141592653589793;
        $valuetwo = $bzero_bonus * (2 / $pi);
        $valuethree = $logofpointone / ($nzero_bonus - 1);
        $timenow = TIMENOW;
        $sectoweek = 7 * 24 * 60 * 60;
        while ($arr = mysql_fetch_assoc($res)) {
            $A = 0;
            $count = 0;
            $all_bonus = 0;
            $torrentres = sql_query("select torrents.added, torrents.size, torrents.seeders from torrents LEFT JOIN peers ON peers.torrent = torrents.id WHERE peers.userid = {$arr['userid']} AND peers.seeder ='yes'") or sqlerr(__FILE__, __LINE__);
            while ($torrent = mysql_fetch_array($torrentres)) {
                $weeks_alive = ($timenow - strtotime($torrent[added])) / $sectoweek;
                $gb_size = $torrent[size] / 1073741824;
                $temp = (1 - exp($valueone * $weeks_alive)) * $gb_size * (1 + $sqrtof2 * exp($valuethree * ($torrent[seeders] - 1)));
                $A += $temp;
                $count++;
            }
            if ($count > $maxseeding_bonus) {
                $count = $maxseeding_bonus;
            }
            $all_bonus = ($valuetwo * atan($A / $l_bonus) + $perseeding_bonus * $count) / (3600 / $autoclean_interval_one);
            $is_donor = get_single_value("users", "donor", "WHERE id=" . $arr['userid']);
            if ($is_donor == 'yes' && $donortimes_bonus > 0) {
                $all_bonus = $all_bonus * $donortimes_bonus;
            }
            KPS("+", $all_bonus, $arr["userid"]);
        }
    }
    if ($printProgress) {
        printProgress('calculate seeding bonus');
    }
    //Priority Class 2: cleanup every 30 mins
    $res = sql_query("SELECT value_u FROM avps WHERE arg = 'lastcleantime2'");
    $row = mysql_fetch_array($res);
    if (!$row) {
        sql_query("INSERT INTO avps (arg, value_u) VALUES ('lastcleantime2'," . sqlesc($now) . ")") or sqlerr(__FILE__, __LINE__);
        return;
    }
    $ts = $row[0];
    if ($ts + $autoclean_interval_two > $now && !$forceAll) {
        return 'Cleanup ends at Priority Class 1';
    } else {
        sql_query("UPDATE avps SET value_u = " . sqlesc($now) . " WHERE arg='lastcleantime2'") or sqlerr(__FILE__, __LINE__);
    }
    //2.5.update torrents' visibility
    $deadtime = deadtime() - $max_dead_torrent_time;
    sql_query("UPDATE torrents SET visible='no' WHERE visible='yes' AND last_action < FROM_UNIXTIME({$deadtime}) AND seeders=0") or sqlerr(__FILE__, __LINE__);
    if ($printProgress) {
        printProgress("update torrents' visibility");
    }
    //Priority Class 3: cleanup every 60 mins
    $res = sql_query("SELECT value_u FROM avps WHERE arg = 'lastcleantime3'");
    $row = mysql_fetch_array($res);
    if (!$row) {
        sql_query("INSERT INTO avps (arg, value_u) VALUES ('lastcleantime3',{$now})") or sqlerr(__FILE__, __LINE__);
        return;
    }
    $ts = $row[0];
    if ($ts + $autoclean_interval_three > $now && !$forceAll) {
        return 'Cleanup ends at Priority Class 2';
    } else {
        sql_query("UPDATE avps SET value_u = " . sqlesc($now) . " WHERE arg='lastcleantime3'") or sqlerr(__FILE__, __LINE__);
    }
    //4.update count of seeders, leechers, comments for torrents
    $torrents = array();
    $res = sql_query("SELECT torrent, seeder, COUNT(*) AS c FROM peers GROUP BY torrent, seeder") or sqlerr(__FILE__, __LINE__);
    while ($row = mysql_fetch_assoc($res)) {
        if ($row["seeder"] == "yes") {
            $key = "seeders";
        } else {
            $key = "leechers";
        }
        $torrents[$row["torrent"]][$key] = $row["c"];
//.........这里部分代码省略.........
开发者ID:CptTZ,项目名称:NexusPHP,代码行数:101,代码来源:cleanup.php

示例6: dbconn

<?php

require_once "include/bittorrent.php";
dbconn();
loggedinorreturn();
if ($_GET['id']) {
    stderr("Party is over!", "This trick doesn't work anymore. You need to click the button!");
}
$userid = $CURUSER["id"];
$torrentid = $_POST["id"];
$tsql = sql_query("SELECT owner FROM torrents where id=" . sqlesc($torrentid));
$arr = mysql_fetch_array($tsql);
if (!$arr) {
    stderr("Error", "Invalid torrent id!");
}
$torrentowner = $arr['owner'];
$tsql = sql_query("SELECT COUNT(*) FROM thanks where torrentid=" . sqlesc($torrentid) . " and userid=" . sqlesc($userid));
$trows = mysql_fetch_array($tsql);
$t_ab = $trows[0];
if ($t_ab != 0) {
    stderr("Error", "You already said thanks!");
}
if (isset($userid) && isset($torrentid)) {
    $res = sql_query("INSERT INTO thanks (torrentid, userid) VALUES (" . sqlesc($torrentid) . ", " . sqlesc($userid) . ")");
    KPS("+", $saythanks_bonus, $CURUSER['id']);
    //User gets bonus for saying thanks
    KPS("+", $receivethanks_bonus, $torrentowner);
    //Thanks receiver get bonus
}
开发者ID:skygunner,项目名称:nexusphp_v1.5_play,代码行数:29,代码来源:thanks.php

示例7: bark

    bark($lang_fastdelete['std_missing_form_data']);
}
$id = 0 + $id;
int_check($id);
$sure = $_GET["sure"];
$res = sql_query("SELECT name,owner,seeders,anonymous FROM torrents WHERE id = {$id}");
$row = mysql_fetch_array($res);
if (!$row) {
    die;
}
if (get_user_class() < $torrentmanage_class) {
    bark($lang_fastdelete['text_no_permission']);
}
if (!$sure) {
    stderr($lang_fastdelete['std_delete_torrent'], $lang_fastdelete['std_delete_torrent_note'] . "<a class=altlink href=fastdelete.php?id={$id}&sure=1>" . $lang_fastdelete['std_here_if_sure'], false);
}
deletetorrent($id);
KPS("-", $uploadtorrent_bonus, $row["owner"]);
if ($row['anonymous'] == 'yes' && $CURUSER["id"] == $row["owner"]) {
    write_log("Torrent {$id} ({$row['name']}) was deleted by its anonymous uploader", 'normal');
} else {
    write_log("Torrent {$id} ({$row['name']}) was deleted by {$CURUSER['username']}", 'normal');
}
//Send pm to torrent uploader
if ($CURUSER["id"] != $row["owner"]) {
    $dt = sqlesc(date("Y-m-d H:i:s"));
    $subject = sqlesc($lang_fastdelete_target[get_user_lang($row["owner"])]['msg_torrent_deleted']);
    $msg = sqlesc($lang_fastdelete_target[get_user_lang($row["owner"])]['msg_the_torrent_you_uploaded'] . $row['name'] . $lang_fastdelete_target[get_user_lang($row["owner"])]['msg_was_deleted_by'] . "[url=userdetails.php?id=" . $CURUSER['id'] . "]" . $CURUSER['username'] . "[/url]" . $lang_fastdelete_target[get_user_lang($row["owner"])]['msg_blank']);
    sql_query("INSERT INTO messages (sender, receiver, subject, added, msg) VALUES(0, {$row['owner']}, {$subject}, {$dt}, {$msg})") or sqlerr(__FILE__, __LINE__);
}
header("Refresh: 0; url=torrents.php");
开发者ID:CptTZ,项目名称:NexusPHP,代码行数:31,代码来源:fastdelete.php

示例8: sql_query

                sql_query("UPDATE offers SET allowed='allowed', allowedtime=" . sqlesc($finishtime) . " WHERE id=" . sqlesc($offerid)) or sqlerr(__FILE__, __LINE__);
                $msg = $lang_offers_target[get_user_lang($arr['userid'])]['msg_offer_voted_on'] . "[b][url=" . get_protocol_prefix() . $BASEURL . "/offers.php?id={$offerid}&off_details=1]" . $arr[name] . "[/url][/b]." . $lang_offers_target[get_user_lang($arr['userid'])]['msg_find_offer_option'] . $timeoutnote;
                $subject = $lang_offers_target[get_user_lang($arr['userid'])]['msg_your_offer_allowed'];
                sql_query("INSERT INTO messages (sender, receiver, added, msg, subject) VALUES(0, {$arr['userid']}, " . sqlesc(date("Y-m-d H:i:s")) . ", " . sqlesc($msg) . ", " . sqlesc($subject) . ")") or sqlerr(__FILE__, __LINE__);
                write_log("System allowed offer {$arr['name']}", 'normal');
            }
            //denied and send offer voted off message
            if ($against - $yeah >= $minoffervotes && $ya_arr['allowed'] != "denied") {
                sql_query("UPDATE offers SET allowed='denied' WHERE id=" . sqlesc($offerid)) or sqlerr(__FILE__, __LINE__);
                $msg = $lang_offers_target[get_user_lang($arr['userid'])]['msg_offer_voted_off'] . "[b][url=" . get_protocol_prefix() . $BASEURL . "/offers.php?id={$offid}&off_details=1]" . $arr[name] . "[/url][/b]." . $lang_offers_target[get_user_lang($arr['userid'])]['msg_offer_deleted'];
                $subject = $lang_offers_target[get_user_lang($arr['userid'])]['msg_offer_deleted'];
                sql_query("INSERT INTO messages (sender, receiver, added, msg, subject) VALUES(0, {$arr['userid']}, " . sqlesc(date("Y-m-d H:i:s")) . ", " . sqlesc($msg) . ", " . sqlesc($subject) . ")") or sqlerr(__FILE__, __LINE__);
                write_log("System denied offer {$arr['name']}", 'normal');
            }
            sql_query("INSERT INTO offervotes (offerid, userid, vote) VALUES({$offerid}, {$userid}, " . sqlesc($vote) . ")") or sqlerr(__FILE__, __LINE__);
            KPS("+", $offervote_bonus, $CURUSER["id"]);
            stdhead($lang_offers['head_vote_for_offer']);
            print "<h1 align=center>" . $lang_offers['std_vote_accepted'] . "</h1>";
            print $lang_offers['std_vote_accepted_note'] . "<a  href=offers.php?id={$offerid}&off_details=1>" . $lang_offers['std_back_to_offer_detail'];
            stdfoot();
            die;
        }
    } else {
        stderr($lang_offers['std_error'], $lang_offers['std_smell_rat']);
    }
}
//=== end offer votes
//=== delete offer
if ($_GET["del_offer"]) {
    $del_offer = 0 + $_GET["del_offer"];
    if ($del_offer != '1') {
开发者ID:CptTZ,项目名称:NexusPHP,代码行数:31,代码来源:offers.php

示例9: dbconn

dbconn();
require_once get_langfile_path();
$key = $_GET['key'];
$updatekey = $_GET['updatekey'];
if ($key) {
    if (!$CURUSER) {
        if ($prolinkpoint_bonus) {
            $res = sql_query("SELECT id FROM users WHERE promotion_link=" . sqlesc($key) . " LIMIT 1");
            $row = mysql_fetch_array($res);
            if ($row) {
                $ip = getip();
                $dt = sqlesc(date("Y-m-d H:i:s", TIMENOW - $prolinktime_bonus));
                $res2 = sql_query("SELECT COUNT(id) FROM prolinkclicks WHERE userid=" . sqlesc($row['id']) . " AND (added > " . $dt . " OR ip=" . sqlesc($ip) . ")");
                $row2 = mysql_fetch_array($res2);
                if ($row2[0] == 0) {
                    KPS("+", $prolinkpoint_bonus, $row['id']);
                    sql_query("INSERT INTO prolinkclicks (userid, ip, added) VALUES (" . $row['id'] . ", " . sqlesc($ip) . ", NOW())");
                }
            }
        }
    }
    header("Location: " . get_protocol_prefix() . $BASEURL);
} elseif (($updatekey || !$CURUSER['promotion_link']) && $CURUSER) {
    $promotionkey = md5($CURUSER['email'] . date("Y-m-d H:i:s") . $CURUSER['passhash']);
    sql_query("UPDATE users SET promotion_link=" . sqlesc($promotionkey) . " WHERE id=" . sqlesc($CURUSER['id']));
    header("Location: " . get_protocol_prefix() . $BASEURL . "/promotionlink.php");
} else {
    stdhead($lang_promotionlink['head_promotion_link']);
    begin_main_frame();
    $yourlink = get_protocol_prefix() . $BASEURL . "/promotionlink.php?key=" . $CURUSER['promotion_link'];
    $imgurl = get_protocol_prefix() . $BASEURL . "/" . $prolinkimg;
开发者ID:CptTZ,项目名称:NexusPHP,代码行数:31,代码来源:promotionlink.php

示例10: sql_query

 $delete = $_GET["delete"];
 if (is_valid_id($delete)) {
     $r = sql_query("SELECT id,torrent_id,ext,lang_id,title,filename,uppedby,anonymous FROM subs WHERE id=" . sqlesc($delete)) or sqlerr(__FILE__, __LINE__);
     if (mysql_num_rows($r) == 1) {
         $a = mysql_fetch_assoc($r);
         if (get_user_class() >= $submanage_class || $a["uppedby"] == $CURUSER["id"]) {
             $sure = $_GET["sure"];
             if ($sure == 1) {
                 $reason = $_POST["reason"];
                 sql_query("DELETE FROM subs WHERE id={$delete}") or sqlerr(__FILE__, __LINE__);
                 if (!unlink("{$SUBSPATH}/{$a['torrent_id']}/{$a['id']}.{$a['ext']}")) {
                     stdmsg($lang_subtitles['std_error'], $lang_subtitles['std_this_file'] . "{$a['filename']}" . $lang_subtitles['std_is_invalid']);
                     stdfoot();
                     die;
                 } else {
                     KPS("-", $uploadsubtitle_bonus, $a["uppedby"]);
                     //subtitle uploader loses bonus for deleted subtitle
                 }
                 if ($CURUSER['id'] != $a['uppedby']) {
                     $msg = $CURUSER['username'] . $lang_subtitles_target[get_user_lang($a['uppedby'])]['msg_deleted_your_sub'] . $a['title'] . ($reason != "" ? $lang_subtitles_target[get_user_lang($a['uppedby'])]['msg_reason_is'] . $reason : "");
                     $subject = $lang_subtitles_target[get_user_lang($a['uppedby'])]['msg_your_sub_deleted'];
                     $time = date("Y-m-d H:i:s");
                     sql_query("INSERT INTO messages (sender, receiver, added, msg, subject) VALUES(0, {$a['uppedby']}, '" . $time . "', " . sqlesc($msg) . ", " . sqlesc($subject) . ")") or sqlerr(__FILE__, __LINE__);
                 }
                 $res = sql_query("SELECT lang_name from language WHERE sub_lang=1 AND id = " . sqlesc($a["lang_id"])) or sqlerr(__FILE__, __LINE__);
                 $arr = mysql_fetch_assoc($res);
                 write_log("{$arr['lang_name']} Subtitle {$delete} ({$a['title']}) was deleted by " . ($a["anonymous"] == 'yes' && $a["uppedby"] == $CURUSER["id"] ? "Anonymous" : $CURUSER['username']) . ($a["uppedby"] != $CURUSER["id"] ? ", Mod Delete" : "") . ($reason != "" ? " (" . $reason . ")" : ""));
             } else {
                 stdmsg($lang_subtitles['std_delete_subtitle'], $lang_subtitles['std_delete_subtitle_note'] . "<br /><form method=post action=subtitles.php?delete={$delete}&sure=1>" . $lang_subtitles['text_reason_is'] . "<input type=text style=\"width: 200px\" name=reason><input type=submit value=\"" . $lang_subtitles['submit_confirm'] . "\"></form>");
                 stdfoot();
                 die;
开发者ID:CptTZ,项目名称:NexusPHP,代码行数:31,代码来源:subtitles.php

示例11: sql_query

        $Cache->delete_value('offer_' . $arr['pid'] . '_last_comment_content');
    }
    if ($parent_id && mysql_affected_rows() > 0) {
        if ($type == "torrent") {
            sql_query("UPDATE torrents SET comments = comments - 1 WHERE id = {$parent_id}") or sqlerr(__FILE__, __LINE__);
        } else {
            if ($type == "offer") {
                sql_query("UPDATE offers SET comments = comments - 1 WHERE id = {$parent_id}") or sqlerr(__FILE__, __LINE__);
            } else {
                if ($type == "request") {
                    sql_query("UPDATE req SET comments = comments - 1 WHERE id = {$parent_id}") or sqlerr(__FILE__, __LINE__);
                }
            }
        }
    }
    KPS("-", $addcomment_bonus, $userpostid);
    $returnto = $_GET["returnto"] ? $_GET["returnto"] : htmlspecialchars($_SERVER["HTTP_REFERER"]);
    header("Location: {$returnto}");
    die;
} elseif ($action == "vieworiginal") {
    if (get_user_class() < $commanage_class) {
        stderr($lang_comment['std_error'], $lang_comment['std_permission_denied']);
    }
    $commentid = 0 + $_GET["cid"];
    int_check($commentid, true);
    if ($type == "torrent") {
        $res = sql_query("SELECT c.*, t.name FROM comments AS c JOIN torrents AS t ON c.torrent = t.id WHERE c.id={$commentid}") or sqlerr(__FILE__, __LINE__);
    } else {
        if ($type == "offer") {
            $res = sql_query("SELECT c.*, o.name FROM comments AS c JOIN offers AS o ON c.offer = o.id WHERE c.id={$commentid}") or sqlerr(__FILE__, __LINE__);
        } else {
开发者ID:chenrizhi,项目名称:mtpt,代码行数:31,代码来源:comment.php

示例12: dbconn

<?php

require "include/bittorrent.php";
dbconn();
require_once get_langfile_path();
if ($enablead_advertisement != 'yes') {
    stderr($lang_adredir['std_error'], $lang_adredir['std_ad_system_disabled']);
}
$id = 0 + $_GET['id'];
if (!$id) {
    stderr($lang_adredir['std_error'], $lang_adredir['std_invalid_ad_id']);
}
$redir = htmlspecialchars_decode(urldecode($_GET['url']));
if (!$redir) {
    stderr($lang_adredir['std_error'], $lang_adredir['std_no_redirect_url']);
}
$adcount = get_row_count("advertisements", "WHERE id=" . sqlesc($id));
if (!$adcount) {
    stderr($lang_adredir['std_error'], $lang_adredir['std_invalid_ad_id']);
}
if ($adclickbonus_advertisement) {
    $clickcount = get_row_count("adclicks", "WHERE adid=" . sqlesc($id) . " AND userid=" . sqlesc($CURUSER['id']));
    if (!$clickcount) {
        KPS("+", $adclickbonus_advertisement, $CURUSER['id']);
    }
}
sql_query("INSERT INTO adclicks (adid, userid, added) VALUES (" . sqlesc($id) . ", " . sqlesc($CURUSER['id']) . ", " . sqlesc(date("Y-m-d H:i:s")) . ")");
header("Location: {$redir}");
开发者ID:CptTZ,项目名称:NexusPHP,代码行数:28,代码来源:adredir.php

示例13: docleanup

function docleanup($forceAll = 0, $printProgress = false)
{
    //require_once(get_langfile_path("cleanup.php",true));
    global $lang_cleanup_target;
    global $torrent_dir, $signup_timeout, $max_dead_torrent_time, $autoclean_interval_one, $autoclean_interval_two, $autoclean_interval_three, $autoclean_interval_four, $autoclean_interval_five, $SITENAME, $bonus, $invite_timeout, $offervotetimeout_main, $offeruptimeout_main, $iniupload_main;
    global $donortimes_bonus, $perseeding_bonus, $maxseeding_bonus, $tzero_bonus, $nzero_bonus, $bzero_bonus, $l_bonus;
    global $expirehalfleech_torrent, $expirefree_torrent, $expiretwoup_torrent, $expiretwoupfree_torrent, $expiretwouphalfleech_torrent, $expirethirtypercentleech_torrent, $expirenormal_torrent, $hotdays_torrent, $hotseeder_torrent, $halfleechbecome_torrent, $freebecome_torrent, $twoupbecome_torrent, $twoupfreebecome_torrent, $twouphalfleechbecome_torrent, $thirtypercentleechbecome_torrent, $normalbecome_torrent, $deldeadtorrent_torrent;
    global $neverdelete_account, $neverdeletepacked_account, $deletepacked_account, $deleteunpacked_account, $deletenotransfer_account, $deletenotransfertwo_account, $deletepeasant_account, $psdlone_account, $psratioone_account, $psdltwo_account, $psratiotwo_account, $psdlthree_account, $psratiothree_account, $psdlfour_account, $psratiofour_account, $psdlfive_account, $psratiofive_account, $putime_account, $pudl_account, $puprratio_account, $puderatio_account, $eutime_account, $eudl_account, $euprratio_account, $euderatio_account, $cutime_account, $cudl_account, $cuprratio_account, $cuderatio_account, $iutime_account, $iudl_account, $iuprratio_account, $iuderatio_account, $vutime_account, $vudl_account, $vuprratio_account, $vuderatio_account, $exutime_account, $exudl_account, $exuprratio_account, $exuderatio_account, $uutime_account, $uudl_account, $uuprratio_account, $uuderatio_account, $nmtime_account, $nmdl_account, $nmprratio_account, $nmderatio_account, $getInvitesByPromotion_class;
    global $enablenoad_advertisement, $noad_advertisement;
    global $Cache;
    global $memcache;
    set_time_limit(0);
    ignore_user_abort(1);
    $now = time();
    //Priority Class 1: cleanup every 15 mins
    //2.update peer status
    $deadtime = deadtime();
    $deadtime = date("Y-m-d H:i:s", $deadtime);
    sql_query("DELETE FROM peers WHERE last_action < " . sqlesc($deadtime)) or sqlerr(__FILE__, __LINE__);
    if ($printProgress) {
        printProgress('更新种子状态last_action');
    }
    //11.calculate seeding bonus
    $res = sql_query("SELECT DISTINCT userid FROM peers WHERE seeder = 'yes'") or sqlerr(__FILE__, __LINE__);
    if (mysql_num_rows($res) > 0) {
        $sqrtof2 = sqrt(2);
        $logofpointone = log(0.1);
        $valueone = $logofpointone / $tzero_bonus;
        $pi = 3.141592653589793;
        $valuetwo = $bzero_bonus * (2 / $pi);
        $valuethree = $logofpointone / ($nzero_bonus - 1);
        $timenow = TIMENOW;
        $sectoweek = 7 * 24 * 60 * 60;
        while ($arr = mysql_fetch_assoc($res)) {
            $A = 0;
            $count = 0;
            $all_bonus = 0;
            $torrentres = sql_query("select torrents.added, torrents.size, torrents.seeders from torrents LEFT JOIN peers ON peers.torrent = torrents.id WHERE peers.userid = {$arr['userid']} AND peers.seeder ='yes'") or sqlerr(__FILE__, __LINE__);
            while ($torrent = mysql_fetch_array($torrentres)) {
                $weeks_alive = ($timenow - strtotime($torrent['added'])) / $sectoweek;
                $gb_size = $torrent['size'] / 1073741824;
                $temp = (1 - exp($valueone * $weeks_alive)) * $gb_size * (1 + $sqrtof2 * exp($valuethree * ($torrent['seeders'] - 1)));
                $A += $temp;
                $count++;
            }
            if ($count > $maxseeding_bonus) {
                $count = $maxseeding_bonus;
            }
            $all_bonus = ($valuetwo * atan($A / $l_bonus) + $perseeding_bonus * $count) / (3600 / $autoclean_interval_one);
            $is_donor = get_single_value("users", "donor", "WHERE id=" . $arr['userid']);
            if ($is_donor == 'yes' && $donortimes_bonus > 0) {
                $all_bonus = $all_bonus * $donortimes_bonus;
            }
            KPS("+", $all_bonus, $arr["userid"]);
        }
    }
    if ($printProgress) {
        printProgress('为做种用户发放奖励');
    }
    //Priority Class 2: cleanup every 30 mins
    $res = sql_query("SELECT value_u FROM avps WHERE arg = 'lastcleantime2'");
    $row = mysql_fetch_array($res);
    if (!$row) {
        sql_query("INSERT INTO avps (arg, value_u) VALUES ('lastcleantime2'," . sqlesc($now) . ")") or sqlerr(__FILE__, __LINE__);
        return;
    }
    $ts = $row[0];
    if ($ts + $autoclean_interval_two > $now && !$forceAll) {
        return 'Cleanup ends at Priority Class 1';
    } else {
        sql_query("UPDATE avps SET value_u = " . sqlesc($now) . " WHERE arg='lastcleantime2'") or sqlerr(__FILE__, __LINE__);
    }
    //2.5.update torrents' visibility
    $deadtime = deadtime() - $max_dead_torrent_time;
    sql_query("UPDATE torrents SET visible='no' WHERE visible='yes' AND last_action < FROM_UNIXTIME({$deadtime}) AND seeders=0") or sqlerr(__FILE__, __LINE__);
    if ($printProgress) {
        printProgress("更新种子的可见状态");
    }
    //Priority Class 3: cleanup every 60 mins
    //自动清理过期短信
    if (time() > 1323069888 + 604800) {
        $deltime = date("Y-m-d H:i:s", time() - 2592000);
        //一个月前时间
        sql_query("DELETE FROM messages WHERE location='1' AND added < '" . $deltime . "'") or sqlerr(__FILE__, __LINE__);
    }
    if ($printProgress) {
        printProgress("清理过期短信");
    }
    //自动清理过期短信结束
    //将超过三天未登录用户重置salarynum
    $deltime = date("Y-m-d", time() - 86400 * 3);
    $res = sql_query("SELECT id FROM users WHERE  salarynum > 1 AND salary < '" . $deltime . "'") or sqlerr(__FILE__, __LINE__);
    while ($row = mysql_fetch_assoc($res)) {
        sql_query("UPDATE users SET salarynum = 1 WHERE id = {$row['id']}") or sqlerr(__FILE__, __LINE__);
        //write_log("系统qinglile yonghu salrty--- $row[id]",'normal');
    }
    if ($printProgress) {
        printProgress("将超过三天未登录用户重置salarynum");
    }
    //自动清理过期的回收站、候选区种子
//.........这里部分代码省略.........
开发者ID:chenrizhi,项目名称:mtpt,代码行数:101,代码来源:cleanup.php


注:本文中的KPS函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。