本文整理汇总了PHP中connect::selectDB方法的典型用法代码示例。如果您正苦于以下问题:PHP connect::selectDB方法的具体用法?PHP connect::selectDB怎么用?PHP connect::selectDB使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类connect
的用法示例。
在下文中一共展示了connect::selectDB方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
public static function init($type)
{
if ($GLOBALS['enablePlugins'] == true) {
if ($_SESSION['loaded_plugins'] != NULL) {
$bad = array('.', '..', 'index.html');
$loaded = array();
foreach ($_SESSION['loaded_plugins'] as $folderName) {
connect::selectDB('webdb');
$chk = mysql_query("SELECT COUNT(*) FROM disabled_plugins WHERE foldername='" . mysql_real_escape_string($folderName) . "'");
if (mysql_result($chk, 0) == 0 && file_exists('plugins/' . $folderName . '/' . $type . '/')) {
$folder = scandir('plugins/' . $folderName . '/' . $type . '/');
foreach ($folder as $fileName) {
if (!in_array($fileName, $bad)) {
$loaded[] = 'plugins/' . $folderName . '/' . $type . '/' . $fileName;
}
}
$_SESSION['loaded_plugins_' . $type] = $loaded;
}
}
}
}
}
示例2: mysql_query
$result = mysql_query("SELECT guid, name, totalKills, level, race, class, gender, account FROM characters WHERE name!='' \r\n\t\t\t\t\t\t\t\t AND online=1");
}
while ($row = mysql_fetch_assoc($result)) {
connect::connectToRealmDB($rid);
$getGuild = mysql_query("SELECT guildid FROM guild_member WHERE guid='" . $row['guid'] . "'");
if (mysql_num_rows($getGuild) == 0) {
$guild = "None";
} else {
$g = mysql_fetch_assoc($getGuild);
$getGName = mysql_query("SELECT name FROM guild WHERE guildid='" . $g['guildid'] . "'");
$x = mysql_fetch_assoc($getGName);
$guild = '< ' . $x['name'] . ' >';
}
if ($GLOBALS['playersOnline']['display_GMS'] == false) {
//Check if GM.
connect::selectDB('logondb');
$checkGM = mysql_query("SELECT COUNT(*) FROM account_access WHERE id='" . $row['account'] . "' AND gmlevel >0");
if (mysql_result($checkGM, 0) == 0) {
echo '<tr style="text-align: center;">
<td>' . $row['name'] . '</td>
<td>' . $guild . '</td>
<td>' . $row['totalKills'] . '</td>
<td>' . $row['level'] . '</td>
</tr>';
}
} else {
echo '<tr style="text-align: center;">
<td>' . $row['name'] . '</td>
<td>' . $guild . '</td>
<td>' . $row['totalKills'] . '</td>
<td>' . $row['level'] . '</td>
示例3: logThis
public static function logThis($desc, $service, $realmid)
{
$desc = mysql_real_escape_string($desc);
$realmid = (int) $realmid;
$service = mysql_real_escape_string($service);
$account = (int) $_SESSION['cw_user_id'];
connect::selectDB('webdb');
mysql_query("INSERT INTO user_log VALUES(NULL,'" . $account . "','" . $service . "','" . time() . "','" . $_SERVER['REMOTE_ADDR'] . "','" . $realmid . "','" . $desc . "')");
}
示例4: account
}
$account = new account();
$account->getRemember();
//Remember thingy.
//This is to prevent the error "Undefined index: p"
if (!isset($_GET['p'])) {
$_GET['p'] = 'home';
}
###VOTING SYSTEM####
if (isset($_SESSION['votingUrlID']) && $_SESSION['votingUrlID'] != 0 && $GLOBALS['vote']['type'] == 'confirm') {
if (website::checkIfVoted((int) $_SESSION['votingUrlID'], $GLOBALS['connection']['webdb']) == TRUE) {
die("?p=vote");
}
$acct_id = account::getAccountID($_SESSION['cw_user']);
$next_vote = time() + $GLOBALS['vote']['timer'];
connect::selectDB('webdb');
mysql_query("INSERT INTO votelog VALUES('','" . (int) $_SESSION['votingUrlID'] . "',\n\t'" . $acct_id . "','" . time() . "','" . $next_vote . "','" . $_SERVER['REMOTE_ADDR'] . "')");
$getSiteData = mysql_query("SELECT points,url FROM votingsites WHERE id='" . (int) $_SESSION['votingUrlID'] . "'");
$row = mysql_fetch_assoc($getSiteData);
if (mysql_num_rows($getSiteData) == 0) {
header('Location: index.php');
unset($_SESSION['votingUrlID']);
exit;
}
//Update the points table.
$add = $row['points'] * $GLOBALS['vote']['multiplier'];
mysql_query("UPDATE account_data SET vp=vp + " . $add . " WHERE id=" . $acct_id);
unset($_SESSION['votingUrlID']);
header("Location: ?p=vote");
exit;
}
示例5: elseif
<?php
if ($GLOBALS['service'][$service]['currency'] == "vp") {
echo "<span class='currency'>Vote Points: " . account::loadVP($_SESSION['cw_user']) . "</span>";
} elseif ($GLOBALS['service'][$service]['currency'] == "dp") {
echo "<span class='currency'>" . $GLOBALS['donation']['coins_name'] . ": " . account::loadDP($_SESSION['cw_user']) . "</span>";
}
}
account::isNotLoggedIn();
connect::selectDB('webdb');
$num = 0;
$result = mysql_query('SELECT char_db,name FROM realms ORDER BY id ASC');
while ($row = mysql_fetch_assoc($result)) {
$acct_id = account::getAccountID($_SESSION['cw_user']);
$realm = $row['name'];
$char_db = $row['char_db'];
connect::selectDB($char_db);
$result = mysql_query('SELECT name,guid,gender,class,race,level,online FROM characters WHERE account=' . $acct_id);
while ($row = mysql_fetch_assoc($result)) {
?>
<div class='charBox'>
<table width="100%">
<tr>
<td width="73">
<?php
if (!file_exists('styles/global/images/portraits/' . $row['gender'] . '-' . $row['race'] . '-' . $row['class'] . '.gif')) {
echo '<img src="styles/' . $GLOBALS['template']['path'] . '/images/unknown.png" />';
} else {
?>
<img src="styles/global/images/portraits/
<?php
echo $row['gender'] . '-' . $row['race'] . '-' . $row['class'];
示例6: mysql_query
</table>
</form>
<?php
}
if (isset($_POST['ir_step3'])) {
$guid = (int) $_POST['ir_char'];
$instance = (int) $_POST['ir_instance'];
if ($GLOBALS['service'][$service]['currency'] == "vp") {
if (account::hasVP($_SESSION['cw_user'], $GLOBALS['service'][$service]['price']) == FALSE) {
echo '<span class="alert">You do not have enough Vote Points!';
} else {
connect::selectDB($_POST['ir_realm']);
mysql_query("DELETE FROM instance WHERE id='" . $instance . "'");
account::deductVP(account::getAccountID($_SESSION['cw_user']), $GLOBALS['service'][$service]['price']);
echo '<span class="approved">The instance lock was removed!</span>';
}
} elseif ($GLOBALS['service'][$service]['currency'] == "dp") {
if (account::hasDP($_SESSION['cw_user'], $GLOBALS['service'][$service]['price']) == FALSE) {
echo '<span class="alert">You do not have enough ' . $GLOBALS['donation']['coins_name'];
} else {
connect::selectDB($_POST['ir_realm']);
mysql_query("DELETE FROM instance WHERE id='" . $instance . "'");
account::deductDP(account::getAccountID($_SESSION['cw_user']), $GLOBALS['service'][$service]['price']);
echo '<span class="approved">The instance lock was removed!</span>';
account::logThis("Performed an Instance reset on " . character::getCharName($guid, server::getRealmId($_POST['ir_realm'])), "instancereset", server::getRealmId($_POST['ir_realm']));
}
}
}
?>
<br/>
<a href="?p=instancereset">Start over</a>
示例7: checkIfVoted
public static function checkIfVoted($siteid)
{
$siteid = (int) $siteid;
$acct_id = account::getAccountID($_SESSION['cw_user']);
connect::selectDB('webdb');
$result = mysql_query("SELECT COUNT(id) FROM votelog\n\t\tWHERE userid='" . $acct_id . "' AND siteid='" . $siteid . "' AND next_vote > " . time());
if (mysql_result($result, 0) == 0) {
return FALSE;
} else {
return TRUE;
}
}
示例8: logItem
public function logItem($shop, $entry, $char_id, $account, $realm_id, $amount)
{
connect::selectDB('webdb');
date_default_timezone_set($GLOBALS['timezone']);
mysql_query("INSERT INTO shoplog VALUES (NULL,'" . (int) $entry . "','" . (int) $char_id . "','" . date("Y-m-d H:i:s") . "',\n\t\t'" . $_SERVER['REMOTE_ADDR'] . "','" . mysql_real_escape_string($shop) . "','" . (int) $account . "','" . (int) $realm_id . "','" . (int) $amount . "')");
}
示例9: IN
</table>
<?php
}
if (isset($_SESSION['voteCart']) && !empty($_SESSION['voteCart'])) {
$counter = 1;
echo '<h3>Vote Shop</h3>';
$sql = "SELECT * FROM shopitems WHERE entry IN(";
foreach ($_SESSION['voteCart'] as $entry => $value) {
if ($_SESSION['voteCart'][$entry]['quantity'] != 0) {
$sql .= $entry . ',';
connect::selectDB($GLOBALS['connection']['worlddb']);
$result = mysql_query("SELECT maxcount FROM item_template WHERE entry='" . $entry . "' AND maxcount>0");
if (mysql_result($result, 0) != 0) {
$_SESSION['voteCart'][$entry]['quantity'] = 1;
}
connect::selectDB($GLOBALS['connection']['webdb']);
}
}
$sql = substr($sql, 0, -1) . ") AND in_shop='vote' ORDER BY `itemlevel` ASC";
$query = mysql_query($sql);
?>
<table width="100%" >
<tr id="cartHead"><th>Name</th><th>Quantity</th><th>Price</th><th>Actions</th></tr>
<?php
while ($row = mysql_fetch_array($query)) {
?>
<tr align="center">
<td><a href="http://<?php
echo $GLOBALS['tooltip_href'];
?>
item=<?php
示例10: serverStatus
public static function serverStatus($realm_id)
{
//Get status
$fp = fsockopen($GLOBALS['realms'][$realm_id]['host'], $GLOBALS['realms'][$realm_id]['port'], $errno, $errstr, 1);
if (!$fp) {
echo $status = '<h4 class="realm_status_title_offline">' . $GLOBALS['realms'][$realm_id]['name'] . ' - Offline</h4>';
} else {
echo $status = '<h4 class="realm_status_title_online">' . $GLOBALS['realms'][$realm_id]['name'] . ' - Online</h4>';
echo '<span class="realm_status_text">';
/* Players online bar */
if ($GLOBALS['serverStatus']['factionBar'] == TRUE) {
connect::connectToRealmDB($realm_id);
$getChars = mysql_query("SELECT COUNT(online) FROM characters WHERE online=1");
$total_online = mysql_result($getChars, 0);
$getAlliance = mysql_query("SELECT COUNT(online) FROM characters WHERE online=1 AND race IN('3','4','7','11','1','22')");
$alliance = mysql_result($getAlliance, 0);
$getHorde = mysql_query("SELECT COUNT(online) FROM characters WHERE online=1 AND race IN('2','5','6','8','10','9')");
$horde = mysql_result($getHorde, 0);
if ($total_online == 0) {
$per_alliance = 50;
$per_horde = 50;
} else {
if ($alliance == 0) {
$per_alliance = 0;
} else {
$per_alliance = round($alliance / $total_online * 100);
}
if ($horde == 0) {
$per_horde = 0;
} else {
$per_horde = round($horde / $total_online * 100);
}
}
if ($per_alliance + $per_horde > 100) {
$per_horde = $per_horde - 1;
}
?>
<div class='srv_status_po'>
<div class='srv_status_po_alliance' style="width: <?php
echo $per_alliance;
?>
%;"></div>
<div class='srv_status_po_horde' style="width: <?php
echo $per_horde;
?>
%;"></div>
<div class='srv_status_text'>Alliance: <?php
echo $alliance;
?>
Horde: <?php
echo $horde;
?>
</div>
</div>
<?php
}
echo '<table width="100%"><tr>';
//Get players online
if ($GLOBALS['serverStatus']['playersOnline'] == TRUE) {
connect::connectToRealmDB($realm_id);
$getChars = mysql_query("SELECT COUNT(online) FROM characters WHERE online=1");
$pOnline = mysql_result($getChars, 0);
echo '<td>
<b>', $pOnline, '</b> Players online
</td>';
}
//Get uptime
if ($GLOBALS['serverStatus']['uptime'] == TRUE) {
connect::selectDB('logondb');
$getUp = mysql_query("SELECT starttime FROM uptime WHERE realmid='" . $realm_id . "' ORDER BY starttime DESC LIMIT 1");
$row = mysql_fetch_assoc($getUp);
$time = time();
$uptime = $time - $row['starttime'];
echo '
<td>
<b>' . convTime($uptime) . '</b> uptime
</td>
</tr>';
}
}
if ($GLOBALS['serverStatus']['nextArenaFlush'] == TRUE) {
//Arena flush
connect::connectToRealmDB($realm_id);
$getFlush = mysql_query("SELECT value FROM worldstates WHERE comment='NextArenaPointDistributionTime'");
$row = mysql_fetch_assoc($getFlush);
$flush = date('d M H:i', $row['value']);
echo '<tr>
<td>
Next arena flush: <b>' . $flush . '</b>
</td>';
}
echo '</tr>
</table>
</span>';
}