本文整理汇总了PHP中umc_mysql_fetch_all函数的典型用法代码示例。如果您正苦于以下问题:PHP umc_mysql_fetch_all函数的具体用法?PHP umc_mysql_fetch_all怎么用?PHP umc_mysql_fetch_all使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了umc_mysql_fetch_all函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: umc_db_take_item
/**
* Removes an item from stock or deposit; does not record the transaction
*
* @param type $table
* @param type $id
* @param type $amount
* @param type $player
* @return int
*/
function umc_db_take_item($table, $id, $amount, $player)
{
// $uuid = umc_uuid_getone($player, 'uuid');
$D = umc_mysql_fetch_all("SELECT amount FROM minecraft_iconomy.{$table} WHERE id='{$id}';");
$amount_row = $D[0];
$newstock = $amount_row['amount'] - $amount;
if ($table == 'stock') {
if ($newstock == 0) {
$sql = "DELETE FROM minecraft_iconomy.stock WHERE id='{$id}';";
umc_log('shop', 'stock_adjust', "Cleared all content from stock for ID {$id} by withdrawing {$amount_row['amount']}");
} else {
$sql = "UPDATE minecraft_iconomy.stock SET amount={$newstock} WHERE id='{$id}';";
umc_log('shop', 'stock_adjust', "Changed stock level for ID {$id} from {$amount_row['amount']} to {$newstock}");
}
} else {
// take from deposit
if ($newstock == 0) {
$sql = "DELETE FROM minecraft_iconomy.deposit WHERE id='{$id}';";
umc_log('shop', 'deposit_adjust', "Cleared all content from deposit for ID {$id} by withdrawing {$amount_row['amount']}");
} else {
$sql = "UPDATE minecraft_iconomy.deposit SET amount={$newstock} WHERE id='{$id}';";
umc_log('shop', 'deposit_adjust', "Changed deposit level for ID {$id} from {$amount_row['amount']} to {$newstock}");
}
}
umc_mysql_query($sql, true);
// check stock levels
$sql = "SELECT * FROM minecraft_iconomy.{$table} WHERE id={$id};";
$D2 = umc_mysql_fetch_all($sql);
if (count($D2)) {
return $D2[0]['amount'];
} else {
return 0;
}
}
示例2: umc_contests_status
function umc_contests_status()
{
global $UMC_SETTING;
$status_arr = array('voting', 'active');
$out = '<ul>';
foreach ($status_arr as $status) {
$sql = "SELECT title, id from 'minecraft_srvr.contest_contests WHERE status='{$status}' ORDER by id ASC;";
$D = umc_mysql_fetch_all($sql);
if (count($D) > 0) {
$title = ucfirst("{$status}:");
$out .= "<li><strong>{$title}</strong>";
$out .= "<ul>";
foreach ($D as $row) {
$link = $UMC_SETTING['path']['url'] . "/contestsmanager/?action=show_contest&type=" . $row['id'];
$out .= "<li><a href=\"{$link}\">{$row['title']}</a></li>";
}
$out .= "</ul></li>";
}
}
$out .= "</ul>";
echo $out;
}
示例3: umc_ticket_close
function umc_ticket_close()
{
global $WSEND;
$player = $WSEND['player'];
$player_id = umc_user_id($player);
$args = $WSEND['args'];
if (!isset($args[1]) && !isset($args[2])) {
umc_show_help($args);
die;
}
$key = intval($args[2]);
if (!is_numeric($key)) {
umc_error("Invalid ticket ID");
}
$sql = "SELECT * FROM minecraft.wp_wpscst_tickets WHERE user_id={$player_id} AND resolution LIKE 'Open' AND primkey='{$key}';";
$D = umc_mysql_fetch_all($sql);
if (count($D) == 0) {
umc_error("Ticket ID {$key} not found!");
}
$sql2 = "UPDATE minecraft.`wp_wpscst_tickets` SET `resolution` = 'Closed' WHERE `primkey`={$key};";
umc_mysql_fetch_all($sql2);
umc_echo("Ticket ID {$key} was successfully closed!");
}
示例4: umc_ts_clear_rights
/**
* Reset TS user rights to "Guest" for a specific user
* This can be done even if the user is not online
*
* @param string $uuid
* @param boolean $echo
* @return boolean
*/
function umc_ts_clear_rights($uuid, $echo = false)
{
XMPP_ERROR_trace(__FUNCTION__, func_get_args());
umc_echo("Trying to remove old permissions:");
require_once '/home/includes/teamspeak_php/libraries/TeamSpeak3/TeamSpeak3.php';
global $UMC_TEAMSPEAK;
// find out the TS id the user has been using from the database
$check_sql = "SELECT ts_uuid FROM minecraft_srvr.UUID WHERE UUID='{$uuid}';";
$D = umc_mysql_fetch_all($check_sql);
if ($D[0]['ts_uuid'] == '') {
if ($echo) {
umc_echo("Old Client: No previous TS account detected.");
}
return false;
} else {
umc_echo("Found old permissions.");
$ts_uuid = $D[0]['ts_uuid'];
}
umc_echo("Connecting to TS server.");
if (!$UMC_TEAMSPEAK['server']) {
$UMC_TEAMSPEAK['server'] = TeamSpeak3::factory("serverquery://queryclient:Uo67dWu3@74.208.45.80:10011/?server_port=9987");
}
// find the TS user by that TS UUID
umc_echo("Searching for you on the TS server.");
$ts_Clients_match = $UMC_TEAMSPEAK['server']->clientFindDb($ts_uuid, true);
if (count($ts_Clients_match) > 0) {
umc_echo("Found user entries on TS server");
$client_dbid = $ts_Clients_match[0];
// enumerate all the groups the user is part of
$servergroups = array_keys($UMC_TEAMSPEAK['server']->clientGetServerGroupsByDbid($client_dbid));
// remove all servergroups except 8 (Guest)
umc_echo("Removing all old usergroups:");
foreach ($servergroups as $sgid) {
if ($sgid != 8) {
$UMC_TEAMSPEAK['server']->serverGroupClientDel($sgid, $client_dbid);
if ($echo) {
umc_echo("Old Client: Removing Group " . $UMC_TEAMSPEAK['ts_groups'][$sgid]);
}
}
}
// also remove TS UUID from DB
$ins_sql = "UPDATE minecraft_srvr.UUID SET ts_uuid='' WHERE ts_uuid='{$ts_uuid}';";
umc_mysql_query($ins_sql, true);
return true;
} else {
if ($echo) {
umc_echo("Old Client: Previous TS UUID was invalid, nothing to do");
}
return false;
}
}
示例5: umc_shopmgr_stats
/**
* shows a graphic of the shop trading volume in pieces and values over time
*/
function umc_shopmgr_stats()
{
global $UMC_DOMAIN;
$sql = "SELECT DATE_FORMAT(`date`,'%Y-%u') AS week, SUM(amount) AS amount, SUM(cost) AS value\r\n FROM minecraft_iconomy.transactions\r\n WHERE date>'2012-03-00 00:00:00'\r\n\t AND seller_uuid NOT LIKE 'cancel%'\r\n\t AND buyer_uuid NOT LIKE 'cancel%'\r\n\tGROUP BY week;";
$D = umc_mysql_fetch_all($sql);
//$maxval_amount = 0;
//$maxval_value = 0;
//$minval = 0;
$ydata = array();
$lines = array('Amount', 'Value');
$out = "<script type='text/javascript' src=\"{$UMC_DOMAIN}/admin/js/amcharts.js\"></script>\n" . "<script type='text/javascript' src=\"{$UMC_DOMAIN}/admin/js/serial.js\"></script>\n" . "<div id=\"chartdiv\" style=\"width: 100%; height: 362px;\"></div>\n" . "<script type='text/javascript'>//<![CDATA[\n" . "var chart;\n" . "var chartData = [\n";
//
foreach ($D as $row) {
//$maxval_amount = max($maxval_amount, $row['amount']);
//$maxval_value = max($maxval_value, $row['value']);
$date = $row['week'];
$ydata[$date]['Amount'] = $row['amount'];
$ydata[$date]['Value'] = round($row['value']);
}
foreach ($ydata as $date => $date_sites) {
$out .= "{\"date\": \"{$date}\",";
foreach ($date_sites as $date_site => $count) {
$out .= "\"{$date_site}\": {$count},";
}
$out .= "},\n";
}
$out .= "];\n";
$out .= 'AmCharts.ready(function () {
// SERIAL CHART
chart = new AmCharts.AmSerialChart();
chart.pathToImages = "http://www.amcharts.com/lib/3/images/";
chart.dataProvider = chartData;
chart.marginTop = 10;
chart.categoryField = "date";
// AXES
// Category
var categoryAxis = chart.categoryAxis;
categoryAxis.gridAlpha = 0.07;
categoryAxis.axisColor = "#DADADA";
categoryAxis.startOnAxis = true;
// Value
var valueAxis = new AmCharts.ValueAxis();
valueAxis.id = "Amount";
valueAxis.gridAlpha = 0.07;
valueAxis.title = "Amount";
valueAxis.position = "left";
chart.addValueAxis(valueAxis);
// Amount
var valueAxis = new AmCharts.ValueAxis();
valueAxis.id = "Value";
valueAxis.gridAlpha = 0.07;
valueAxis.title = "Value";
valueAxis.position = "right";
chart.addValueAxis(valueAxis);';
foreach ($lines as $line) {
if ($line == 'Value') {
$index = 'Uncs';
} else {
$index = 'Units';
}
$out .= "var graph = new AmCharts.AmGraph();\r\n graph.valueAxis = \"{$line}\"\r\n graph.type = \"line\";\r\n graph.hidden = false;\r\n graph.title = \"{$line}\";\r\n graph.valueField = \"{$line}\";\r\n graph.lineAlpha = 1;\r\n graph.fillAlphas = 0.6; // setting fillAlphas to > 0 value makes it area graph\r\n graph.balloonText = \"<span style=\\'font-size:12px; color:#000000;\\'><b>[[value]]</b> {$index}</span>\";\r\n chart.addGraph(graph);";
}
$out .= '// LEGEND
var legend = new AmCharts.AmLegend();
legend.position = "top";
legend.valueText = "[[value]]";
legend.valueWidth = 100;
legend.valueAlign = "left";
legend.equalWidths = false;
legend.periodValueText = "total: [[value.sum]]"; // this is displayed when mouse is not over the chart.
chart.addLegend(legend);
// CURSOR
var chartCursor = new AmCharts.ChartCursor();
chartCursor.cursorAlpha = 0;
chart.addChartCursor(chartCursor);
// SCROLLBAR
var chartScrollbar = new AmCharts.ChartScrollbar();
chartScrollbar.color = "#FFFFFF";
chart.addChartScrollbar(chartScrollbar);
// WRITE
chart.write("chartdiv");
});
//]]></script>';
return $out;
}
示例6: umc_checkout_goods
/**
* Add items to a user inventory. If cancel=true, we check if the current user is owner of the goods
*
* @global type $UMC_USER
* @param type $id
* @param type $amount
* @param type $table
* @param boolean $cancel
* @param type $to_deposit
* @param string $uuid
* @return string
*/
function umc_checkout_goods($id, $amount, $table = 'stock', $cancel = false, $to_deposit = false, $uuid = false)
{
global $UMC_USER, $UMC_ENV;
XMPP_ERROR_trace(__FUNCTION__, func_get_args());
if (!$uuid) {
$player = $UMC_USER['username'];
$uuid = $UMC_USER['uuid'];
} else {
$player = umc_user2uuid($uuid);
}
if (!is_numeric($id)) {
umc_error('{red}Invalid ID. Please use {yellow}/shophelp;');
}
// the fact that the source is also a condition prevents people to cancel other users' items.
if ($table == 'stock') {
if ($cancel) {
$sql = "SELECT * FROM minecraft_iconomy.stock WHERE uuid='{$uuid}' AND id='{$id}' LIMIT 1;";
} else {
$sql = "SELECT * FROM minecraft_iconomy.stock WHERE id='{$id}' LIMIT 1;";
}
} else {
if ($table == 'deposit') {
$sql = "SELECT * FROM minecraft_iconomy.deposit WHERE (sender_uuid='{$uuid}' OR recipient_uuid='{$uuid}') AND id='{$id}' LIMIT 1;";
}
}
$D = umc_mysql_fetch_all($sql);
if (count($D) == 0) {
umc_error("{red}Id {white}{$id}{red} not found! Please try again.;");
} else {
$row = $D[0];
$item = umc_goods_get_text($row['item_name'], $row['damage'], $row['meta']);
$meta_cmd = $meta = '';
if ($row['meta'] != '') {
$meta_arr = unserialize($row['meta']);
if (!is_array($meta_arr)) {
XMPP_ERROR_trigger("Could not get Meta Data array for {$table} id {$id}: " . var_export($row, true));
}
if ($row['item_name'] == "banner") {
$meta_cmd = umc_banner_get_data($meta_arr);
} else {
foreach ($meta_arr as $type => $lvl) {
$meta_cmd .= " {$type}:{$lvl}";
}
}
}
// handle unlimited items
$unlimited = false;
if ($row['amount'] == -1) {
$row['amount'] = $amount;
$unlimited = true;
}
//umc_echo('There were ' . $row['amount'] . " pieces of " . $item['item_name'] . "$meta_txt stored.");
// determine withdrawal amount
if (is_numeric($amount) && $amount <= $row['amount']) {
$sellamount = $amount;
} else {
if ($amount == 'max') {
// withdraw all
$sellamount = $row['amount'];
//umc_echo("You are withdrawing all ($sellamount) {$item['name']}$meta_txt");
} else {
if (is_numeric($amount) && $amount > $row['amount']) {
umc_echo("{yellow}[!]{gray} Available amount ({yellow}{$row['amount']}{gray}) less than amount specified ({yellow}{$amount}{gray})");
$sellamount = $row['amount'];
} else {
umc_error("{red}Amount {white}'{$amount}'{red} is not numeric;");
}
}
}
if ($table != 'stock') {
umc_echo("{green}[+]{gray} You are withdrawing {yellow} {$amount} {gray} of {$item['full']}{gray}.");
}
if ($table == 'stock') {
$cost = $sellamount * $row['price'];
if ($cancel) {
$target = $uuid;
$source = 'cancel00-sell-0000-0000-000000000000';
} else {
$target = $uuid;
$source = $row['uuid'];
}
} else {
if ($table == 'deposit') {
if ($row['recipient_uuid'] == $uuid) {
$cancel = true;
}
$cost = 0;
if ($cancel) {
//.........这里部分代码省略.........
示例7: umc_bottomkarma
function umc_bottomkarma()
{
XMPP_ERROR_trace(__FUNCTION__, func_get_args());
$sql = "SELECT SUM(karma) as sum_karma, receivers.username as receiver_name FROM minecraft_srvr.karma\r\n LEFT JOIN minecraft_srvr.UUID as senders ON sender_uuid=senders.UUID\r\n LEFT JOIN minecraft_srvr.UUID as receivers ON receiver_uuid=receivers.UUID\r\n WHERE senders.lot_count > 0 AND receivers.lot_count > 0\r\n GROUP BY receivers.username\r\n HAVING sum(karma) < 0\r\n ORDER BY sum(karma) ASC LIMIT 0,10";
$D = umc_mysql_fetch_all($sql);
umc_echo("Bottom ten Karma users:");
umc_echo("-∞ => Uncovery");
foreach ($D as $row) {
$sum_karma = $row['sum_karma'];
$receiver = $row['receiver_name'];
if (!umc_user_is_banned($receiver)) {
umc_echo("{$sum_karma} => {$receiver}");
}
}
}
示例8: umc_mod_warp_lot
function umc_mod_warp_lot()
{
global $UMC_USER;
$args = $UMC_USER['args'];
if (!isset($args[2])) {
umc_show_help($args);
die;
}
$lot = strtolower($args[2]);
$world = umc_get_lot_world($lot);
$playerworld = $UMC_USER['world'];
if ($world != $playerworld) {
umc_ws_cmd("mv tp {$world}", 'asPlayer');
}
$sql = "SELECT min_x, min_z FROM minecraft_worldguard.`region_cuboid` WHERE region_id='{$lot}';";
$D = umc_mysql_fetch_all($sql);
$row = $D[0];
$x = $row['min_x'];
$z = $row['min_z'];
$y = 70;
umc_ws_cmd("tppos {$x} {$y} {$z} 135", 'asPlayer');
}
示例9: umc_web_usercheck
/**
* returns likely accounts shared by UUIDs
*
*/
function umc_web_usercheck()
{
XMPP_ERROR_trace(__FUNCTION__, func_get_args());
$tables = array('Same IP' => 'last_ip', 'Same Browser' => 'browser_id', 'Same TeamSpeak' => 'ts_uuid');
$out = '';
foreach ($tables as $table_name => $crit_field) {
$sql = "SELECT {$crit_field} FROM minecraft_srvr.UUID WHERE {$crit_field} <> '' " . "GROUP BY {$crit_field} HAVING count({$crit_field}) > 1 ORDER BY count({$crit_field}) DESC, onlinetime DESC";
$L = umc_mysql_fetch_all($sql);
$out_arr = array();
foreach ($L as $l) {
$line_sql = "SELECT username, userlevel, lot_count, onlinetime, INET_NTOA(last_ip) as ip, " . "CONCAT(browser_id, '<br>', ts_uuid) AS 'Browser & TS ID' " . "FROM minecraft_srvr.UUID WHERE {$crit_field} = '{$l[$crit_field]}'" . "ORDER BY onlinetime DESC";
$D = umc_mysql_fetch_all($line_sql);
foreach ($D as $d) {
$out_arr[] = $d;
}
}
$out .= umc_web_table($table_name, 0, $out_arr, "<h2>{$table_name}</h2>");
}
return $out;
}
示例10: umc_donation_level
function umc_donation_level($user, $debug = false)
{
XMPP_ERROR_trace(__FUNCTION__, func_get_args());
$U = umc_uuid_getboth($user);
$uuid = $U['uuid'];
$username = $U['username'];
$debug_txt = '';
global $UMC_SETTING;
$date_now = new DateTime("now");
$sql = "SELECT amount, date FROM minecraft_srvr.donations WHERE uuid='{$uuid}';";
$level = umc_get_uuid_level($uuid);
if ($level == 'Owner') {
return false;
}
$D = umc_mysql_fetch_all($sql);
// if there are 0 donations, user should not be changes
if (count($D) == 0 && strstr($level, "Donator")) {
XMPP_ERROR_trigger("User {$username} ({$uuid}) never donated but has a donator level ({$level})");
} else {
if (count($D) == 0) {
$debug_txt .= "{$username} ({$uuid}) does not have any donations\n";
return;
}
}
$debug_txt .= "Checking donation upgrade of user {$username}, current UserLevel: {$level}\n";
$donation_level = 0;
// go through all donations and find out how much is still active
foreach ($D as $row) {
$date_donation = new DateTime($row['date']);
$interval = $date_donation->diff($date_now);
$years = $interval->format('%y');
$months = $interval->format('%m');
$donation_term = $years * 12 + $months;
$donation_leftover = $row['amount'] - $donation_term;
if ($donation_leftover < 0) {
$donation_leftover = 0;
// do not create negative carryforward
}
$donation_level = $donation_level + $donation_leftover;
$debug_txt .= "Amount donated {$row['amount']} {$years} years {$months} m ago = {$donation_term} months ago, {$donation_leftover} leftover, level: {$donation_level}\n";
}
$donation_level_rounded = ceil($donation_level);
// get userlevel and check if demotion / promotion is needed
$debug_txt .= "user {$username} ({$uuid}) has donation level of {$donation_level_rounded}, now is {$level}\n";
// current userlevel
$ranks_lvl = array_flip($UMC_SETTING['ranks']);
$cur_lvl = $ranks_lvl[$level];
// get current promotion level
if (strpos($level, 'DonatorPlus')) {
$current = 2;
} else {
if (strpos($level, 'Donator')) {
$current = 1;
} else {
$current = 0;
}
}
// get future promotion level
if (count($D) == 0) {
// this never happens since it's excluded above
$future = 0;
} else {
if ($donation_level_rounded >= 1) {
$future = 2;
} else {
if ($donation_level_rounded < 1) {
$future = 1;
}
}
}
$debug_txt .= "future = {$future}, current = {$current}\n";
$change = $future - $current;
if ($change == 0) {
$debug_txt .= "User has right level, nothing to do\n";
return false;
// bail if no change needed
} else {
// we have a change in level, let's get an error report
$debug = true;
}
$debug_txt .= "User will change {$change} levels\n";
// get currect rank index
$debug_txt .= "Current Rank index = {$cur_lvl}\n";
// calculate base level
$base_lvl = $cur_lvl - $current;
$debug_txt .= "User base level = {$base_lvl}\n";
$new_lvl = $base_lvl + $future;
if ($new_lvl == $cur_lvl) {
XMPP_ERROR_send_msg("Donations upgrade: Nothing to do, CHECK this should have bailed earlier!");
return false;
}
$new_rank = $UMC_SETTING['ranks'][$new_lvl];
$debug_txt .= "User {$username} upgraded from {$level} to {$new_rank}\n";
umc_exec_command("pex user {$uuid} group set {$new_rank}");
umc_log('Donations', 'User Level de/promotion', "User {$username} upgraded from {$level} to {$new_rank}");
if ($debug) {
XMPP_ERROR_send_msg($debug_txt);
}
return $donation_level_rounded;
// . "($donation_level $current - $future - $change)";
//.........这里部分代码省略.........
示例11: umc_home_list
function umc_home_list()
{
XMPP_ERROR_trace(__FUNCTION__, func_get_args());
global $UMC_USER;
$sql = "SELECT * FROM minecraft_srvr.homes WHERE uuid='{$UMC_USER['uuid']}' ORDER BY world, name;";
$D = umc_mysql_fetch_all($sql);
$count = count($D);
umc_header("Your home list ({$count} homes)");
$homes = array();
foreach ($D as $d) {
$world = $d['world'];
$name = $d['name'];
$homes[$world][] = $name;
}
foreach ($homes as $world => $worldhomes) {
$out = "{red}{$world}: {white}" . implode("{red},{white} ", $worldhomes);
umc_echo($out);
}
umc_footer();
}
示例12: umc_get_code
function umc_get_code()
{
$chars = "abcdefghijkmnopqrstuvwxyz023456789";
srand((double) microtime() * 1000000);
$i = 0;
$pass = '';
while ($i <= 4) {
$num = rand() % 33;
$tmp = substr($chars, $num, 1);
$pass = $pass . $tmp;
$i++;
}
$sql = "SELECT * FROM minecraft_iconomy.story WHERE code='{$pass}';";
$D3 = umc_mysql_fetch_all($sql);
$count = count($D3);
if ($count > 0) {
umc_get_code();
}
return $pass;
}
示例13: umc_web_userstats
function umc_web_userstats()
{
global $UMC_DOMAIN, $UMC_SETTING;
$sql = 'SELECT count(UUID) as count, SUBSTRING(userlevel,1,1) as level, DATE_FORMAT(firstlogin, "%Y-%u") as date FROM minecraft_srvr.UUID WHERE firstlogin > 0 GROUP BY SUBSTRING(userlevel,1,1), DATE_FORMAT(firstlogin,"%Y-%u")';
$D = umc_mysql_fetch_all($sql);
$X = array();
foreach ($D as $row) {
if ($row['level'] == 'G') {
$level = 'Guest';
} else {
$level = 'Settler';
}
$X[$row['date']][$level] = $row['count'];
}
$out = '<h2>User stats:</h2>';
//$maxval = 0;
//$minval = 0;
$out .= "\n<script type='text/javascript' src=\"{$UMC_DOMAIN}/admin/js/amcharts.js\"></script>\n" . "<script type='text/javascript' src=\"{$UMC_DOMAIN}/admin/js/serial.js\"></script>\n" . "<div id=\"chartdiv\" style=\"width: 100%; height: 362px;\"></div>\n" . "<script type='text/javascript'>//<![CDATA[\n" . "var chart;\n" . "var chartData = [\n";
foreach ($X as $date => $data_set) {
$out .= "{\"date\": \"{$date}\", ";
foreach ($data_set as $date_site => $count) {
$out .= "\"{$date_site}\": {$count},";
}
$out .= "},\n";
}
$out .= "];\n";
$out .= 'AmCharts.ready(function () {
// SERIAL CHART
chart = new AmCharts.AmSerialChart();
chart.pathToImages = "http://www.amcharts.com/lib/3/images/";
chart.dataProvider = chartData;
chart.marginTop = 10;
chart.categoryField = "date";
// AXES
// Category
var categoryAxis = chart.categoryAxis;
categoryAxis.gridAlpha = 0.07;
categoryAxis.axisColor = "#DADADA";
categoryAxis.startOnAxis = true;
// Value
var valueAxis = new AmCharts.ValueAxis();
valueAxis.stackType = "regular"; // this line makes the chart "stacked"
valueAxis.gridAlpha = 0.07;
valueAxis.title = "Sign-ons";
chart.addValueAxis(valueAxis);';
$levels = array('Guest', 'Settler');
// $UMC_SETTING['ranks'];
foreach ($levels as $level) {
$out .= "\nvar graph = new AmCharts.AmGraph();\n graph.type = \"line\";\n graph.hidden = false;\n graph.title = \"{$level}\";\n graph.valueField = \"{$level}\";\n graph.lineAlpha = 1;\n graph.fillAlphas = 0.6; // setting fillAlphas to > 0 value makes it area graph\n graph.balloonText = \"<span style=\\'font-size:12px; color:#000000;\\'>{$level}: <b>[[value]]</b></span>\";\n chart.addGraph(graph);\n";
}
$out .= '// LEGEND
var legend = new AmCharts.AmLegend();
legend.position = "top";
legend.valueText = "[[value]]";
legend.valueWidth = 100;
legend.valueAlign = "left";
legend.equalWidths = false;
legend.periodValueText = "total: [[value.sum]]"; // this is displayed when mouse is not over the chart.
chart.addLegend(legend);
// CURSOR
var chartCursor = new AmCharts.ChartCursor();
chartCursor.cursorAlpha = 0;
chart.addChartCursor(chartCursor);
// SCROLLBAR
var chartScrollbar = new AmCharts.ChartScrollbar();
chartScrollbar.color = "#FFFFFF";
chart.addChartScrollbar(chartScrollbar);
// WRITE
chart.write("chartdiv");
});
//]]></script>';
return $out;
}
示例14: umc_log_kill_display
function umc_log_kill_display()
{
global $UMC_USER, $UMC_DOMAIN;
$out = '';
$line_limit = 1000;
if (!$UMC_USER) {
$out = "Please <a href=\"{$UMC_DOMAIN}/wp-login.php\">login</a>!";
return $out;
}
$userlevel = $UMC_USER['userlevel'];
$admins = array('Owner', 'Elder', 'ElderDonator', 'ElderDonatorPlus');
if (!in_array($userlevel, $admins)) {
return "This page is admin-only!";
}
$worlds = array('empire', 'kingdom');
$usernames = umc_logblock_get_usernames();
$post_world = filter_input(INPUT_POST, 'world', FILTER_SANITIZE_STRING);
$post_killer = filter_input(INPUT_POST, 'killer', FILTER_SANITIZE_STRING);
$post_lot = filter_input(INPUT_POST, 'lot', FILTER_SANITIZE_STRING);
$post_line = filter_input(INPUT_POST, 'line', FILTER_SANITIZE_STRING);
// world filter
if (isset($post_world)) {
if (!in_array($post_world, $worlds)) {
$out .= "<h2>World cannot be found!</h2>";
}
} else {
$post_world = 'empire';
}
$world_filter = "lb-{$post_world}-kills";
// lot filter
$lots = umc_logblock_get_lots($post_world);
$lot_filter = '';
if (isset($post_lot) && $post_lot != 'none') {
if (!in_array($post_lot, $lots)) {
$out .= "<h2>Lot cannot be found!</h2>";
} else {
$lot_filter = umc_logblock_get_coord_filter_from_lot($post_lot);
}
} else {
$post_lot = '';
}
// user filter
$killer_filter = '';
if (isset($post_killer) && $post_killer != 'none') {
if (in_array($post_killer, $usernames)) {
$killer_filter = "AND killers.playername='{$post_killer}'";
} else {
$out .= "<h2>Killer cannot be found!</h2>";
}
}
// line filter
if (!isset($post_line)) {
$post_line = 0;
}
$count_sql = '';
if (isset($_POST['today'])) {
$count_sql = "SELECT count(id) as counter FROM `minecraft_log`.`{$world_filter}`\r\n WHERE date=CURRENT_DATE() {$lot_filter};";
} else {
$count_sql = "SELECT count(id) as counter, playername as killer FROM `minecraft_log`.`{$world_filter}`\r\n LEFT JOIN `minecraft_log`.`lb-players` as killers ON `{$world_filter}`.`killer`=`killers`.`playerid`\r\n WHERE 1 {$killer_filter} {$lot_filter};";
}
// echo $count_sql;
$D = umc_mysql_fetch_all($count_sql);
$num_rows = $D[0]['counter'];
// make a dropdown for the line to start in for pagination
$lines = array();
$line = 0;
while ($line <= $num_rows - $line_limit) {
$line += $line_limit;
$max_limit = min($line + $line_limit - 1, $num_rows);
$lines[$line] = $max_limit;
}
$badmobs = '(33,138,1114,1115,1117,1123,1126,1128,1129,1131,1136,1930)';
if (isset($_POST['today'])) {
$sql = "SELECT id, date, weapon, x,y,z, victims.playername AS victim, killers.playername AS killer FROM `minecraft_log`.`{$world_filter}`\r\n LEFT JOIN `minecraft_log`.`lb-players` as victims ON `{$world_filter}`.`victim`=`victims`.`playerid`\r\n LEFT JOIN `minecraft_log`.`lb-players` as killers ON `{$world_filter}`.`killer`=`killers`.`playerid`\r\n WHERE date=CURRENT_DATE() AND killers.playerid NOT IN {$badmobs} AND victims.playerid NOT IN {$badmobs} {$lot_filter}\r\n ORDER BY `date` DESC LIMIT {$post_line},{$line_limit};";
} else {
$sql = "SELECT id, date, weapon, x,z,y, victims.playername AS victim, killers.playername AS killer FROM `minecraft_log`.`{$world_filter}`\r\n LEFT JOIN `minecraft_log`.`lb-players` as victims ON `{$world_filter}`.`victim`=`victims`.`playerid`\r\n LEFT JOIN `minecraft_log`.`lb-players` as killers ON `{$world_filter}`.`killer`=`killers`.`playerid`\r\n WHERE killers.playerid NOT IN {$badmobs} AND victims.playerid NOT IN {$badmobs} {$killer_filter} {$lot_filter}\r\n ORDER BY `id` DESC LIMIT {$post_line},{$line_limit};";
}
$out .= "<form action=\"\" method=\"post\">\n" . "World: <select name=\"world\">";
$selected = array();
$selected[$post_world] = " selected=\"selected\"";
foreach ($worlds as $one_world) {
$sel_str = '';
if (isset($selected[$one_world])) {
$sel_str = $selected[$one_world];
}
$out .= "<option value=\"{$one_world}\"{$sel_str}>{$one_world}</option>";
}
$out .= "</select> Lot: <select name=\"lot\"><option value=\"none\">All</option>";
$selected = array();
$selected[$post_lot] = " selected=\"selected\"";
foreach ($lots as $one_lot) {
$sel_str = '';
if (isset($selected[$one_lot])) {
$sel_str = $selected[$one_lot];
}
$out .= "<option value=\"{$one_lot}\"{$sel_str}>{$one_lot}</option>";
}
$out .= "</select> Killer: <select name=\"killer\"><option value=\"none\">All</option>";
$selected = array();
$selected[$post_killer] = " selected=\"selected\"";
//.........这里部分代码省略.........
示例15: umc_trivia_webstats
function umc_trivia_webstats()
{
$out = '<table>';
$quiz_sql = "SELECT * FROM minecraft_quiz.quizzes WHERE end <> '' ORDER BY start DESC;";
$D = umc_mysql_fetch_all($quiz_sql);
foreach ($D as $quiz_row) {
$quiz_id = $quiz_row['quiz_id'];
$master = $quiz_row['master'];
$quiz_start = $quiz_row['start'];
$quiz_end = $quiz_row['end'];
$winner = $quiz_row['winner'];
$points = $quiz_row['points'];
$prize = $quiz_row['points'];
$out .= "<tr style=\"background-color:#99CCFF;\"><td>Quiz No.{$quiz_id}, Quizmaster: {$master}</td><td>Start: {$quiz_start}</td></tr>";
$out .= "<tr><td colspan=2>Winner: {$winner} with {$points} points won {$prize} Uncs each</tr>";
$datetime = umc_datetime($quiz_start);
$seconds = umc_timer_raw_diff($datetime);
$days = $seconds / 60 / 60 / 24;
if ($days > 3) {
continue;
}
$question_sql = "SELECT question_no, question, answer, quiz_questions.question_id FROM minecraft_quiz.quiz_questions\r\n LEFT JOIN minecraft_quiz.catalogue ON quiz_questions.question_id = catalogue.question_id\r\n WHERE quiz_id = {$quiz_id} ORDER BY question_no;";
$Q = umc_mysql_fetch_all($question_sql);
foreach ($Q as $question_row) {
$question_no = $question_row['question_no'];
$question_id = $question_row['question_id'];
$question = $question_row['question'];
$answer = $question_row['answer'];
$out .= "<tr style=\"font-size:70%; background-color:#99FFCC;\"><td style=\"padding-left:40px\">Q. No.{$question_no}: {$question}</td><td>A.: {$answer}</td></tr>";
$answer_sql = "SELECT * FROM minecraft_quiz.quiz_answers WHERE quiz_id={$quiz_id} AND question_id={$question_id} ORDER BY answer_id;";
$A = umc_mysql_fetch_all($answer_sql);
$out .= "<tr style=\"font-size:70%;\"><td style=\"padding-left:80px\" colspan=2>";
foreach ($A as $answer_row) {
$answer_id = $answer_row['answer_id'];
$user_answer = $answer_row['answer_text'];
$username = $answer_row['username'];
$result = $answer_row['result'];
$style = "style=\"margin-right:10px;\"";
if ($result == 'right') {
$style = " style=\"color:green; margin-right:10px;\"";
}
$out .= "<span {$style}>{$answer_id} ({$username}): {$user_answer}</span>";
}
$out .= "</td></tr>";
}
}
$out .= "</table>";
return $out;
}