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


PHP umc_mysql_query函数代码示例

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


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

示例1: umc_item_name_integrity_check

/**
 * 1) take all item_names from pasted wiki-code
 * 2) take all item_names from the data table UMC_DATA
 * 3) take all item names from the data table $UMC_DATA_ID2NAME
 * 4) check if they match
 * 5) check if any of the tables have unknown data
 *
 */
function umc_item_name_integrity_check()
{
    global $UMC_DATA, $UMC_DATA_ID2NAME, $UMC_DATA_SPIGOT2ITEM;
    $out = '';
    $text = '';
    $tables = array('request', 'deposit', 'stock');
    if (isset($_POST['wiki_text'])) {
        $results = false;
        $text = strip_tags($_POST['wiki_text']);
        $pattern = '/minecraft:(.*)\\r/';
        preg_match_all($pattern, $text, $results);
        // process results
        $sub_results = $results[1];
        foreach ($sub_results as $wiki_string) {
            if (!isset($UMC_DATA[$wiki_string])) {
                $out .= "{$wiki_string} ! UMC_DATA ERROR<br>";
            } else {
                // now check for umc_items
                $id = $UMC_DATA[$wiki_string]['id'];
                if ($UMC_DATA_ID2NAME[$id] != $wiki_string) {
                    $wrong_name = $UMC_DATA_ID2NAME[$id];
                    $out .= "{$wiki_string} ! UMC_ITEMS ERROR (ID: {$id}, {$wrong_name})<br>";
                }
            }
        }
        foreach ($UMC_DATA_SPIGOT2ITEM as $wrong_data => $right_data) {
            if (!isset($UMC_DATA[$right_data])) {
                $out .= "{$right_data} should not be in table ({$wrong_data})!";
            }
        }
        $out .= "<pre>";
        foreach ($tables as $table) {
            $sql = "SELECT item_name FROM minecraft_iconomy.{$table} group by item_name;";
            $rst = umc_mysql_query($sql);
            while ($D = umc_mysql_fetch_array($rst)) {
                $table_item = $D['item_name'];
                if (!in_array($table_item, $sub_results)) {
                    $out .= "UPDATE minecraft_iconomy.{$table} SET item_name='{$table_item}' WHERE item_name='{$table_item}';<br>";
                }
            }
        }
        $out .= "</pre>";
    }
    $out .= '<form style="text-align:center" method="post"><input type="submit">' . '<p><textarea name="wiki_text" rows="20" style="width=100%;">' . $text . '</textarea></p>' . '<input type="submit"></form>';
    return $out;
}
开发者ID:dani0010,项目名称:uncovery_me,代码行数:54,代码来源:item_data.inc.php

示例2: umc_shop_cleanout_olduser

/**
 * move all items from the shop to deposit for a specific user
 * Normally only used when users are banned or inactive, on lot reset
 *
 * @param type $uuid
 */
function umc_shop_cleanout_olduser($uuid)
{
    XMPP_ERROR_trace(__FUNCTION__, func_get_args());
    // delete all requests
    $requests_sql = "DELETE FROM minecraft_iconomy.request WHERE uuid='{$uuid}';";
    umc_mysql_query($requests_sql, true);
    // move all items from stock to deposit
    $sql = "SELECT * FROM minecraft_iconomy.stock WHERE uuid='{$uuid}';";
    $rst = umc_mysql_query($sql);
    while ($row = umc_mysql_fetch_array($rst)) {
        umc_checkout_goods($row['id'], 'max', 'stock', true, true, $uuid);
    }
    umc_log('user_manager', 'shop-cleanout', "{$uuid} had his items moved from stock & request to deposit");
}
开发者ID:psiber-on-uncovery,项目名称:uncovery_me,代码行数:20,代码来源:shop.inc.php

示例3: umc_shopmgr_stocklist

/**
 * Creates a list of the given item on stock.
 *
 * @global type $UMC_DATA
 * @param type $table
 * @param type $item
 * @param type $type
 * @param type $uuid
 * @return type
 */
function umc_shopmgr_stocklist($table, $item = false, $type = 0, $uuid = false)
{
    global $UMC_DATA;
    $where = "WHERE damage={$type}";
    // do not show item column if there is only one type
    $what = 'concat(item_name,' | ',damage, ' | ', meta) AS item_name, ';
    if ($item && isset($UMC_DATA[$item])) {
        $where .= " AND item_name='{$item}'";
        $what = '';
    }
    if ($uuid && umc_check_user($uuid)) {
        $where .= " AND uuid='{$uuid}'";
    }
    $sql = "SELECT id AS shop_id, {$what} uuid, amount AS quantity, price FROM minecraft_iconomy.{$table} {$where}";
    $data_rst = umc_mysql_query($sql);
    $sort_column = '0, "desc"';
    $non_numeric = array('item_name', 'uuid');
    $check = umc_web_table('shop' . $table, $sort_column, $data_rst, '', array(), $non_numeric);
    if (!$check) {
        XMPP_ERROR_trigger("Error creating web_table with SQL {$sql}");
        return "Error creating data table. Admin was notified, please wait until it is fixed";
    } else {
        return $check;
    }
}
开发者ID:psiber-on-uncovery,项目名称:uncovery_me,代码行数:35,代码来源:shop_manager.php

示例4: umc_settler_new


//.........这里部分代码省略.........
            umc_log('settler_test', 'step_5', "{$player} is at step 5");
            $out .= "<form action=\"{$UMC_DOMAIN}/server-access/buildingrights/\" method=\"post\">\n" . "<h1>Step 6: Get to the {$world} world</h1>";
            // check if the player is actually in the portal house
            // player is not in portal house
            if ($player_world != 'city' || $x > 953 || $x < 938 || $z < -814 || $z > -793) {
                $out .= "You need to be in the portal house to continue. Please type <strong>/warp spawn</strong> again to get there. " . "It should look like this inside:<br><img src=\"/websend/portals.png\"> Once you see this, press\n" . "<input type=\"submit\" name=\"Next\" value=\"Next\">\n" . "<input type=\"hidden\" name=\"lot\" value=\"{$lot}\">\n" . "<input type=\"hidden\" name=\"world\" value=\"{$world}\">\n" . "<input type=\"hidden\" name=\"step\" value=\"5\">\n";
            } else {
                $out .= "Since you chose a lot in the {$world} world, you need to go through the {$world} portal. " . "It looks like this: Notice the name of the world is written on the sign." . "<img src=\"/websend/{$world}_portal.png\">" . "Please step through and press " . "<input type=\"submit\" name=\"Next\" value=\"Next\">\n" . "<input type=\"hidden\" name=\"lot\" value=\"{$lot}\">\n" . "<input type=\"hidden\" name=\"world\" value=\"{$world}\">\n" . "<input type=\"hidden\" name=\"step\" value=\"6\">\n";
            }
            break;
        case 6:
            umc_log('settler_test', 'step_6', "{$player} is at step 6");
            $spawn_lot = strtoupper($UMC_SETTING['world_data'][$world]['spawn']);
            $lower_lot = strtolower($lot);
            $lot_sql = "SELECT region_cuboid.region_id AS lot, sqrt(pow(max_x,2)+pow(max_z,2)) AS distance, max_x, max_z\r\n                FROM minecraft_worldguard.world\r\n                LEFT JOIN minecraft_worldguard.region_cuboid ON world.id=region_cuboid.world_id\r\n                WHERE region_cuboid.region_id='{$lower_lot}';";
            $D = umc_mysql_fetch_all($lot_sql);
            $lot_data = $D[0];
            // north/south difference
            if ($lot_data['max_x'] < 0) {
                $direction1 = "north";
            } else {
                if ($lot_data['max_x'] >= 0) {
                    $direction1 = "south";
                }
            }
            // north/south difference
            if ($lot_data['max_z'] < 0) {
                $direction2 = "west";
            } else {
                if ($lot_data['max_z'] >= 0) {
                    $direction2 = "east";
                }
            }
            $out .= "<form action=\"{$UMC_DOMAIN}/admin/index.php?function=create_map&world={$world}&freeonly=true\" method=\"post\">\n" . "<h1>Step 7: Getting to lot {$lot} in the {$world} world</h1>" . "Getting to your world is easy! You are now at the center of the {$world} world." . "Your lot is <strong>{$direction1}/{$direction2}</strong> from spawn! <br>" . "You can find out which direction you are looking with the <strong>/compass</strong> command.<br>" . "As a Guest level player, you cannot be killed by mobs until you finished this here.<br>" . "So you have to leave the spawn lot either through the {$direction1} or the {$direction2} exit.<br>" . "To know where you are, you can follow your icon {$user_icon} on the map while you get around.<br>" . "Please click NEXT to open the map, there you find your icon click the button next to it!<br><br>" . "<input type=\"submit\" name=\"next\" value=\"Next\">\n" . "<input type=\"hidden\" name=\"track_player\" value=\"{$player}\">\n" . "<input type=\"hidden\" name=\"world\" value=\"{$world}\">\n" . "<input type=\"hidden\" name=\"lot\" value=\"{$lot}\">\n";
            $x = $loc[$player]['x'];
            $z = $loc[$player]['z'];
            break;
        case 7:
            umc_log('settler_test', 'step_7', "{$player} is at step 7");
            // whereami
            $out .= "<h1>Step 8: Find out where you are in-game</h1>" . "<form action=\"{$UMC_DOMAIN}/server-access/buildingrights/\" method=\"post\">\n" . "Now that you know how to find yourself on the map, you need to find out where you are when in-game.<br>" . "The command to find your location in-game is called <strong>/whereami</strong>.<br>" . "Please go into the game and type <strong>/whereami</strong><br>" . "You will see something like this:<br>" . "<img src=\"/websend/whereami.png\"><br>" . "In this example, you can see the Lot (in the first line) is <img src=\"/websend/whereami_detail.png\"> So you would enter 'emp_z7'.<br>" . "Please go now into the game, type <strong>/whereami</strong>, and enter the information here:<br>" . "I am now in lot <input type=\"text\" name=\"check_lot\" value=\"\" size=\"7\"> and then press " . "<input type=\"submit\" name=\"next\" value=\"Next\">\n" . "<input type=\"hidden\" name=\"step\" value=\"8\">\n" . "<input type=\"hidden\" name=\"world\" value=\"{$world}\">\n" . "<input type=\"hidden\" name=\"lot\" value=\"{$lot}\">\n";
            // enter which lot you are in right now
            break;
        case 8:
            // walk to your lot
            umc_log('settler_test', 'step_8', "{$player} is at step 8");
            $lower_lot = strtolower($lot);
            $out .= "<form action=\"{$UMC_DOMAIN}/admin/index.php\" method=\"post\">\n" . "<h1>Step 9: Walk to your lot {$lot}!</h1>" . "Now you have everything you need to get to your lot!<br>You should follow your steps on the 2D map.<br>" . "You can either walk there, or use the command <pre>/lot warp {$lot}</pre> to get there. Please note that this command is only available while you are Guest.<br>" . "Press 'Next' to open the 2D map and follow your icon to lot {$lot}!<br>" . "<input type=\"submit\" name=\"next\" value=\"Next\">\n" . "<input type=\"hidden\" name=\"guide_lot\" value=\"{$player}\">\n" . "<input type=\"hidden\" name=\"world\" value=\"{$world}\">\n" . "<input type=\"hidden\" name=\"freeonly\" value=\"true\">\n" . "<input type=\"hidden\" name=\"function\" value=\"create_map\">\n" . "<input type=\"hidden\" name=\"step\" value=\"9\">\n" . "<input type=\"hidden\" name=\"world\" value=\"{$world}\">\n" . "<input type=\"hidden\" name=\"lot\" value=\"{$lower_lot}\">\n";
            break;
        case 9:
            umc_log('settler_test', 'step_9', "{$player} is at step 9");
            // do you like it? claim it
            $out .= "<h1>Step 10: Do you like the lot {$s_post['lot']}?</h1>" . "<form action=\"{$UMC_DOMAIN}/server-access/buildingrights/\" method=\"post\">\n" . '<input type="radio" name="step" value="10" checked>Yes! I take it! I will type <strong>/homes buy ' . $world . '</strong> now so I can warp back here!<br>' . '<input type="radio" name="step" value="1">No,I would like to start over!<br>' . "<input type=\"hidden\" name=\"lot\" value=\"{$lot}\">\n" . "<input type=\"hidden\" name=\"world\" value=\"{$world}\">\n" . "<input type=\"submit\" name=\"next\" value=\"Finish!\">\n";
            break;
        case 10:
            umc_log('settler_test', 'step_10', "{$player} is at step 10");
            // final confirmation
            $out .= "<h1>Step 11: Congratulations!</h1>" . "You have been promoted to Settler!<br>";
            if ($userlevel == 'Guest') {
                $cmd = "pex promote {$UMC_USER['uuid']}";
                umc_exec_command($cmd);
                // update UUID database
                $sql = "UPDATE minecraft_srvr.UUID SET userlevel='Settler' WHERE UUID='{$UMC_USER['uuid']}';";
                umc_mysql_query($sql);
                umc_exec_command('pex reload');
                umc_exec_command("ch qm u Congrats {$player} for becoming Settler!");
                XMPP_ERROR_send_msg("{$userlevel} {$player} got promoted with command " . $cmd);
                umc_log('settler_test', 'promotion', "{$player} ({$UMC_USER['uuid']})was promoted to settler (new test)");
                $headers = "From: minecraft@uncovery.me\r\n" . "Reply-To: minecraft@uncovery.me\r\n" . 'X-Mailer: PHP/' . phpversion();
                $subject = "[Uncovery Minecraft] Settler applicaton";
                $mailtext = "The user: {$player} (email: {$email}) was promoted to Settler and got lot {$lot}.\n\n";
                $check = mail('minecraft@uncovery.me', $subject, $mailtext, $headers);
                if (!$check) {
                    XMPP_ERROR_trigger("The settler promotion email could not be sent!");
                }
                // check userlevel to make sure
                $new_level = umc_get_userlevel($player);
                if ($new_level != 'Settler') {
                    XMPP_ERROR_trigger("{$userlevel} {$player} did NOT got promoted with command " . $cmd . " he's still {$new_level}");
                }
            } else {
                $out .= "Thanks for taking this test! Since you are {$userlevel} already, we will not promote you to Settler.<br>";
            }
            // try to assign the lot
            $check = umc_lot_manager_check_before_assign($uuid, $lot);
            $out .= "Trying to assign this lot to you: <strong>{$check['text']}</strong><br>";
            if ($check['result'] == false) {
                XMPP_ERROR_send_msg("Settler Test lot assignment failed!");
                $out .= "There was an error giving the lot you reserved to you. You can get any other through your <a hreaf=\"{$UMC_DOMAIN}/server-access/lot-manager/\">lot manager</a>!<br>";
            } else {
                umc_lot_add_player($uuid, $lot, 1, $check['cost']);
                $out .= $check['text'];
            }
            break;
        default:
            $out .= "This option was not recognized, please reload the page!";
    }
    $out .= "</form>\n";
    return $out;
}
开发者ID:psiber-on-uncovery,项目名称:uncovery_me,代码行数:101,代码来源:settler_test.php

示例5: ban

 public function ban($reason)
 {
     XMPP_ERROR_trace(__CLASS__ . " // " . __FUNCTION__, func_get_args());
     global $UMC_USERS;
     $cmd = "ban {$this->username} {$reason}";
     if ($this->context == 'websend') {
         umc_ws_cmd($cmd, 'asConsole', false, false);
         $admin = $UMC_USERS['current_user']->username;
     } else {
         umc_exec_command($cmd, 'asConsole', false);
         $admin = 'wordpress';
     }
     $sql = "INSERT INTO minecraft_srvr.`banned_users`(`username`, `reason`, `admin`, `uuid`) VALUES ('{$this->username}','{$reason}', '{$admin}', '{$this->uuid}');";
     umc_mysql_query($sql, true);
     // remove shop inventory
     umc_shop_cleanout_olduser($this->uuid);
     // remove from teamspeak
     umc_ts_clear_rights($this->uuid);
     $text = "{$admin} banned \${$this->username} ({$this->uuid}) because of {$reason}";
     umc_log('mod', 'ban', $text);
     XMPP_ERROR_send_msg($text);
     // iterate plugins to check for plugin relared post ban processes
 }
开发者ID:psiber-on-uncovery,项目名称:uncovery_me,代码行数:23,代码来源:users.class.php

示例6: umc_money_check

/**
 * this checks if the user exists, and creats it if not. returns the amount in the account.
 * @global type $UMC_ENV
 * @param type $user
 * @return int
 */
function umc_money_check($user)
{
    XMPP_ERROR_trace(__FUNCTION__, func_get_args());
    if ($user == '') {
        XMPP_ERROR_trigger("Failed to get account status for empty user!");
    }
    // check if the user has an acoount
    if (strlen($user) <= 17) {
        $uuid = umc_user2uuid($user);
    } else {
        $uuid = $user;
        $user = umc_user2uuid($uuid);
        if ($user == '') {
            XMPP_ERROR_trigger("Failed to get username for {$uuid}!");
            die;
        }
    }
    $sql = "SELECT balance FROM `minecraft_iconomy`.`mineconomy_accounts` WHERE uuid='{$uuid}';";
    $data = umc_mysql_fetch_all($sql);
    // has account to receive, return value
    if (count($data) > 0) {
        // get amount
        return $data[0]['balance'];
    } else {
        if (count($data) == 0) {
            // create account
            // check if there is a user entry but no UUID
            $sql2 = "SELECT balance FROM `minecraft_iconomy`.`mineconomy_accounts` WHERE account='{$user}';";
            $data2 = umc_mysql_fetch_all($sql2);
            if (count($data2) == 1) {
                // yes, add the UUID
                $fix_sql = "UPDATE `minecraft_iconomy`.`mineconomy_accounts`\r\n\t\t SET uuid='{$uuid}'\r\n                 WHERE account='{$user}';";
                umc_mysql_query($fix_sql, true);
                // try again
                return umc_money_check($user);
            } else {
                // insert row
                $sql3 = "INSERT INTO `minecraft_iconomy`.`mineconomy_accounts` (`uuid`, `account`, `balance`)\r\n                VALUES ('{$uuid}', '{$user}', '100');";
                umc_mysql_query($sql3, true);
                return 0;
            }
        }
    }
}
开发者ID:psiber-on-uncovery,项目名称:uncovery_me,代码行数:50,代码来源:money.inc.php

示例7: umc_lot_addrem

function umc_lot_addrem()
{
    global $UMC_USER;
    $player = $UMC_USER['username'];
    $args = $UMC_USER['args'];
    /// /lotmember lot world add target
    if (count($args) <= 3) {
        umc_echo("{red}Not enough arguments given");
        umc_show_help($args);
        return;
    }
    $addrem = $args[1];
    $lot = strtolower($args[2]);
    $action = $args[3];
    $worlds = array('emp' => 'empire', 'fla' => 'flatlands', 'dar' => 'darklands', 'aet' => 'aether', 'kin' => 'kingdom', 'dra' => 'draftlands', 'blo' => 'skyblock', 'con' => 'aether');
    $world_abr = substr($lot, 0, 3);
    if (!isset($worlds[$world_abr])) {
        umc_error("Your used an invalid lot name!");
    }
    $world = $worlds[$world_abr];
    if ($player == '@Console') {
        $player = 'uncovery';
    }
    $user_id = umc_get_worldguard_id('user', strtolower($player));
    if (!$user_id) {
        umc_error("Your user id cannot be found!");
    }
    $player_group = umc_get_userlevel($player);
    $world_id = umc_get_worldguard_id('world', $world);
    if (!$world_id) {
        umc_show_help($args);
        umc_error("The lot '{$lot}' cannot be found in any world!");
    }
    if (!umc_check_lot_exists($world_id, $lot)) {
        umc_show_help($args);
        umc_error("There is no lot {$lot} in world {$world}!");
    }
    if ($action == 'snow' || $action == 'ice') {
        // check if the user has DonatorPlus status.
        if ($player_group !== 'Owner') {
            if (!stristr($player_group, 'DonatorPlus')) {
                umc_error("You need to be DonatorPlus level to use the snow/ice features!;");
            }
            $owner_switch = 0;
            // check if player is Owner of lot
            $sql = "SELECT * FROM minecraft_worldguard.region_players WHERE region_id='{$lot}' AND world_id={$world_id} AND user_id={$user_id} and Owner=1;";
            $D = umc_mysql_fetch_all($sql);
            $num = count($D);
            if ($num != 1) {
                umc_error("It appears you {$player} ({$user_id}) are not Owner of lot {$lot} in world {$world}!");
            }
        }
        // get the current status of the flags
        if ($addrem == 'add') {
            $flag = 'allow';
            umc_echo("Allowing {$action} forming on lot {$lot}... ");
        } else {
            if ($addrem == 'rem') {
                $flag = 'deny';
                umc_echo("Preventing {$action} forming on lot {$lot}... ");
            } else {
                umc_show_help($args);
            }
        }
        if ($action == 'snow') {
            $flagname = 'snow-fall';
        } else {
            if ($action == 'ice') {
                $flagname = 'ice-form';
            }
        }
        // does flag exist?
        $check_sql = "SELECT * FROM minecraft_worldguard.region_flag WHERE region_id='{$lot}' AND world_id={$world_id} AND flag='{$flagname}';";
        $D2 = umc_mysql_fetch_all($check_sql);
        $count = count($D2);
        if ($count == 0) {
            // insert
            $ins_sql = "INSERT INTO minecraft_worldguard.region_flag (region_id, world_id, flag, value) VALUES ('{$lot}', {$world_id}, '{$flagname}', '{$flag}');";
            umc_mysql_query($ins_sql, true);
        } else {
            // update
            $upd_sql = "UPDATE minecraft_worldguard.region_flag SET value='{$flag}' WHERE region_id='{$lot}' AND world_id={$world_id} AND flag='{$flagname}';";
            umc_mysql_query($upd_sql, true);
        }
        umc_echo("done!");
        umc_log('lot', 'addrem', "{$player} changed {$action} property of {$lot}");
    } else {
        if ($action == 'owner' || $action == 'give') {
            if ($player != 'uncovery' && $player != '@Console') {
                umc_error("Nice try, {$player}. Think I am stupid? Want to get banned?");
            }
            $owner_switch = 1;
        } else {
            if ($action == 'member') {
                $user_id = umc_get_worldguard_id('user', strtolower($player));
                if (!$user_id && $player !== 'uncovery') {
                    umc_error("Your user id cannot be found!");
                }
                $owner_switch = 0;
                // check if player is Owner of lot
//.........这里部分代码省略.........
开发者ID:psiber-on-uncovery,项目名称:uncovery_me,代码行数:101,代码来源:lot.inc.php

示例8: 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;
    }
}
开发者ID:dani0010,项目名称:uncovery_me,代码行数:59,代码来源:teamspeak.inc.php

示例9: umc_skyblock_challenge_cancel

function umc_skyblock_challenge_cancel()
{
    $sql = "UPDATE `minecraft_quiz`.`block_games` SET status='cancelled' WHERE status IN ('selected','started') AND username='{$player}';";
    umc_mysql_query($sql);
    umc_echo("Your unfinished challenges have been cancelled");
}
开发者ID:psiber-on-uncovery,项目名称:uncovery_me,代码行数:6,代码来源:skyblock.inc.php

示例10: umc_lottery


//.........这里部分代码省略.........
    $uuid = umc_user2uuid($user);
    $chance = false;
    if ($user == 'uncovery' && isset($UMC_USER['args'][3])) {
        $chance = $UMC_USER['args'][3];
    }
    $roll = umc_lottery_roll_dice($chance);
    // umc_echo(umc_ws_vardump($roll));
    $item = $roll['item'];
    $luck = $roll['luck'];
    $prize = $lottery[$item];
    //echo "type = {$prize['type']}<br>;";
    //echo "complete chance: $chance<br>;";
    //var_dump($prize);
    if (isset($prize['detail'])) {
        $detail = $prize['detail'];
    }
    $type = $prize['type'];
    // always give 100 uncs
    umc_money(false, $user, 100);
    $given_block_data = 0;
    $given_block_type = 0;
    //var_dump($prize);
    switch ($type) {
        case 'item':
            umc_deposit_give_item($uuid, $detail['type'], $detail['data'], $detail['ench'], 1, 'lottery');
            $item_txt = $prize['txt'];
            break;
        case 'random_unc':
            $luck2 = mt_rand(1, 500);
            umc_money(false, $user, $luck2);
            $item_txt = "{$luck2} Uncs";
            break;
        case 'random_potion':
            $luck2 = mt_rand(0, 63);
            umc_deposit_give_item($uuid, 373, $luck2, '', 1, 'lottery');
            $item_txt = $prize['txt'];
            break;
        case 'random_ench':
            // pick which enchantment
            $rand_ench = array_rand($ENCH_ITEMS);
            $ench_arr = $ENCH_ITEMS[$rand_ench];
            //pick which item to enchant
            $rand_item = array_rand($ench_arr['items']);
            $rand_item_id = $ench_arr['items'][$rand_item];
            // pick level of enchantment
            $lvl_luck = mt_rand(1, $ench_arr['max']);
            //echo "$item $ench_txt $lvl_luck";
            $item_ench_arr = array($rand_ench => $lvl_luck);
            $item = umc_goods_get_text($rand_item_id, 0, $item_ench_arr);
            $item_name = $item['item_name'];
            $full = $item['full'];
            umc_deposit_give_item($uuid, $item_name, 0, $item_ench_arr, 1, 'lottery');
            $item_txt = "a " . $full;
            break;
        case 'random_pet':
            // same as blocks below but only 1 always
            umc_echo($type);
            $block = $prize['blocks'];
            $luck2 = mt_rand(0, count($prize['blocks']) - 1);
            $given_block = explode(":", $block[$luck2]);
            $given_block_type = $given_block[0];
            $given_block_data = $given_block[1];
            umc_deposit_give_item($uuid, $given_block_type, $given_block_data, '', 1, 'lottery');
            $item = umc_goods_get_text($given_block_type, $given_block_data);
            $item_txt = "a " . $item['full'];
            break;
        case 'random_common':
        case 'random_ore':
        case 'random_manuf':
            $block = $prize['blocks'];
            $luck2 = mt_rand(0, count($prize['blocks']) - 1);
            $luck3 = mt_rand(1, 64);
            $given_block = explode(":", $block[$luck2]);
            $given_block_type = $given_block[0];
            $given_block_data = $given_block[1];
            umc_deposit_give_item($uuid, $given_block_type, $given_block_data, '', $luck3, 'lottery');
            $item = umc_goods_get_text($given_block_type, $given_block_data);
            $item_txt = "{$luck3} " . $item['full'];
            break;
    }
    if ($user != 'uncovery') {
        // testing only
        $item_nocolor = umc_ws_color_remove($item_txt);
        umc_ws_cmd("ch qm N {$user} voted, rolled a {$luck} and got {$item_nocolor}!", 'asConsole');
        umc_log('votelottery', 'vote', "{$user} rolled {$luck} and got {$item_nocolor} ({$given_block_type}:{$given_block_data})");
        $userlevel = umc_get_userlevel($user);
        if (in_array($userlevel, array('Settler', 'Guest'))) {
            $msg = "You received {$item_txt} from the lottery! Use {green}/withdraw @lottery{white} to get it!";
            umc_msg_user($user, $msg);
        }
    } else {
        umc_echo("{$user} voted, rolled a {$luck} and got {$item_txt}!");
    }
    // add vote to the database
    $service = umc_mysql_real_escape_string($UMC_USER['args'][3]);
    $ip = umc_mysql_real_escape_string($UMC_USER['args'][4]);
    $sql = "INSERT INTO minecraft_log.votes_log (`username`, `datetime`, `website`, `ip_address`)\r\n        VALUES ('{$uuid}', NOW(), {$service}, {$ip});";
    umc_mysql_query($sql, true);
    // echo "$user voted for the server and got $item_txt!;";
}
开发者ID:dani0010,项目名称:uncovery_me,代码行数:101,代码来源:lottery.inc.php

示例11: umc_mail_send_backend

function umc_mail_send_backend($recipient_uuid, $sender_uuid, $message_raw, $subject_raw, $action, $msg_id = false)
{
    $recipient = umc_mysql_real_escape_string($recipient_uuid);
    $sender = umc_mysql_real_escape_string($sender_uuid);
    $message = umc_mysql_real_escape_string($message_raw);
    $subject = umc_mysql_real_escape_string($subject_raw);
    $status = 'draft';
    if ($action == 'Send') {
        $status = 'sent';
    }
    if (isset($msg_id)) {
        $sql = "UPDATE minecraft_srvr.user_mail\r\n            SET `sender_uuid`={$sender}, `recipient_uuid`={$recipient}, `title`={$subject}, `message`={$message}, `status`='{$status}', `date_time`=NOW()\r\n            WHERE msg_id={$msg_id};";
    } else {
        $sql = "INSERT INTO minecraft_srvr.user_mail (`sender_uuid`, `recipient_uuid`, `title`, `message`, `status`, `date_time`)\r\n            VALUES ({$sender},{$recipient},{$subject},{$message},'{$status}', NOW());";
    }
    umc_mysql_query($sql, true);
    if ($action == 'Send') {
        $mail_id = umc_mysql_insert_id();
        umc_mail_send_alert($mail_id);
    }
}
开发者ID:dani0010,项目名称:uncovery_me,代码行数:21,代码来源:mail.inc.php

示例12: umc_shop_transaction_record

/**
 * Records a transaction in the database.
 *
 * @param type $from
 * @param type $to
 * @param type $amount
 * @param type $value
 * @param type $item
 * @param type $type
 * @param type $meta
 */
function umc_shop_transaction_record($from, $to, $amount, $value, $item, $type = 0, $meta = '')
{
    global $UMC_DATA_ID2NAME;
    XMPP_ERROR_trace(__FUNCTION__, func_get_args());
    // make sure we have UUIDs
    $from_uuid = umc_uuid_getone($from, 'uuid');
    $to_uuid = umc_uuid_getone($to, 'uuid');
    // make sure we have item names
    if (is_numeric($item)) {
        $item_name = $UMC_DATA_ID2NAME[$item];
    } else {
        $item_name = $item;
    }
    $ins_sql = "INSERT INTO minecraft_iconomy.`transactions` (`damage`, `buyer_uuid`, `seller_uuid`, `item_name`, `cost`, `amount`, `meta`)\r\n        VALUES ('{$type}', '{$to_uuid}', '{$from_uuid}', '{$item_name}', '{$value}', '{$amount}', '{$meta}');";
    umc_mysql_query($ins_sql, true);
}
开发者ID:psiber-on-uncovery,项目名称:uncovery_me,代码行数:27,代码来源:shop_common.php

示例13: umc_vote_web

function umc_vote_web()
{
    XMPP_ERROR_trace(__FUNCTION__, func_get_args());
    global $vote_ranks, $UMC_DOMAIN, $UMC_USER;
    $lvl_percent = array('a' => 0.3, 'd' => 0.4, 'm' => 0.7, 'e' => 1);
    $out = umc_vote_stats();
    // return "<h1>Sorry, due to technical issues, voting is temporarily suspended</h1>";
    if (!$UMC_USER) {
        $out = "Please <a href=\"{$UMC_DOMAIN}/wp-login.php\">login</a> to vote!";
        return $out;
    } else {
        $out .= "<h2>Proposals & Votes</h2>";
        $username = $UMC_USER['username'];
        $uuid = $UMC_USER['uuid'];
        $user_lvl = $UMC_USER['userlevel'];
    }
    $user_lvl_id = $vote_ranks[$user_lvl]['lvl'];
    if ($user_lvl_id < 3) {
        // start voting only for designers
        return "Sorry, you need to be Designer or above to vote!";
    }
    // get user numbers for levels
    $lvl_str_arr = array('a' => "'Architect', 'ArchitectDonator', 'ArchitectDonatorPlus'", 'd' => "'Designer', 'DesignerDonator', 'DesignerDonatorPlus'", 'm' => "'Master', 'MasterDonator', 'MasterDonatorPlus'", 'e' => "'Elder', 'ElderDonator', 'ElderDonatorPlus'");
    $lvl_amounts = array('a' => 0, 'd' => 0, 'm' => 0, 'e' => 0);
    $lvl_min_req = array('a' => 0, 'd' => 0, 'm' => 0, 'e' => 0);
    foreach ($lvl_str_arr as $lvl_code => $lvl_str) {
        // This takes all lots where the owners are in one of the user 4 levels that can vote
        $sql = "SELECT user_id, UUID.UUID as uuid, username FROM `minecraft_worldguard`.`region_players`\r\n            LEFT JOIN minecraft_worldguard.user ON region_players.user_id=user.id\r\n            LEFT JOIN minecraft_srvr.UUID ON minecraft_worldguard.user.uuid=minecraft_srvr.UUID.UUID\r\n            LEFT JOIN minecraft_srvr.permissions_inheritance ON minecraft_srvr.UUID.UUID=minecraft_srvr.permissions_inheritance.child\r\n            WHERE parent IN ({$lvl_str}) AND type=1 AND owner=1 GROUP BY user_id;";
        $C = umc_mysql_fetch_all($sql);
        // count all the people in the userlevel to know how many votes are needed
        $lvl_amounts[$lvl_code] = count($C);
    }
    // calc needed votes
    $full_vote = $lvl_amounts['e'] * $vote_ranks['Elder']['vote'];
    foreach ($lvl_amounts as $lvl => $lvl_amount) {
        $lvl_min_req[$lvl] = round($full_vote * $lvl_percent[$lvl]);
    }
    // TODO insert here a cleanup process that deletes old votes of non-promoted users
    $proposed = filter_input(INPUT_POST, 'proposal', FILTER_SANITIZE_STRING);
    if (isset($proposed) && strlen($proposed) > 1) {
        $proposed = umc_check_user($proposed);
        if (!$proposed) {
            $out .= "Sorry {$username}, but you need to input an existing user to propose!";
        } else {
            $proposed_data = umc_uuid_getboth($proposed, 'username');
            $proposed_username = $proposed_data['username'];
            $proposed_uuid = $proposed_data['uuid'];
            // what user level is it?
            $prop_lvl = umc_get_uuid_level($proposed_uuid);
            $prop_lvl_id = $vote_ranks[$prop_lvl]['lvl'];
            // check if the user was recently promoted
            $sql = "SELECT UNIX_TIMESTAMP(`date`) as mysql_ts FROM minecraft_srvr.proposals  WHERE `uuid` LIKE '{$proposed_uuid}' ORDER BY `date` DESC;";
            $D = umc_mysql_fetch_all($sql);
            $row = array();
            if (count($D) > 0) {
                $row = $D[0];
                // get the first (latest) entry
            } else {
                $row['mysql_ts'] = 0;
            }
            if (time() - $row['mysql_ts'] < 5270400) {
                $out .= "<strong>Sorry {$username}, but {$proposed_username} was last proposed for promotion less than 2 months ago!</strong>";
            } else {
                if ($user_lvl_id < 6 && $user_lvl_id < $prop_lvl_id + 1) {
                    $out .= "<strong>Sorry {$username}, but you need to be at a higher level to propose {$proposed_username} for a higher rank!</strong>";
                } else {
                    if ($prop_lvl_id > 5) {
                        $out .= "<strong>Sorry {$username}, but {$proposed_username} has reached max level already!</strong>";
                    } else {
                        if (umc_user_countlots($proposed) < 1) {
                            // is this an active user?
                            $out .= "<strong>Sorry {$username}, but you can only propose users who have a lot!</strong>";
                        } else {
                            if ($prop_lvl_id < 2) {
                                $out .= "<strong>Sorry {$username}, but you can only propose users who are at least Citizen level!</strong>";
                            } else {
                                if ($username == $proposed) {
                                    $out .= "<strong>Sorry {$username}, but you cannot propose yourself!</strong>";
                                } else {
                                    // ok to be promoted
                                    $ins_proposal_sql = "INSERT INTO `minecraft_srvr`.`proposals` (`pr_id`, `uuid`, `proposer_uuid`, `date`, `status`)\r\n                    VALUES (NULL, '{$proposed_uuid}', '{$uuid}', NOW(), 'voting');";
                                    umc_mysql_query($ins_proposal_sql);
                                    $pr_id = umc_mysql_insert_id();
                                    $sql = "INSERT INTO minecraft_srvr.`proposals_votes` (`pr_id`, `voter_uuid`, `date`, `vote`) VALUES ({$pr_id}, '{$uuid}', NOW(), 1);";
                                    umc_mysql_query($sql, true);
                                    $out .= "Thanks {$username}, {$proposed_username} as been submitted for voting, and your vote has been set, too!";
                                    if ($prop_lvl_id == 5) {
                                        // we propose a Master for promotion, inform all elders
                                        $sql = "SELECT user_email, UUID, username FROM minecraft_srvr.`UUID`\r\n                        LEFT JOIN minecraft.wp_usermeta ON UUID.UUID=meta_value\r\n                        LEFT JOIN minecraft.wp_users ON user_id=ID\r\n                        WHERE `userlevel` LIKE 'Elder%' AND lot_count > 0";
                                        $D = umc_mysql_fetch_all($sql);
                                        $subject = "{$proposed} proposed for Elder, please vote!";
                                        $content = "Dear Elder, \r\n\r\nthe user {$proposed} has been proposed to be promoted to Elder. Please go to\r\n\r\n{$UMC_DOMAIN}/vote-for-users/\r\n\r\n" . "and vote on this proposal. Please either SUPPORT or VETO the proposal.\r\n" . "Please note that the vote will be closed as 'failed' unless all Elders cast a vote within the coming 2 months.\r\n" . "Thanks a lot for supporting Uncovery Minecraft!\r\n\r\nBest regards,\r\nUncovery";
                                        $headers = 'From:minecraft@uncovery.me' . "\r\nReply-To:minecraft@uncovery.me\r\n" . 'X-Mailer: PHP/' . phpversion();
                                        mail('minecraft@uncovery.me', $subject, $content, $headers);
                                        foreach ($D as $row) {
                                            mail($row['user_email'], '[Uncovery Minecraft] ' . $subject, $content, $headers);
                                            umc_mail_send_backend($row['UUID'], 'ab3bc877-4434-45a9-93bd-bab6df41eabf', $content, $subject, 'send');
                                            // send from uncovery's UUID
                                        }
                                    }
//.........这里部分代码省略.........
开发者ID:psiber-on-uncovery,项目名称:uncovery_me,代码行数:101,代码来源:vote.inc.php

示例14: 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:");
    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'];
    }
    XMPP_ERROR_trace("ts_uuid", $ts_uuid);
    umc_echo("Connecting to TS server.");
    umc_ts_connect(true);
    // find the TS user by that TS UUID
    umc_echo("Searching for you on the TS server.");
    try {
        $ts_Clients_match = $UMC_TEAMSPEAK['server']->clientFindDb($ts_uuid, true);
    } catch (TeamSpeak3_Exception $e) {
        XMPP_ERROR_trace("Error ", $e->getCode() . ": " . $e->getMessage());
        $ts_Clients_match = 0;
    }
    if (count($ts_Clients_match) > 0) {
        XMPP_ERROR_trace("ts_Clients_match", $ts_Clients_match);
        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));
        XMPP_ERROR_trace("servergroups", $servergroups);
        // remove all servergroups except 8 (Guest)
        umc_echo("Removing all old usergroups:");
        foreach ($servergroups as $sgid) {
            if ($sgid != 8) {
                XMPP_ERROR_trace("Deleting group", $sgid);
                $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}';";
        XMPP_ERROR_trace("removing uuid from DB", $ts_uuid);
        umc_mysql_query($ins_sql, true);
        return true;
    } else {
        XMPP_ERROR_trace("Prev UUID not found");
        if ($echo) {
            umc_echo("Old Client: Previous TS UUID was invalid, nothing to do");
        }
        return false;
    }
}
开发者ID:psiber-on-uncovery,项目名称:uncovery_me,代码行数:67,代码来源:teamspeak.inc.php

示例15: umc_timer_get

function umc_timer_get($user, $type)
{
    // check if a timer is set
    $sql = "SELECT time_out FROM minecraft_srvr.timers WHERE username='{$user}' AND type='{$type}';";
    $D = umc_mysql_fetch_all($sql);
    if (count($D) > 0) {
        // no, check if timed out
        $date_now = umc_datetime();
        // substract the current day
        $date_row = umc_datetime($D[0]['time_out']);
        // difference in seconds ofr check
        $diff = $date_row->getTimestamp() - $date_now->getTimestamp();
        if ($diff > 0) {
            return $date_row;
        } else {
            $sql_del = "DELETE FROM minecraft_srvr.timers WHERE username='{$user}' AND type='{$type}';";
            umc_log('timer', 'removed', "{$type} timer for {$user}");
            umc_mysql_query($sql_del, true);
            return false;
        }
    } else {
        return false;
        // no such timer set
    }
}
开发者ID:dani0010,项目名称:uncovery_me,代码行数:25,代码来源:timer.inc.php


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