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


PHP get_single_value函数代码示例

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


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

示例1: get_id

function get_id($id_field, $field)
{
    $last_id = get_single_value($id_field, $field);
    if ($last_id) {
        return $last_id + 1;
    } else {
        return 1;
    }
}
开发者ID:shivabt,项目名称:canthonew,代码行数:9,代码来源:func.php

示例2: write_log

</td></tr></table>
<?php 
}
// Bonus exchange
if ($action == "exchange") {
    if ($_POST["userid"] || $_POST["points"] || $_POST["bonus"] || $_POST["art"]) {
        write_log("User " . $CURUSER["username"] . "," . $CURUSER["ip"] . " is trying to cheat at bonus system", 'mod');
        die($lang_mybonus['text_cheat_alert']);
    }
    $option = (int) $_POST["option"];
    $bonusarray = bonusarray($option);
    $points = $bonusarray['points'];
    $userid = $CURUSER['id'];
    $art = $bonusarray['art'];
    // Be sure the bonus data is newest
    $nowbonus = get_single_value("users", "seedbonus", "WHERE id = " . sqlesc($userid));
    $bonuscomment = $CURUSER['bonuscomment'];
    $seedbonus = $nowbonus - $points;
    if ($nowbonus >= $points) {
        //=== trade for upload
        if ($art == "traffic") {
            if ($CURUSER['uploaded'] > $dlamountlimit_bonus * 1073741824) {
                //uploaded amount reach limit
                $ratio = $CURUSER['uploaded'] / $CURUSER['downloaded'];
            } else {
                $ratio = 0;
            }
            if ($ratiolimit_bonus > 0 && $ratio > $ratiolimit_bonus) {
                die($lang_mybonus['text_cheat_alert']);
            } else {
                $upload = $CURUSER['uploaded'];
开发者ID:CptTZ,项目名称:NexusPHP-1,代码行数:31,代码来源:mybonus.php

示例3: number_format

<?php 
    $Cache->new_page('stats_torrents', 1800, true);
    if (!$Cache->get_page()) {
        $Cache->add_whole_row();
        $torrents = number_format(get_row_count("torrents"));
        $dead = number_format(get_row_count("torrents", "WHERE visible='no'"));
        $seeders = get_row_count("peers", "WHERE seeder='yes'");
        $leechers = get_row_count("peers", "WHERE seeder='no'");
        if ($leechers == 0) {
            $ratio = 0;
        } else {
            $ratio = round($seeders / $leechers * 100);
        }
        $activewebusernow = get_row_count("users", "WHERE last_access >= " . sqlesc(date("Y-m-d H:i:s", TIMENOW - 900)));
        $activewebusernow = number_format($activewebusernow);
        $activetrackerusernow = number_format(get_single_value("peers", "COUNT(DISTINCT(userid))"));
        $peers = number_format($seeders + $leechers);
        $seeders = number_format($seeders);
        $leechers = number_format($leechers);
        $totaltorrentssize = mksize(get_row_sum("torrents", "size"));
        $totaluploaded = get_row_sum("users", "uploaded");
        $totaldownloaded = get_row_sum("users", "downloaded");
        $totaldata = $totaldownloaded + $totaluploaded;
        ?>
<tr>
<?php 
        twotd($lang_index['row_torrents'], $torrents);
        twotd($lang_index['row_dead_torrents'], $dead);
        ?>
</tr>
<tr>
开发者ID:CptTZ,项目名称:NexusPHP,代码行数:31,代码来源:index.php

示例4: dbconn

<?php

require "include/bittorrent.php";
dbconn();
require_once get_langfile_path();
loggedinorreturn();
parked();
$id = $_GET["id"];
int_check($id, true);
stdhead($lang_viewsnatches['head_snatch_detail']);
begin_main_frame();
$torrent_name = get_single_value("torrents", "name", "WHERE id = " . sqlesc($id));
print "<h1 align=center>" . $lang_viewsnatches['text_snatch_detail_for'] . "<a href=details.php?id=" . htmlspecialchars($id) . "><b>" . htmlspecialchars($torrent_name) . "</b></a></h1>";
$count = get_row_count("snatched", "WHERE finished = 'yes' AND torrentid = " . sqlesc($id));
if ($count) {
    $perpage = 25;
    list($pagertop, $pagerbottom, $limit) = pager($perpage, $count, $_SERVER["SCRIPT_NAME"] . "?id=" . htmlspecialchars($id) . "&");
    print "<p align=center>" . $lang_viewsnatches['text_users_top_finished_recently'] . "</p>";
    print "<table border=1 cellspacing=0 cellpadding=5 align=center width=940>\n";
    print "<tr><td class=colhead align=center>" . $lang_viewsnatches['col_username'] . "</td>" . (get_user_class() >= $userprofile_class ? "<td class=colhead align=center>" . $lang_viewsnatches['col_ip'] . "</td>" : "") . "<td class=colhead align=center>" . $lang_viewsnatches['col_uploaded'] . "/" . $lang_viewsnatches['col_downloaded'] . "</td><td class=colhead align=center>" . $lang_viewsnatches['col_ratio'] . "</td><td class=colhead align=center>" . $lang_viewsnatches['col_se_time'] . "</td><td class=colhead align=center>" . $lang_viewsnatches['col_le_time'] . "</td><td class=colhead align=center>" . $lang_viewsnatches['col_when_completed'] . "</td><td class=colhead align=center>" . $lang_viewsnatches['col_last_action'] . "</td><td class=colhead align=center>" . $lang_viewsnatches['col_report_user'] . "</td></tr>";
    $res = sql_query("SELECT * FROM snatched WHERE finished='yes' AND torrentid =" . sqlesc($id) . " ORDER BY completedat DESC {$limit}");
    while ($arr = mysql_fetch_assoc($res)) {
        //start torrent
        if ($arr["downloaded"] > 0) {
            $ratio = number_format($arr["uploaded"] / $arr["downloaded"], 3);
            $ratio = "<font color=" . get_ratio_color($ratio) . ">{$ratio}</font>";
        } elseif ($arr["uploaded"] > 0) {
            $ratio = $lang_viewsnatches['text_inf'];
        } else {
            $ratio = "---";
        }
开发者ID:CptTZ,项目名称:NexusPHP-1,代码行数:31,代码来源:viewsnatches.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: sqlesc

            $updateset[] = "nfo = " . sqlesc(str_replace("\r\r\n", "\r\n", file_get_contents($nfofilename)));
        }
        $Cache->delete_value('nfo_block_torrent_id_' . $id);
    } elseif ($nfoaction == "remove") {
        $updateset[] = "nfo = ''";
        $Cache->delete_value('nfo_block_torrent_id_' . $id);
    }
}
$catid = 0 + $type;
if (!is_valid_id($catid)) {
    bark($lang_takeedit['std_missing_form_data']);
}
if (!$name || !$descr) {
    bark($lang_takeedit['std_missing_form_data']);
}
$newcatmode = get_single_value("categories", "mode", "WHERE id=" . sqlesc($catid));
if ($enablespecial == 'yes' && get_user_class() >= $movetorrent_class) {
    $allowmove = true;
} else {
    $allowmove = false;
}
if ($oldcatmode != $newcatmode && !$allowmove) {
    bark($lang_takeedit['std_cannot_move_torrent']);
}
$updateset[] = "anonymous = '" . ($_POST["anonymous"] ? "yes" : "no") . "'";
$updateset[] = "name = " . sqlesc($name);
$updateset[] = "descr = " . sqlesc($descr);
$updateset[] = "url = " . sqlesc($url);
$updateset[] = "douban_url = " . sqlesc($douban_url);
$updateset[] = "small_descr = " . sqlesc($_POST["small_descr"]);
//$updateset[] = "ori_descr = " . sqlesc($descr);
开发者ID:CptTZ,项目名称:NexusPHP-1,代码行数:31,代码来源:takeedit.php

示例7: insert_compose_frame

function insert_compose_frame($id, $type = 'new')
{
	global $maxsubjectlength, $CURUSER;
	global $lang_forums;
	$hassubject = false;
	$subject = "";
	$body = "";
	print("<form id=\"compose\" method=\"post\" name=\"compose\" action=\"?action=post\">\n");
	switch ($type){
		case 'new':
		{
			$forumname = get_single_value("forums","name","WHERE id=".sqlesc($id));
			$title = $lang_forums['text_new_topic_in']." <a href=\"".htmlspecialchars("?action=viewforum&forumid=".$id)."\">".htmlspecialchars($forumname)."</a> ".$lang_forums['text_forum'];
			$hassubject = true;
			if($id == 5)$subject = "【悬赏***麦粒】【求*****】";
			break;
		}
		case 'reply':
		{
			$topicname = get_single_value("topics","subject","WHERE id=".sqlesc($id));
			$title = $lang_forums['text_reply_to_topic']." <a href=\"".htmlspecialchars("?action=viewtopic&topicid=".$id)."\">".htmlspecialchars($topicname)."</a> ";
			break;
		}
		case 'quote':
		{
			$topicid=get_single_value("posts","topicid","WHERE id=".sqlesc($id));
			$topicname = get_single_value("topics","subject","WHERE id=".sqlesc($topicid));
			$title = $lang_forums['text_reply_to_topic']." <a href=\"".htmlspecialchars("?action=viewtopic&topicid=".$topicid)."\">".htmlspecialchars($topicname)."</a> ";
			$res = sql_query("SELECT posts.body, users.username FROM posts LEFT JOIN users ON posts.userid = users.id WHERE posts.id=$id") or sqlerr(__FILE__, __LINE__);
			if (mysql_num_rows($res) != 1)
				stderr($lang_forums['std_error'], $lang_forums['std_no_post_id']);
			$arr = mysql_fetch_assoc($res);
			$arr["body"] = preg_replace('/\[(@)([^\]]*?)\]/','[b]@$2[/b]',$arr["body"]);
			$body = "[quote=".htmlspecialchars($arr["username"])."]".htmlspecialchars(unesc($arr["body"]))."[/quote]";
			$id = $topicid;
			$type = 'quote';
			break;
		}
		case 'edit':
		{
			$res = sql_query("SELECT topicid, body FROM posts WHERE id=".sqlesc($id)." LIMIT 1") or sqlerr(__FILE__, __LINE__);
			$row = mysql_fetch_array($res);
			$topicid=$row['topicid'];
			$firstpost = get_single_value("posts","MIN(id)", "WHERE topicid=".sqlesc($topicid));
			if ($firstpost == $id){
				$subject = get_single_value("topics","subject","WHERE id=".sqlesc($topicid));
				$onlyauthor = get_single_value("topics","onlyauthor","WHERE id=".sqlesc($topicid));
				$hassubject = true;
			}
			$body = htmlspecialchars(unesc($row["body"]));
			$title = $lang_forums['text_edit_post'];
			break;
		}
		default:
		{
			die;
		}
	}
	print("<input type=\"hidden\" name=\"id\" value=\"".$id."\" />");
	print("<input type=\"hidden\" name=\"type\" value=\"".$type."\" />");
	begin_compose($title, $type, $body, $hassubject, $subject,$maxsubjectlength, $onlyauthor);
	end_compose();
	print("</form>");
}
开发者ID:NullYing,项目名称:mtpt,代码行数:64,代码来源:forums.php

示例8: get_view_count

function get_view_count($tab, $start_dt, $end_dt, $app_id)
{
    if ($start_dt == '') {
        $start_dt = date("Y-m-d H:i:s");
    }
    if ($end_dt == '') {
        $end_dt = date("Y-m-d H:i:s");
    }
    $app_views = get_single_value($tab, "sum(views)", "DATE_FORMAT(dateupdated,'%Y-%m-%d')>='{$start_dt}' AND \r\n\tDATE_FORMAT(dateupdated,'%Y-%m-%d')<='{$end_dt}' AND app_id={$app_id}");
    if ($app_views == '') {
        $app_views = 0;
    }
    return $app_views;
}
开发者ID:Wings1986,项目名称:SMBeacon-IOS-Web,代码行数:14,代码来源:function.php

示例9: get_css_uri

function get_css_uri($file = "")
{
    $cssRow = get_css_row();
    $ss_uri = $cssRow['uri'];
    if (!$ss_uri) {
        $ss_uri = get_single_value("stylesheets", "uri", "WHERE id=" . sqlesc($defcss));
    }
    if ($file == "") {
        return $ss_uri;
    } else {
        return $ss_uri . $file;
    }
}
开发者ID:skygunner,项目名称:ekucms,代码行数:13,代码来源:functions.php

示例10: date

     } else {
         $warneduntil = date("Y-m-d H:i:s", strtotime(date("Y-m-d H:i:s")) + $warnlength * 604800);
         $dur = $warnlength . $lang_modtask_target[get_user_lang($userid)]['msg_week'] . ($warnlength > 1 ? $lang_modtask_target[get_user_lang($userid)]['msg_s'] : "");
         $msg = sqlesc($lang_modtask_target[get_user_lang($userid)]['msg_you_are_warned_for'] . $dur . $lang_modtask_target[get_user_lang($userid)]['msg_by'] . $CURUSER['username'] . "." . ($warnpm ? $lang_modtask_target[get_user_lang($userid)]['msg_reason'] . $warnpm : ""));
         $modcomment = date("Y-m-d") . " - Warned for {$dur} by " . $CURUSER['username'] . ".\nReason: {$warnpm}.\n" . $modcomment;
         $updateset[] = "warneduntil = '{$warneduntil}'";
     }
     $subject = sqlesc($lang_modtask_target[get_user_lang($userid)]['msg_you_are_warned']);
     $added = sqlesc(date("Y-m-d H:i:s"));
     sql_query("INSERT INTO messages (sender, receiver, subject, msg, added) VALUES (0, {$userid}, {$subject}, {$msg}, {$added})") or sqlerr(__FILE__, __LINE__);
     $updateset[] = "warned = 'yes', timeswarned = timeswarned+1, lastwarned={$added}, warnedby={$CURUSER['id']}";
 }
 if ($enabled != $curenabled) {
     if ($enabled == 'yes') {
         $modcomment = date("Y-m-d") . " - Enabled by " . $CURUSER['username'] . ".\n" . $modcomment;
         if (get_single_value("users", "class", "WHERE id = " . sqlesc($userid)) == UC_PEASANT) {
             $length = 30 * 86400;
             // warn users until 30 days
             $until = sqlesc(date("Y-m-d H:i:s", strtotime(date("Y-m-d H:i:s")) + $length));
             sql_query("UPDATE users SET enabled='yes', leechwarn='yes', leechwarnuntil={$until} WHERE id = " . sqlesc($userid));
         } else {
             sql_query("UPDATE users SET enabled='yes', leechwarn='no' WHERE id = " . sqlesc($userid)) or sqlerr(__FILE__, __LINE__);
         }
     } else {
         $modcomment = date("Y-m-d") . " - Disabled by " . $CURUSER['username'] . ".\n" . $modcomment;
     }
 }
 if ($arr['noad'] != $noad) {
     $updateset[] = 'noad = ' . sqlesc($noad);
     $modcomment = date("Y-m-d") . " - No Ad set to " . $noad . " by " . $CURUSER['username'] . ".\n" . $modcomment;
 }
开发者ID:CptTZ,项目名称:NexusPHP,代码行数:31,代码来源:modtask.php

示例11: dltable

 function dltable($name, $arr, $torrent)
 {
     global $lang_viewpeerlist, $viewanonymous_class, $userprofile_class, $enablelocation_tweak;
     global $CURUSER;
     $s = "<b>" . count($arr) . " {$name}</b>\n";
     if (!count($arr)) {
         return $s;
     }
     $s .= "\n";
     $s .= "<table width=825 class=main border=1 cellspacing=0 cellpadding=3>\n";
     $s .= "<tr><td class=colhead align=center width=1%>" . $lang_viewpeerlist['col_user_ip'] . "</td>" . ($enablelocation_tweak == 'yes' || get_user_class() >= $userprofile_class ? "<td class=colhead align=center width=1%>" . $lang_viewpeerlist['col_location'] . "</td>" : "") . "<td class=colhead align=center width=1%>" . $lang_viewpeerlist['col_connectable'] . "</td>" . "<td class=colhead align=center width=1%>" . $lang_viewpeerlist['col_uploaded'] . "</td>" . "<td class=colhead align=center width=1%>" . $lang_viewpeerlist['col_rate'] . "</td>" . "<td class=colhead align=center width=1%>" . $lang_viewpeerlist['col_downloaded'] . "</td>" . "<td class=colhead align=center width=1%>" . $lang_viewpeerlist['col_rate'] . "</td>" . "<td class=colhead align=center width=1%>" . $lang_viewpeerlist['col_ratio'] . "</td>" . "<td class=colhead align=center width=1%>" . $lang_viewpeerlist['col_complete'] . "</td>" . "<td class=colhead align=center width=1%>" . $lang_viewpeerlist['col_connected'] . "</td>" . "<td class=colhead align=center width=1%>" . $lang_viewpeerlist['col_idle'] . "</td>" . "<td class=colhead align=center width=1%>" . $lang_viewpeerlist['col_client'] . "</td></tr>\n";
     $now = time();
     foreach ($arr as $e) {
         $privacy = get_single_value("users", "privacy", "WHERE id=" . sqlesc($e['userid']));
         ++$num;
         $highlight = $CURUSER["id"] == $e['userid'] ? " bgcolor=#BBAF9B" : "";
         $s .= "<tr{$highlight}>\n";
         if ($privacy == "strong" || $torrent['anonymous'] == 'yes' && $e['userid'] == $torrent['owner']) {
             if (get_user_class() >= $viewanonymous_class || $e['userid'] == $CURUSER['id']) {
                 $s .= "<td class=rowfollow align=left width=1%><i>" . $lang_viewpeerlist['text_anonymous'] . "</i><br />(" . get_username($e['userid']) . ")";
             } else {
                 $s .= "<td class=rowfollow align=left width=1%><i>" . $lang_viewpeerlist['text_anonymous'] . "</i></a></td>\n";
             }
         } else {
             $s .= "<td class=rowfollow align=left width=1%>" . get_username($e['userid']);
         }
         $secs = max(1, $e["la"] - $e["st"]);
         if ($enablelocation_tweak == 'yes') {
             list($loc_pub, $loc_mod) = get_ip_location($e["ip"]);
             $location = get_user_class() >= $userprofile_class ? "<div title='" . $loc_mod . "'>" . $loc_pub . "</div>" : $loc_pub;
             $s .= "<td class=rowfollow align=center width=1%><nobr>" . $location . "</nobr></td>\n";
         } elseif (get_user_class() >= $userprofile_class) {
             $location = $e["ip"];
             $s .= "<td class=rowfollow align=center width=1%><nobr>" . $location . "</nobr></td>\n";
         } else {
             $location = "";
         }
         $s .= "<td class=rowfollow align=center width=1%><nobr>" . ($e[connectable] == "yes" ? $lang_viewpeerlist['text_yes'] : "<font color=red>" . $lang_viewpeerlist['text_no'] . "</font>") . "</nobr></td>\n";
         $s .= "<td class=rowfollow align=center width=1%><nobr>" . mksize($e["uploaded"]) . "</nobr></td>\n";
         $s .= "<td class=rowfollow align=center width=1%><nobr>" . mksize(($e["uploaded"] - $e["uploadoffset"]) / $secs) . "/s</nobr></td>\n";
         $s .= "<td class=rowfollow align=center width=1%><nobr>" . mksize($e["downloaded"]) . "</nobr></td>\n";
         if ($e["seeder"] == "no") {
             $s .= "<td class=rowfollow align=center width=1%><nobr>" . mksize(($e["downloaded"] - $e["downloadoffset"]) / $secs) . "/s</nobr></td>\n";
         } else {
             $s .= "<td class=rowfollow align=center width=1%><nobr>" . mksize(($e["downloaded"] - $e["downloadoffset"]) / max(1, $e["finishedat"] - $e[st])) . "/s</nobr></td>\n";
         }
         if ($e["downloaded"]) {
             $ratio = floor($e["uploaded"] / $e["downloaded"] * 1000) / 1000;
             $s .= "<td class=rowfollow align=\"center\" width=1%><font color=" . get_ratio_color($ratio) . "><nobr>" . number_format($ratio, 3) . "</nobr></font></td>\n";
         } elseif ($e["uploaded"]) {
             $s .= "<td class=rowfollow align=center width=1%>" . $lang_viewpeerlist['text_inf'] . "</td>\n";
         } else {
             $s .= "<td class=rowfollow align=center width=1%>---</td>\n";
         }
         $s .= "<td class=rowfollow align=center width=1%><nobr>" . sprintf("%.2f%%", 100 * (1 - $e["to_go"] / $torrent["size"])) . "</nobr></td>\n";
         $s .= "<td class=rowfollow align=center width=1%><nobr>" . mkprettytime($now - $e["st"]) . "</nobr></td>\n";
         $s .= "<td class=rowfollow align=center width=1%><nobr>" . mkprettytime($now - $e["la"]) . "</nobr></td>\n";
         $s .= "<td class=rowfollow align=center width=1%><nobr>" . htmlspecialchars(get_agent($e["peer_id"], $e["agent"])) . "</nobr></td>\n";
         $s .= "</tr>\n";
     }
     $s .= "</table>\n";
     return $s;
 }
开发者ID:CptTZ,项目名称:NexusPHP,代码行数:63,代码来源:viewpeerlist.php

示例12: 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

示例13: get_pageing_new

include "sendmail.php";
include "tablename.php";
include "message.php";
include_once 'imageTransform.php';
//................Paging file..............
include "newpaging.php";
$prs_pageing = new get_pageing_new();
include "newpaging_front.php";
$prs_pageing1 = new get_pageing_new1();
include "cmspaging.php";
$cms_pageing = new get_pageing_cms();
include "ajaxpaging.php";
$ajax_pageing = new get_pageing_ajax();
$session_id = session_id();
$adminsetting = array();
$adminmail = get_single_value(ADMIN, 'email', '1=1');
//$admintwitter=get_single_value (ADMIN,'twitter_acc','1=1');
//$adminfacebook=get_single_value (ADMIN,'facebook_acc','1=1');
//$adminsetting=single_row(ADMIN_SETTING,'*','1=1');
//$blog_url=get_single_value(ADMIN_SETTING,'blog_url','1=1');
//$paypal_acc=get_single_value (ADMIN,'paypal_acc','1=1');
//$def_currency = get_single_value (CURRENCY,'symbol','def = 1');
$cur_page_arr = split("/", $_SERVER['PHP_SELF']);
$cur_page = $cur_page_arr[count($cur_page_arr) - 1];
if ($cur_page == "login.php" || $cur_page == "signup.php") {
} else {
    $_SESSION["page"] = $cur_page;
}
//............search for the menu number [start].............
if (count($menu) > 0) {
    foreach ($menu as $k => $v) {
开发者ID:Wings1986,项目名称:SMBeacon-IOS-Web,代码行数:31,代码来源:connect.php

示例14: sql_query

     //			$res = sql_query("SELECT id, user, torrent, offer, request FROM comments WHERE id=".sqlesc($row['reportid']));
     $res = sql_query("SELECT id, user, torrent, offer, request FROM comments WHERE id=" . sqlesc($row['reportid']));
     if (mysql_num_rows($res) == 0) {
         $reporting = $lang_reports['text_comment_does_not_exist'];
     } else {
         $arr = mysql_fetch_array($res);
         if ($arr['torrent']) {
             $name = get_single_value("torrents", "name", "WHERE id=" . sqlesc($arr['torrent']));
             $url = "details.php?id=" . $arr['torrent'] . "#cid" . $row['reportid'];
             $of = $lang_reports['text_of_torrent'];
         } elseif ($arr['offer']) {
             $name = get_single_value("offers", "name", "WHERE id=" . sqlesc($arr['offer']));
             $url = "offers.php?id=" . $arr['offer'] . "&off_details=1#cid" . $row['reportid'];
             $of = $lang_reports['text_of_offer'];
         } elseif ($arr['request']) {
             $name = get_single_value("req", "name", "WHERE id=" . sqlesc($arr['request']));
             $url = "viewrequest.php?action=view&id=" . $arr['request'] . "&req_details=1#cid" . $row['reportid'];
             $of = $lang_reports['text_of_request'];
         } else {
             //Comment belongs to no one
             $of = "unknown";
         }
         $reporting = $lang_reports['text_comment_id'] . $row['reportid'] . $of . "<b><a href=\"" . $url . "\">" . htmlspecialchars($name) . "</a></b>" . $lang_reports['text_by'] . get_username($arr['user']);
         $reported = $arr['user'];
     }
     break;
 case "subtitle":
     $type = $lang_reports['text_subtitle'];
     $res = sql_query("SELECT id, torrent_id, title FROM subs WHERE id=" . sqlesc($row['reportid']));
     if (mysql_num_rows($res) == 0) {
         $reporting = $lang_reports['text_subtitle_does_not_exist'];
开发者ID:chenrizhi,项目名称:mtpt,代码行数:31,代码来源:reports.php

示例15: insert_compose_frame

function insert_compose_frame($id, $type = 'new')
{
    global $maxsubjectlength, $CURUSER;
    global $lang_forums;
    $hassubject = false;
    $hasmodechoose = false;
    $subject = "";
    $body = "";
    print "<form id=\"compose\" method=\"post\" name=\"compose\" action=\"?action=post\">\n";
    switch ($type) {
        case 'new':
            $forumname = get_single_value("forums", "name", "WHERE id=" . sqlesc($id));
            $forummode = get_single_value("forums", "casinomode", "WHERE id=" . sqlesc($id));
            $forummodeclass = get_single_value("forums", "casinoclass", "WHERE id=" . sqlesc($id));
            $title = $lang_forums['text_new_topic_in'] . " <a href=\"" . htmlspecialchars("?action=viewforum&forumid=" . $id) . "\">" . htmlspecialchars($forumname) . "</a> " . $lang_forums['text_forum'];
            $hassubject = true;
            if ($forummode && (get_user_class() >= $forummodeclass || is_forum_moderator($id, 'forum'))) {
                $hasmodechoose = true;
            }
            break;
        case 'reply':
            $topicname = get_single_value("topics", "subject", "WHERE id=" . sqlesc($id));
            $title = $lang_forums['text_reply_to_topic'] . " <a href=\"" . htmlspecialchars("?action=viewtopic&topicid=" . $id) . "\">" . htmlspecialchars($topicname) . "</a> ";
            break;
        case 'quote':
            $topicid = get_single_value("posts", "topicid", "WHERE id=" . sqlesc($id));
            $topicmode = get_single_value("topics", "casinomode", "WHERE id=" . sqlesc($topicid)) == "yes";
            $topicname = get_single_value("topics", "subject", "WHERE id=" . sqlesc($topicid));
            $title = $lang_forums['text_reply_to_topic'] . " <a href=\"" . htmlspecialchars("?action=viewtopic&topicid=" . $topicid) . "\">" . htmlspecialchars($topicname) . "</a> ";
            $res = sql_query("SELECT posts.body, users.username FROM posts LEFT JOIN users ON posts.userid = users.id WHERE posts.id={$id}") or sqlerr(__FILE__, __LINE__);
            if (mysql_num_rows($res) != 1) {
                stderr($lang_forums['std_error'], $lang_forums['std_no_post_id']);
            }
            $arr = mysql_fetch_assoc($res);
            if (!$topicmode) {
                $body = "[quote=" . htmlspecialchars($arr["username"]) . "]" . htmlspecialchars(unesc($arr["body"])) . "[/quote]";
            } else {
                $body = "[quote=" . htmlspecialchars($arr["username"]) . "]" . "[/quote]";
            }
            $id = $topicid;
            $type = 'reply';
            break;
        case 'edit':
            $res = sql_query("SELECT topicid, body FROM posts WHERE id=" . sqlesc($id) . " LIMIT 1") or sqlerr(__FILE__, __LINE__);
            $row = mysql_fetch_array($res);
            $topicid = $row['topicid'];
            $firstpost = get_single_value("posts", "MIN(id)", "WHERE topicid=" . sqlesc($topicid));
            if ($firstpost == $id) {
                $subject = get_single_value("topics", "subject", "WHERE id=" . sqlesc($topicid));
                $hassubject = true;
                $forumid = get_single_value("topics", "forumid", "WHERE id=" . sqlesc($topicid));
                $forummode = get_single_value("forums", "casinomode", "WHERE id=" . sqlesc($forumid));
                $forummodeclass = get_single_value("forums", "casinoclass", "WHERE id=" . sqlesc($forumid));
                if ($forummode && (get_user_class() >= $forummodeclass || is_forum_moderator($forumid, 'forum'))) {
                    $hasmodechoose = true;
                }
            }
            $body = htmlspecialchars(unesc($row["body"]));
            $title = $lang_forums['text_edit_post'];
            break;
        default:
            die;
    }
    print "<input type=\"hidden\" name=\"id\" value=\"" . $id . "\" />";
    print "<input type=\"hidden\" name=\"type\" value=\"" . $type . "\" />";
    begin_compose($title, $type, $body, $hassubject, $subject, 100, $hasmodechoose);
    end_compose();
    print "</form>";
}
开发者ID:CptTZ,项目名称:NexusPHP-1,代码行数:69,代码来源:forums.php


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