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


PHP makesize函数代码示例

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


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

示例1: _torrenttable

function _torrenttable($rt, $frame_caption, $speed = false)
{
    global $STYLEPATH, $extratpl, $language;
    $torrent = array();
    $num = 0;
    foreach ($rt as $id => $a) {
        $num++;
        if ($a["leechers"] > 0) {
            $r = $a["seeds"] / $a["leechers"];
            $ratio = number_format($r, 2);
        } else {
            $ratio = $language["INFINITE"];
        }
        $torrent[$num - 1]["rank"] = $num;
        if ($GLOBALS["usepopup"]) {
            $torrent[$num - 1]["filename"] = "<a href=\"javascript:popdetails('index.php?page=details&amp;id=" . $a['hash'] . "');\">" . unesc($a["name"]) . "</a>";
        } else {
            $torrent[$num - 1]["filename"] = "<a href=\"index.php?page=details&amp;id=" . $a['hash'] . "\">" . unesc($a["name"]) . "</a>";
        }
        $torrent[$num - 1]["complete"] = number_format($a["finished"]);
        $torrent[$num - 1]["seeds"] = number_format($a["seeds"]);
        $torrent[$num - 1]["leechers"] = number_format($a["leechers"]);
        $torrent[$num - 1]["peers"] = number_format($a["leechers"] + $a["seeds"]);
        $torrent[$num - 1]["ratio"] = $ratio;
        if ($speed) {
            $torrent[$num - 1]["speed"] = makesize($a["speed"]);
        }
    }
    $extratpl->set("language", $language);
    $extratpl->set("torrent", $torrent);
    $extratpl->set("DISPLAY_SPEED", $speed, true);
    $extratpl->set("DISPLAY_SPEED1", $speed, true);
    return set_block($frame_caption, "center", $extratpl->fetch(load_template("extra-stats.torrent.tpl")));
}
开发者ID:wilian32,项目名称:xbtit,代码行数:34,代码来源:extra-stats.php

示例2: report

function report($id, $name, $down, $up, $rank, $first, $last)
{
    global $CURUSER, $language;
    if ($down > 0) {
        $ratio = substr($up / $down, 0, 5);
    } else {
        $ratio = '&#8734;';
    }
    if ($down > $up) {
        $diff = "<b><font color=red>&#8595&nbsp;" . makesize($down - $up) . "</font></b>";
    } elseif ($up > $down) {
        $diff = "<b><font color=blue>&#8593&nbsp;" . makesize($up - $down) . "</font></b>";
    } else {
        $diff = "<b><font color=Cyan>0</font></b>";
    }
    $return = array();
    $return["id"] = $id;
    $return["username"] = "<a href=\"index.php?page=userdetails&amp;id=" . $id . "\">{$name}</a>";
    $return["down"] = makesize($down) . "</b></font></td>";
    $return["up"] = makesize($up) . "</b></font></td>";
    $return["ratio"] = $ratio . "</b></td>";
    $return["rank"] = $rank . "</b></td>";
    $return["diff"] = $diff . "</b></td>";
    $return["first"] = date("d/m/Y H:i:s", $first) . "</b></td>";
    $return["last"] = date("d/m/Y H:i:s", $last) . "</b></td>";
    $return["edit"] = "<a href=\"index.php?page=admin&amp;user=" . $CURUSER["uid"] . "&amp;code=" . $CURUSER["random"] . "&amp;do=users&amp;action=edit&amp;uid={$id}&amp;returnto=admincp.php?user=" . $CURUSER["uid"] . "&amp;code=" . $CURUSER["random"] . "&amp;do=searchdiff\">" . $language["EDIT"] . "</a>";
    $return["delete"] = "<a href=\"index.php?page=admin&amp;user=" . $CURUSER["uid"] . "&amp;code=" . $CURUSER["random"] . "&amp;do=users&amp;action=delete&amp;uid={$id}&amp;returnto=admincp.php?user=" . $CURUSER["uid"] . "&amp;code=" . $CURUSER["random"] . "&amp;do=searchdiff\">" . $language["DELETE"] . "</a>";
    return $return;
}
开发者ID:r4kib,项目名称:cyberfun-xbtit,代码行数:29,代码来源:admin.search_diff.php

示例3: unset

$numtorrent = $ruploaded[0];
unset($ruploaded);
if ($numtorrent > 0) {
    list($pagertop, $pagerbottom, $limit) = pager($utorrents == 0 ? 15 : $utorrents, $numtorrent, "index.php?page=usercp&amp;uid={$uid}&amp;");
    $usercptpl->set("pagertop", $pagertop);
    $resuploaded = do_sqlquery("SELECT f.filename, UNIX_TIMESTAMP(f.data) as added, f.size, {$tseeds} as seeds, {$tleechs} as leechers, {$tcompletes} as finished, f.info_hash as hash FROM {$ttables} WHERE uploader={$uid} ORDER BY data DESC {$limit}", true);
}
if ($resuploaded && mysql_num_rows($resuploaded) > 0) {
    include "include/offset.php";
    $usercptpl->set("RESULTS", true, true);
    $uptortpl = array();
    $i = 0;
    while ($rest = mysql_fetch_assoc($resuploaded)) {
        $uptortpl[$i]["filename"] = cut_string(unesc($rest["filename"]), intval($btit_settings["cut_name"]));
        $uptortpl[$i]["added"] = date("d/m/Y", $rest["added"] - $offset);
        $uptortpl[$i]["size"] = makesize($rest["size"]);
        $uptortpl[$i]["seedcolor"] = linkcolor($rest["seeds"]);
        $uptortpl[$i]["seeds"] = $rest[seeds];
        $uptortpl[$i]["leechcolor"] = linkcolor($rest["leechers"]);
        $uptortpl[$i]["leechers"] = $rest[leechers];
        $uptortpl[$i]["completed"] = $rest["finished"] > 0 ? $rest["finished"] : "---";
        $uptortpl[$i]["editlink"] = "index.php?page=edit&amp;info_hash=" . $rest["hash"] . "&amp;returnto=" . urlencode("index.php?page=torrents") . "";
        $uptortpl[$i]["dellink"] = "index.php?page=delete&amp;info_hash=" . $rest["hash"] . "&amp;returnto=" . urlencode("index.php?page=torrents") . "";
        $uptortpl[$i]["editimg"] = image_or_link("{$STYLEPATH}/images/edit.png", "", $language["EDIT"]);
        $uptortpl[$i]["delimg"] = image_or_link("{$STYLEPATH}/images/delete.png", "", $language["DELETE"]);
        $i++;
    }
    $usercptpl->set("uptor", $uptortpl);
} else {
    $usercptpl->set("RESULTS", false, true);
    $usercptpl->set("pagertop", "");
开发者ID:wilian32,项目名称:xbtit,代码行数:31,代码来源:usercp.main.php

示例4: die

//
////////////////////////////////////////////////////////////////////////////////////
if (!defined("IN_BTIT")) {
    die("non direct access!");
}
// load language file
require load_language("lang_lottery.php");
function get_value($what, $table, $area, $id)
{
    global $TABLE_PREFIX;
    $query = do_sqlquery("SELECT {$what} FROM {$TABLE_PREFIX}{$table} WHERE {$area}={$id}", true);
    $object_to_array = mysql_fetch_array($query) or sql_err(__FILE__, __LINE__);
    return $object_to_array[$what];
}
$query = do_sqlquery("SELECT * FROM `{$TABLE_PREFIX}lottery_winners`", true);
$ticketstpl = new bTemplate();
$ticketstpl->set("language", $language);
if (mysql_num_rows($query) == 0) {
    $ticketstpl->set("are_winners", false, true);
} else {
    $ticketstpl->set("are_winners", true, true);
    $won = array();
    $x = 0;
    while ($users = mysql_fetch_assoc($query)) {
        $won[$x]["winner"] = $users["win_user"];
        $won[$x]["date"] = $users["windate"];
        $won[$x]["price"] = makesize($users["price"]);
        $x++;
        $ticketstpl->set("winner", $won);
    }
}
开发者ID:wilian32,项目名称:xbtit,代码行数:31,代码来源:data-file.view_winners.php

示例5: err_msg

}
if ($now >= $expire || $enabled != 'yes') {
    err_msg($language["ERROR"], $language["CANNOT_SELL_CLOSED"]);
    stdfoot();
    die;
}
if ($_POST['number'] > $purchaseable || $_POST['number'] < 1) {
    err_msg($language["ERROR"], $language["LOTT_LIMIT_PURCHASE"] . " " . $purchaseable);
    stdfoot();
    die;
}
if ($_POST['number'] + $user_tickets > $limit_buy) {
    err_msg($language["ERROR"], $language["LOTT_LIMIT_BUY"] . " " . $limit_buy);
    stdfoot();
    die;
}
$upload = $result["uploaded"] - $minupload * $_POST['number'];
do_sqlquery("UPDATE `{$TABLE_PREFIX}users` SET `uploaded`=" . $upload . " WHERE `id`=" . $CURUSER['uid'] . "", true);
$tickets = $_POST['number'];
for ($i = 0; $i < $tickets; $i++) {
    do_sqlquery("INSERT INTO {$TABLE_PREFIX}lottery_tickets(user) VALUES(" . $CURUSER['uid'] . ")", true);
}
$me = mysqli_num_rows(do_sqlquery("SELECT * FROM `{$TABLE_PREFIX}lottery_tickets` WHERE user=" . $CURUSER['uid'] . "", true));
// load language file
require load_language("lang_lottery.php");
$ticketstpl = new bTemplate();
$ticketstpl->set("language", $language);
$ticketstpl->set("nr_tickets", $tickets);
$ticketstpl->set("total_tickets", $me);
$ticketstpl->set("new_upload", makesize($upload));
header("Refresh: 5; URL=index.php?page=lottery_tickets");
开发者ID:Karpec,项目名称:gizd,代码行数:31,代码来源:lottery.purchase.php

示例6: die

    die("non direct access!");
}
require_once "include/functions.php";
require_once "include/config.php";
dbconn();
global $CURUSER;
if (!$CURUSER || $CURUSER["view_torrents"] == "no") {
    // do nothing
} else {
    if ($btit_settings["req_onoff"] == true) {
        $maxallowed = $btit_settings["req_max"];
        $res3 = mysql_query("SELECT * FROM {$TABLE_PREFIX}requests as reqcount WHERE userid={$CURUSER['uid']}") or mysql_error();
        $arr3 = mysql_num_rows($res3);
        $numreqs = $arr3;
        $reqrem = $maxallowed - $numreqs;
        $reward = makesize($btit_settings["req_mb"]);
        $viewrequeststpl = new bTemplate();
        $viewrequeststpl->set("language", $language);
        if ($btit_settings["req_maxon"] == true) {
            $viewrequeststpl->set("vr0", "<br><div align=center ><font color=steelblue>Available Requests for <b>{$CURUSER['username']}: {$maxallowed}</b> | Posted Requests: <b>{$arr3}</b> | Remaining: <b>{$reqrem}</b></font></div><br>");
        }
        if ($btit_settings["req_rwon"] == true) {
            if ($btit_settings["req_sbmb"] == true) {
                $viewrequeststpl->set("vr01", "<br><div align=center ><font color=steelblue>If you furfill a request , you will recieve <b>{$reward}</b></font></div><br>");
                //mysql_query("UPDATE {$TABLE_PREFIX}users SET uploaded = uploaded + $btit_settings[req_mb]  WHERE id=$CURUSER[uid]");
            }
            if ($btit_settings["req_sbmb"] == false) {
                $viewrequeststpl->set("vr01", "<br><div align=center ><font color=steelblue>If you furfill a request , you will recieve <b>{$btit_settings['req_sb']}</b> seedbonus points</font></div><br>");
                //mysql_query("UPDATE {$TABLE_PREFIX}users SET seedbonus = seedbonus + $btit_settings[req_sb] WHERE id=$CURUSER[uid]");
            }
        }
开发者ID:r4kib,项目名称:cyberfun-xbtit,代码行数:31,代码来源:viewrequests.php

示例7: outputTree

function outputTree($files, $indent = 1)
{
    //echo "<table style=\"font-size: 7pt; width: 100%;\"";
    foreach ($files as $k => $v) {
        $entry = isset($v['filename']) ? $v['filename'] : $k;
        $size = $v['size'];
        if ($indent == 0) {
            // root
            $is_folder = true;
        } elseif (is_array($v) && (!array_key_exists('filename', $v) && !array_key_exists('size', $v))) {
            // normal node
            $is_folder = true;
        } else {
            // leaf node, i.e. a file
            $is_folder = false;
        }
        if ($is_folder) {
            // we could output a folder icon here
        } else {
            // we could output an appropriate icon
            // based on file extension here
            $ext = pathinfo($entry, PATHINFO_EXTENSION);
        }
        // echo "<tr><td style=\"border: 1px solid #D2D2D2;\">";
        echo $entry;
        // output folder name or filename
        if (!$is_folder) {
            // if it’s not a folder, show file size
            echo " (" . makesize($size) . ")";
        }
        //echo "</td></tr>";
        if (is_array($v) && $is_folder) {
            outputTree($v, $indent + 1);
        }
    }
    //echo "</table>";
}
开发者ID:sybix,项目名称:freeostorrent,代码行数:37,代码来源:functions.php

示例8: printf

$result['peers'] = $result['leechers'] + $result['seeders'];
echo '<table style="text-align: left;">';
echo '<tr><th>Torrents chargés : </th><td>' . $result['completed'] . '</td></tr>';
echo '<tr><th>Clients : </th><td>' . $result['peers'] . '</td></tr>';
if ($result['peers']) {
    printf('<tr><th>Leechs : <td>%d <span style="font-size:7pt;">(%d %%)</span>', $result['leechers'], $result['leechers'] * 100 / $result['peers'], '</td></tr>');
    printf('<tr><th>Seeds : <td>%d <span style="font-size:7pt;">(%d %%)</span>', $result['seeders'], $result['seeders'] * 100 / $result['peers'], '</td></tr>');
}
echo '<tr><th>Torrents actifs : <td>' . $result['torrents'] . '</td></tr>';
//$nbr = mysql_query("SELECT id_torr FROM torrents");
//$nbrtorrents = mysql_num_rows($nbr);
$stmt = $db->query('SELECT postID FROM blog_posts_seo');
$nbrtorrents = $stmt->rowCount();
printf('<tr><th>Torrents total : <td>%d</td>', $nbrtorrents, '<td></td></tr>');
//$res = mysql_query("select sum(downloaded) as down, sum(uploaded) as up from xbt_users");
//$row = mysql_fetch_array($res);
$stmt = $db->query('SELECT sum(downloaded) as down, sum(uploaded) as up FROM xbt_users');
$row = $stmt->fetch();
$dled = makesize($row['down']);
$upld = makesize($row['up']);
$traffic = makesize($row['down'] + $row['up']);
printf('<tr><th>Download total : <td>' . $dled . '</td></tr>');
printf('<tr><th>Upload total : <td>' . $upld . '</td></tr>');
printf('<tr><th>Trafic total : <td>' . $traffic . '</td></tr>');
print '</table>';
?>
		</ul>
</li>

</div>
开发者ID:sybix,项目名称:freeostorrent,代码行数:30,代码来源:sidebar.php

示例9: print_debug

function print_debug($level = 3, $key = ' - ')
{
    global $time_start, $gzip, $num_queries, $cached_querys;
    $time_end = get_microtime();
    switch ($level) {
        case '4':
            if (function_exists('memory_get_usage')) {
                $memory = '[ Memory: ' . makesize(memory_get_usage());
                if (function_exists('memory_get_peak_usage')) {
                    $memory .= '|' . makesize(memory_get_peak_usage());
                }
                $return[] = $memory . ' ]';
            }
        case '3':
            $return[] = '[ GZIP: ' . $gzip . ' ]';
        case '2':
            $return[] = '[ Script Execution: ' . number_format($time_end - $time_start, 4) . ' sec. ]';
        case '1':
            $return[] = '[ Queries: ' . $num_queries . '|' . $cached_querys . ' ]';
            break;
        default:
            return '';
    }
    return implode($key, array_reverse($return));
}
开发者ID:Karpec,项目名称:gizd,代码行数:25,代码来源:functions.php

示例10: die

    die("non direct access!");
}
if (!defined("IN_ACP")) {
    die("non direct access!");
}
function get_value($what, $table, $area, $id)
{
    global $TABLE_PREFIX;
    $query = do_sqlquery("SELECT {$what} FROM {$TABLE_PREFIX}{$table} WHERE {$area}={$id}", true);
    $object_to_array = mysql_fetch_array($query) or sql_err(__FILE__, __LINE__);
    return $object_to_array[$what];
}
$admintpl->set("language", $language);
$query = do_sqlquery("SELECT DISTINCT `user` FROM `{$TABLE_PREFIX}lottery_tickets`", true);
if (mysql_num_rows($query) == 0) {
    $admintpl->set("no_tickets", true, true);
} else {
    $admintpl->set("no_tickets", false, true);
    $bought = array();
    $x = 0;
    while ($users = mysql_fetch_assoc($query)) {
        $bought[$x]["id"] = $users["user"];
        $bought[$x]["number_tickets"] = get_value("COUNT(user)", "lottery_tickets", "user", $users["user"]);
        $bought[$x]["username"] = get_value("username", "users", "id", $users["user"]);
        $bought[$x]["download"] = makesize(get_value("downloaded", "users", "id", $users["user"]));
        $bought[$x]["upload"] = makesize(get_value("uploaded", "users", "id", $users["user"]));
        $x++;
        $admintpl->set("ticket", $bought);
    }
}
$admintpl->set("back", "index.php?page=admin&user=" . $CURUSER["uid"] . "&code=" . $CURUSER["random"] . "&do=lottery_settings");
开发者ID:wilian32,项目名称:xbtit,代码行数:31,代码来源:data-file.view_tickets.php

示例11: makesize

<?php

$language["BLACKJACK"] = "Blackjack";
$language["BJ_WELCOME_1"] = "<p><font color='#FFFFFF'>Le but est de possèder une main le plus proche de 21 sans la dépassé. Vous joué contre le Dealer, vous devez donc avoir une meilleure main que lui pour gagner.</font>";
$language["BJ_WELCOME_2"] = "<font color='yellow'><b> Chaque partie coûte " . makesize($btit_settings["bj_blackjack_stake"]) . " de crédit d'upload.</p></b></font><font size=2 color='#FFFFFF'><li><b>Le Blackjack paye " . makesize($btit_settings["bj_blackjack_stake"] * $btit_settings["bj_blackjack_prize"] + $btit_settings["bj_blackjack_stake"]) . "</li><li>Battre le dealer paye " . makesize($btit_settings["bj_blackjack_stake"] * $btit_settings["bj_normal_prize"] + $btit_settings["bj_blackjack_stake"]) . "</li><li>Un nul vous redonne votre mise.</li><li>Perdre ne vous redonne rien.</li></font>";
$language["CONTINUE"] = "Jouer";
$language["DEALER_HAND"] = "<font color='#FFFFFF' face='Arial'><b>Main du Dealer (";
$language["YOUR_HAND"] = "<font color='#FFFFFF' face='Arial'><b>Votre main (";
$language["HIT"] = "Nouvelle carte";
$language["STAND"] = "Conserver la main";
$language["ACTIVE_GAME_1"] = "Vous avez déjà une partie en cours, ";
$language["ACTIVE_GAME_2"] = " pour la terminée.";
$language["YOU_WIN"] = "<font color='lime' size='2'><b>Vous avez gagner!</b></font>";
$language["YOU_LOSE"] = "<font color='red' size='2'><b>Vous avez perdue!</b></font>";
$language["PUSH"] = "<font color='orange'><b>Push!</b></font>";
$language["INSUFFICIENT_UPLOAD_CREDIT"] = "<font color='#FF0000' size='2'><b>Vous n'avez pas assez de crédit d'upload pour pouvoir jouer!</b></font>";
$language["PLAY_AGAIN"] = "<font color='yellow' face='Arial' size='2'>Rejouer</font>";
开发者ID:Karpec,项目名称:gizd,代码行数:17,代码来源:lang_blackjack.php

示例12: fopen

    $torrenttpl->set("DISPLAY_FILES", TRUE, TRUE);
    $ffile = fopen($row["url"], "rb");
    $content = fread($ffile, filesize($row["url"]));
    fclose($ffile);
    $content = BDecode($content);
    $numfiles = 0;
    if (isset($content["info"]) && $content["info"]) {
        $thefile = $content["info"];
        if (isset($thefile["length"])) {
            $dfiles[$numfiles]["filename"] = htmlspecialchars($thefile["name"]);
            $dfiles[$numfiles]["size"] = makesize($thefile["length"]);
            $numfiles++;
        } elseif (isset($thefile["files"])) {
            foreach ($thefile["files"] as $singlefile) {
                $dfiles[$numfiles]["filename"] = htmlspecialchars(implode("/", $singlefile["path"]));
                $dfiles[$numfiles]["size"] = makesize($singlefile["length"]);
                $numfiles++;
            }
        } else {
            // can't be but...
        }
    }
    $row["numfiles"] = $numfiles . ($numfiles == 1 ? " file" : " files");
    unset($content);
} else {
    $torrenttpl->set("DISPLAY_FILES", false, TRUE);
}
$torrenttpl->set("files", $dfiles);
// end files in torrents
include dirname(__FILE__) . "/include/offset.php";
$row["date"] = date("d/m/Y", $row["data"] - $offset);
开发者ID:r4kib,项目名称:cyberfun-xbtit,代码行数:31,代码来源:details.php

示例13: style_list

    }
    if ($row["warns"] == 3 or $row["warns"] == 4) {
        $wl = "<img src='images/warned/warn_2.png'>";
    }
    if ($row["warns"] == 5 or $row["warns"] == 6) {
        $wl = "<img src='images/warned/warn_3.png'>";
    }
    print "<tr><td><center>" . $wl . "</td></tr>";
    ?>
</table><table class="lista" width="100%">

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

<table class="lista" border="0" align="center" width="100%">
<?php 
    print "<tr><td align=\"center\">";
    include "include/offset.php";
    print $language["USER_LASTACCESS"] . ":<br />" . date("d/m/Y H:i:s", $CURUSER["lastconnect"] - $offset);
    print "</select>";
    print "</td>\n</tr>\n";
    if ($btit_settings["hide_style"] == "visible") {
开发者ID:Karpec,项目名称:gizd,代码行数:31,代码来源:user_block.php

示例14: do_sanity


//.........这里部分代码省略.........
    $expired = strtotime($expire_dated);
    $nowd = strtotime("now");
    if ($nowd >= $expired && $configd['free'] == 'yes') {
        do_sqlquery("UPDATE `{$TABLE_PREFIX}files` SET `free`='no',free_expire_date='0000-00-00 00:00:00' WHERE `external`='no'", true);
        do_sqlquery("ALTER TABLE `{$TABLE_PREFIX}files` CHANGE `free` `free` ENUM( 'yes', 'no' ) NULL DEFAULT 'no'", true);
        // xbtt
        if ($XBTT_USE) {
            do_sqlquery("UPDATE xbt_files SET down_multi=0, flags=2");
            do_sqlquery("ALTER TABLE xbt_files CHANGE `down_multi` `down_multi` INT NULL DEFAULT '0'", true);
        }
    }
    // end freeleech
    $query = do_sqlquery("SELECT * FROM `{$TABLE_PREFIX}lottery_config` WHERE `id`=1", true);
    $config = mysqli_fetch_array($query);
    $expire_date = $config['lot_expire_date'];
    $expire = strtotime($expire_date);
    $now = strtotime("now");
    if ($now >= $expire) {
        $number_winners = $config['lot_number_winners'];
        $number_to_win = $config['lot_number_to_win'];
        $minupload = $config['lot_amount'];
        $res = do_sqlquery("SELECT `id`, `user` FROM `{$TABLE_PREFIX}lottery_tickets` ORDER BY RAND(NOW()) LIMIT " . $number_winners . "", true);
        //select number of winners
        $total = mysqli_num_rows(do_sqlquery("SELECT * FROM `{$TABLE_PREFIX}lottery_tickets`", true));
        //select total selled tickets
        $pot = $total * $minupload;
        //selled tickets * ticket price
        $pot += $number_to_win;
        // ticket prize + minimum win
        $win = $pot / $number_winners;
        // prize for each winner
        $subject = sqlesc("You have won a prize with the lottery");
        //subject in pm
        $msg = sqlesc("Congratulations you have won a prize with our Lottery. Your prize has been added to your account. You won " . makesize($win) . "");
        //next 3 rows are the msg for PM
        $sender = $config['sender_id'];
        // Sender id, in my case 0
        //print the winners and send them PM en give them price
        while ($row = mysqli_fetch_array($res)) {
            $ras = do_sqlquery("SELECT `smf_fid`, `id`, `username` FROM `{$TABLE_PREFIX}users` WHERE `id`=" . $row['user'] . "", true);
            $raw = mysqli_fetch_array($ras);
            $rec = sqlesc("{$raw['id']}");
            $lotid = $raw["id"];
            $lotname = $raw["username"];
            do_sqlquery("UPDATE `{$TABLE_PREFIX}users` SET `uploaded`=uploaded+" . $win . " WHERE `id`=" . $row['user'] . "", true);
            $smf = mysqli_fetch_assoc(do_sqlquery("SELECT smf_fid, username FROM `{$TABLE_PREFIX}users` WHERE `id`=" . $row["user"] . "", true));
            send_pm($sender, $rec, $subject, $msg);
            // begin - announce winner in shoutbox
            do_sqlquery("INSERT INTO {$TABLE_PREFIX}chat (uid, time, name, text) VALUES (0," . time() . ", 'System','[color=red]Lottery winner : [/color][url={$BASEURL}/index.php?page=userdetails&id={$lotid}]" . $lotname . " did win " . makesize($win) . "[/url]')");
            // end - announce winner in shoutbox
            do_sqlquery("INSERT INTO `{$TABLE_PREFIX}lottery_winners` (`id`, `win_user`, `windate`, `price`) VALUES ('', '" . $raw['username'] . "', '" . $expire_date . "', '" . $win . "')");
        }
        do_sqlquery("TRUNCATE TABLE `{$TABLE_PREFIX}lottery_tickets`", true);
        do_sqlquery("UPDATE `{$TABLE_PREFIX}lottery_config` SET `lot_status`='closed' WHERE `id`=1", true);
    }
    // lottery auto start
    if ($btit_settings["autolot"] == TRUE) {
        $date_end = lastOfMonth();
        $klaar = $config["lot_status"];
        if ($klaar == 'closed') {
            $expire_date = $date_end;
            $expire_time = 23;
            $val1 = $expire_date . " " . $expire_time . ":59:59";
            $val2 = 1;
            $val3 = 15 * 1024 * 1024 * 1024;
            // Gb
开发者ID:Karpec,项目名称:gizd,代码行数:67,代码来源:sanity.php

示例15: do_sqlquery

$action = $_GET['action'];
$returnto = "index.php?page=admin&user=" . $CURUSER["uid"] . "&code=" . $CURUSER["random"] . "&do=lottery_settings";
if ($action == 'send') {
    $expire_date = $_POST['expire_date'];
    $expire_time = $_POST['expire_time'];
    $val1 = $expire_date . " " . $expire_time . ":00:00";
    $val2 = $_POST['number_winners'];
    $val3 = $_POST['min_amout_to_win'] * 1024 * 1024 * 1024;
    // Gb
    $val4 = $_POST['amount_to_pay'] * 1024 * 1024;
    // Mb
    $val5 = $_POST["enabled"] ? "yes" : "no";
    $val6 = $_POST['limit_buy'];
    $val7 = $_POST['sender_id'];
    do_sqlquery("UPDATE `{$TABLE_PREFIX}lottery_config` SET `lot_expire_date`='" . $val1 . "', `lot_number_winners`='" . $val2 . "', `lot_number_to_win`='" . $val3 . "', `lot_amount`='" . $val4 . "', `lot_status`='" . $val5 . "', `limit_buy`='" . $val6 . "', `sender_id`=" . $val7 . " WHERE `id`=1", true);
    header("Location: {$BASEURL}/{$returnto}");
} else {
    $query = do_sqlquery("SELECT * FROM `{$TABLE_PREFIX}lottery_config` WHERE `id`=1", true);
    $row = mysqli_fetch_array($query);
    $admintpl->set("language", $language);
    $admintpl->set("frm_action", "index.php?page=admin&amp;user=" . $CURUSER["uid"] . "&amp;code=" . $CURUSER["random"] . "&amp;do=lottery_settings&amp;action=send");
    $admintpl->set("expire_date", substr($row["lot_expire_date"], 0, -9));
    $admintpl->set("expire_time", substr($row["lot_expire_date"], -8, -6));
    $admintpl->set("number_winners", $row["lot_number_winners"]);
    $admintpl->set("amount_to_pay", substr(makesize($row["lot_amount"]), 0, -6));
    $admintpl->set("amount_to_win", substr(makesize($row["lot_number_to_win"]), 0, -6));
    $admintpl->set("limit_to_buy", $row["limit_buy"]);
    $admintpl->set("sender_id", $row["sender_id"]);
    $admintpl->set("lottery_enabled", $row["lot_status"] == "yes" ? "checked=\"checked\"" : "");
    $admintpl->set("view_selled_tickets", "index.php?page=admin&amp;user=" . $CURUSER["uid"] . "&amp;code=" . $CURUSER["random"] . "&amp;do=view_selled_tickets");
}
开发者ID:Karpec,项目名称:gizd,代码行数:31,代码来源:admin.lottery.php


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