本文整理汇总了PHP中SQL::fetch_assoc方法的典型用法代码示例。如果您正苦于以下问题:PHP SQL::fetch_assoc方法的具体用法?PHP SQL::fetch_assoc怎么用?PHP SQL::fetch_assoc使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SQL
的用法示例。
在下文中一共展示了SQL::fetch_assoc方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_additional_data
/**
* calculate creature health, mana and armor
*
* kinda crappy way, but works
*
* if $type is used:
* 1 -> returns health
* 2 -> returns mana
* 3 -> returns armor
* 0 -> returns array(health,mana,armor)
*/
function get_additional_data($entryid, $type = 0)
{
global $world_db, $realm_id;
if (!is_numeric($entryid)) {
return array(0, 0, 0);
}
$sqlw = new SQL();
$sqlw->connect($world_db[$realm_id]['addr'], $world_db[$realm_id]['user'], $world_db[$realm_id]['pass'], $world_db[$realm_id]['name']);
$q = $sqlw->query("\n\t\tSELECT \n\t\t\t(SELECT unit_class \n\t\t\tFROM creature_template \n\t\t\tWHERE entry = " . $entryid . ") AS class, \n\t\t\t\t(SELECT FLOOR(minlevel + (RAND() * (maxlevel - minlevel + 1))) \n\t\t\t\tFROM creature_template \n\t\t\t\tWHERE entry = " . $entryid . ") AS level, \n\t\t\t\t(SELECT exp \n\t\t\t\tFROM creature_template \n\t\t\t\tWHERE entry = " . $entryid . ") AS exp;");
$data = $sqlw->fetch_assoc($q);
if ($sqlw->num_rows($q) == 0) {
return array(0, 0, 0);
}
$q = "\n\t\t\tSELECT \n\t\t\t\t((SELECT Health_Mod \n\t\t\t\tFROM creature_template \n\t\t\t\tWHERE entry = " . $entryid . ")\n\t\t\t\t\t*(SELECT basehp" . $data['exp'] . " \n\t\t\t\t\tFROM creature_classlevelstats \n\t\t\t\t\tWHERE level = " . $data['level'] . " AND class = " . $data['class'] . ")+0.5), \n\t\t\t\t((SELECT Mana_Mod \n\t\t\t\tFROM creature_template \n\t\t\t\tWHERE entry = " . $entryid . ")\n\t\t\t\t\t*(SELECT basemana \n\t\t\t\t\tFROM creature_classlevelstats \n\t\t\t\t\tWHERE level = " . $data['level'] . " AND class = " . $data['class'] . ")+0.5),\n\t\t\t\t((SELECT Armor_Mod \n\t\t\t\tFROM creature_template \n\t\t\t\tWHERE entry = " . $entryid . ")\n\t\t\t\t*(SELECT basearmor \n\t\t\t\tFROM creature_classlevelstats \n\t\t\t\tWHERE level = " . $data['level'] . " AND class = " . $data['class'] . ")+0.5);";
if ($type == 1) {
$q = "\n\t\t\tSELECT \n\t\t\t\t((SELECT Health_Mod \n\t\t\t\tFROM creature_template \n\t\t\t\tWHERE entry = " . $entryid . ")\n\t\t\t\t\t*(SELECT basehp" . $data['exp'] . " \n\t\t\t\t\tFROM creature_classlevelstats \n\t\t\t\t\tWHERE level = " . $data['level'] . " AND class = " . $data['class'] . ")+0.5);";
}
if ($type == 2) {
$q = "\n\t\t\tSELECT \n\t\t\t\t((SELECT Mana_Mod \n\t\t\t\tFROM creature_template \n\t\t\t\tWHERE entry = " . $entryid . ")\n\t\t\t\t\t*(SELECT basemana \n\t\t\t\t\tFROM creature_classlevelstats \n\t\t\t\t\tWHERE level = " . $data['level'] . " AND class = " . $data['class'] . ")+0.5);";
}
if ($type == 3) {
$q = "\n\t\t\tSELECT \n\t\t\t\t((SELECT Armor_Mod \n\t\t\t\tFROM creature_template \n\t\t\t\tWHERE entry = " . $entryid . ")\n\t\t\t\t\t*(SELECT basearmor \n\t\t\t\t\tFROM creature_classlevelstats \n\t\t\t\t\tWHERE level = " . $data['level'] . " AND class = " . $data['class'] . ")+0.5);";
}
$query = $sqlw->query($q);
$result = $sqlw->fetch_row($query);
$sqlw->close();
unset($sql);
if ($type == 2 && $result[0] == 0.5) {
return 0;
}
if ($type == 0 && $result[1] == 0.5) {
return array($result[0], 0, $result[2]);
}
return $type > 0 ? $result[0] : $result;
}
示例2: print_commands_form
function print_commands_form()
{
global $output, $lang_command, $realm_id, $world_db, $action_permission, $user_lvl, $gm_level_arr;
$levels = $gm_level_arr;
$sqlw = new SQL();
$sqlw->connect($world_db[$realm_id]['addr'], $world_db[$realm_id]['user'], $world_db[$realm_id]['pass'], $world_db[$realm_id]['name']);
$query = $sqlw->query('SELECT name, help, security FROM command WHERE security <= ' . $user_lvl . '');
while ($data = $sqlw->fetch_assoc($query)) {
$comm = explode("\r\n", $data['help'], 2);
$levels[$data['security']][3] .= '
<tr>
' . ($user_lvl >= $action_permission['update'] ? '<td><input type="checkbox" name="check[' . $data['name'] . ']" value="' . $data['security'] . '" /></td>' : '<td></td>') . '
<td align="left">' . $data['name'] . '</td>
<td>' . htmlentities(ereg_replace("[a-zA-Z ]+:* *\\.", ".", $comm[0])) . '</td>
<td>' . (isset($comm[1]) ? str_replace("\r\n", "<br />", str_replace("\r\n\r\n", "<br />", htmlentities($comm[1]))) : '') . '</td>
</tr>';
}
unset($comm);
unset($data);
unset($query);
$output .= '
<center>
<form method="get" action="command.php" name="form">
<input type="hidden" name="action" value="update" />';
for ($i = 0; $i <= $user_lvl; ++$i) {
$output .= '
<table style="width: 720px; text-align: left;" class="lined">
<tr>
<th>
<div id="div' . $levels[$i][1] . '" onclick="expand(\'' . $levels[$i][1] . '\', this, \'' . $levels[$i][1] . '\');">[+] ' . $levels[$i][1] . ' :</div>
</th>
</tr>
</table>
<table id="' . $levels[$i][1] . '" class="lined" style="width: 720px; text-align: left; display: none">
<tr style="text-align: center;">
<th width="2%"></th>
<th width="13%">' . $lang_command['command'] . '</th>
<th width="20%">' . $lang_command['syntax'] . '</th>
<th width="65%">' . $lang_command['description'] . '</th>
</tr>' . $levels[$i][3];
if ($user_lvl >= $action_permission['update']) {
$output .= '
</table>
<br />
<table class="hidden" style="width: 720px;">
<tr>
<td>';
makebutton($lang_command['change_level'], 'javascript:do_submit()', 280);
$output .= '
</td>
</tr>';
}
$output .= '
</table>
<br />';
}
$output .= '
</form>
</center>';
}
示例3: populate_requestbox
function populate_requestbox()
{
$db = new SQL(DB_SERVER, DB_USERNAME, DB_PASSWORD, DB_NAME, false);
$db->query("SELECT COUNT(id) FROM ip_requests");
$total_request = implode($db->fetch_assoc());
$db->query("SELECT COUNT(id) FROM ip_reply");
$total_reply = implode($db->fetch_assoc());
$db->close();
echo '<div class="alert alert-info">This is <strong>User\'s Request</strong> section (currently contained <strong>' . $total_request . '</strong> request shouts and <strong>' . $total_reply . '</strong> replies). Just use <code>!request</code> code in your shout to make them appear here. Please note that not all your requests will be replied. Lucky if you have!</div>';
echo '<div id="containerx">';
echo '<div class="data"></div>';
echo '<div class="pagination"></div>';
echo '</div>';
echo '
<script>
var replyID;
$(document).ready(function () { // START DOCUMENT.READY
$(".tip-top").tooltip();
function loadData(page){
$("#containerx").html("<div class=\\"loader\\" style=\\"margin-top:10px\\"></div>").fadeIn("fast");
$.ajax({
type: "GET",
url: "subfiles/requestbox_more.php?page="+page,
success: function(msg){
$("#containerx").html(msg);
}
});
}
loadData(1); // For first time page load default results
$("#containerx .pagination li.enx").live("click",function(e){
e.preventDefault();
var page = $(this).attr("p");
loadData(page);
});
}); // END DCOUMENT.READY
</script>
';
}
示例4: del_acc
function del_acc($acc_id)
{
global $characters_db, $realm_db, $user_lvl, $user_id, $tab_del_user_realmd, $tab_del_user_char, $tab_del_user_characters, $tab_del_pet;
$del_char = 0;
$sqlc = new SQL();
$sqlr = new SQL();
$sqlr->connect($realm_db['addr'], $realm_db['user'], $realm_db['pass'], $realm_db['name']);
$query = $sqlr->query('SELECT `account`.`online`, `account_access`.`gmlevel` FROM `account` LEFT JOIN `account_access` ON `account`.`id`=`account_access`.`id` WHERE `account`.`id` = ' . $acc_id . '');
$gmlevel = $sqlr->result($query, 0, 'gmlevel');
if ($user_lvl > $gmlevel || $acc_id == $user_id) {
if ($sqlr->result($query, 0, 'online')) {
} else {
foreach ($characters_db as $db) {
$sqlc->connect($db['addr'], $db['user'], $db['pass'], $db['name']);
$result = $sqlc->query('SELECT guid
FROM characters
WHERE account = ' . $acc_id . '');
while ($row = $sqlc->fetch_assoc($result)) {
//Delete pet aura ,spells and cooldowns
foreach ($tab_del_pet as $value) {
$sqlc->query('DELETE
FROM ' . $value[0] . '
WHERE ' . $value[1] . ' IN
(SELECT id
FROM character_pet
WHERE owner IN
(SELECT guid
FROM characters
WHERE guid = ' . $row['guid'] . '))');
}
foreach ($tab_del_user_characters as $value) {
$sqlc->query('DELETE
FROM ' . $value[0] . '
WHERE ' . $value[1] . ' = ' . $row['guid'] . '');
}
$del_char++;
}
$sqlc->query('DELETE
FROM account_data
WHERE account = ' . $acc_id . '');
}
foreach ($tab_del_user_realmd as $value) {
$sqlr->query('DELETE
FROM ' . $value[0] . '
WHERE ' . $value[1] . ' = ' . $acc_id . '');
}
if ($sqlr->affected_rows()) {
return array(true, $del_char);
}
}
}
return array(false, $del_char);
}
示例5: servers
function servers()
{
global $output, $corem_db, $get_icon_type, $get_timezone_type, $core;
// we need $core to be set
if ($core == 0) {
$core = detectcore();
}
$sqlm = new SQL();
$sqlm->connect($corem_db["addr"], $corem_db["user"], $corem_db["pass"], $corem_db["name"], $corem_db["encoding"]);
$result = $sqlm->query("SELECT * FROM config_servers");
$server_action = 0;
if (isset($_GET["editserver"])) {
$server_action = "edit";
}
if (isset($_GET["delserver"])) {
$server_action = "del";
}
if (isset($_GET["addserver"])) {
$server_action = "add";
}
if (!$server_action) {
$output .= '
<div style="text-align: center;">
<span style="color:red">' . lang("admin", "server_warn") . '</span>
</div>
<form action="admin.php" method="get" id="form">
<div>
<input type="hidden" name="section" value="servers" />
</div>
<table class="simple" id="admin_servers">
<tr>
<th style="width: 5%;">' . lang("admin", "edit") . '</th>
<th style="width: 5%;">' . lang("admin", "remove") . '</th>
<th style="width: 10%;">' . lang("admin", "realm") . '</th>
<th style="width: 10%;">' . lang("admin", "name") . '</th>
<th style="width: 20%;">' . lang("admin", "hosti") . '</th>
<th style="width: 20%;">' . lang("admin", "hostp") . '</th>
<th style="width: 1%;">' . lang("admin", "port") . '</th>
<th style="width: 10%;">' . lang("admin", "icon") . '</th>
<th style="width: 10%;">' . lang("admin", "timezone") . '</th>
<th style="width: 10%;">' . lang("admin", "bothfactions") . '</th>';
if ($core == 1) {
$output .= '
<th width="40%">' . lang("admin", "statsxml") . '</th>';
}
$output .= '
</tr>';
$color = "#EEEEEE";
while ($server = $sqlm->fetch_assoc($result)) {
$output .= '
<tr>
<td style="background-color:' . $color . '; text-align: center;">
<span>
<a href="admin.php?section=servers&sel_server=' . $server["Index"] . '&editserver=editserver">
<img src="img/edit.png" alt="" />
</a>
</span>
</td>
<td style="background-color:' . $color . '; text-align: center;">
<span>
<a href="admin.php?section=servers&sel_server=' . $server["Index"] . '&delserver=deleteserver">
<img src="img/aff_cross.png" alt="" />
</a>
</span>
</td>
<td style="background-color:' . $color . '; text-align: center;">
<span>' . $server["Index"] . '</span>
</td>
<td style="background-color:' . $color . '; text-align: center;">
<span>' . $server["Name"] . '</span>
</td>
<td style="background-color:' . $color . '; text-align: center;">
<span>' . $server["Address"] . '</span>
</td>
<td style="background-color:' . $color . '; text-align: center;">
<span>' . $server["External_Address"] . '</span>
</td>
<td style="background-color:' . $color . '; text-align: center;">
<span>' . $server["Port"] . '</span>
</td>';
$icon = $get_icon_type[$server["Icon"]];
$timezone = $get_timezone_type[$server["Timezone"]];
$output .= '
<td style="background-color:' . $color . '; text-align: center;">
<span>' . lang("realm", $icon[1]) . '</span>
</td>
<td style="background-color:' . $color . '; text-align: center;">
<span>' . lang("realm", $timezone[1]) . '</span>
</td>
<td style="background-color:' . $color . '; text-align: center;">
<span>' . ($server["Both_Factions"] ? lang("global", "yes_low") : lang("global", "no_low")) . '</span>
</td>';
if ($core == 1) {
$output .= '
<td style="background-color:' . $color . '; text-align: center;">
<span>' . $server["Stats_XML"] . '</span>
</td>';
}
$output .= '
</tr>';
//.........这里部分代码省略.........
示例6: unset
if ($allow_anony && empty($_SESSION['logged_in'])) {
$lang_login = lang_login();
$output .= '
<li><a href="#">' . $lang_header['account'] . '</a></li>
<li><a href="register.php">' . $lang_login['not_registrated'] . '</a></li>
<li><a href="login.php">' . $lang_login['login'] . '</a></li>';
unset($lang_login);
} else {
$result = $sqlc->query('SELECT guid, name, race, class, level, gender
FROM characters
WHERE account = ' . $user_id . '');
// this puts links to user characters of active realm in "My Account" menu
if ($sqlc->num_rows($result)) {
$output .= '
<li><a href="#">' . $lang_header['my_characters'] . '</a></li>';
while ($char = $sqlc->fetch_assoc($result)) {
$output .= '
<li>
<a href="char.php?id=' . $char['guid'] . '">
<img src="img/c_icons/' . $char['race'] . '-' . $char['gender'] . '.gif" alt="" /><img src="img/c_icons/' . $char['class'] . '.gif" alt="" />' . $char['name'] . '
</a>
</li>';
}
unset($char);
}
$output .= '
<li><a href="#">' . $lang_header['account'] . '</a></li>
<li><a href="edit.php">' . $lang_header['edit_my_acc'] . '</a></li>
<li><a href="logout.php">' . $lang_header['logout'] . '</a></li>';
}
unset($result);
示例7: SQL
// please restore <code>\'scripts/config.dist.php\'</code></center>');
require_once 'scripts/config.php';
//}
//else
// exit('<center><br><code>\'scripts/config.php\'</code> not found,<br>
// please copy <code>\'scripts/config.dist.php\'</code> to
// <code>\'scripts/config.php\'</code> and make appropriate changes.');
require_once 'libs/db_lib.php';
require_once 'libs/global_lib.php';
require_once 'libs/spell_lib.php';
//header('Expires: Tue, 01 Jan 2000 00:00:00 GMT');
//header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
//header('Cache-Control: no-store, no-cache, must-revalidate, max-age=0');
//header('Cache-Control: post-check=0, pre-check=0', false);
//header('Pragma: no-cache');
//wowhead_tt();
//echo $output;
$sqlm = new SQL();
$sqlm->connect($mmfpm_db['addr'], $mmfpm_db['user'], $mmfpm_db['pass'], $mmfpm_db['name']);
$result = $sqlm->query('select spellID from dbc_spell order by spellID ASC');
$i = 0;
while ($entry = $sqlm->fetch_assoc($result)) {
if (spell_get_icon($entry['spellID'], $sqlm) == 'img/INV/INV_blank_32.gif') {
//echo '<a href="'.$spell_datasite.$entry['spellID'].'"><img src="'.spell_get_icon($entry['spellID'], $sqlm).'" /></a>';
spell_get_icon($entry['spellID'], $sqlm);
echo $entry['spellID'] . ' ';
} else {
++$i;
}
}
echo $i;
示例8: rtrim
$url = $sls['sharerurl'];
$removehttp = str_replace('http://', '', $url);
$removeslash = rtrim($removehttp, '/');
if (strpos($removeslash, ':') !== false) {
list($ip, $port) = explode(":", $removeslash);
} else {
$ip = $removeslash;
$port = 80;
}
}
if (fsockopen($ip, $port, $errno, $errstr, 5) !== false) {
echo '1';
$dbsls->query("UPDATE ip_sharerlinks SET status='1' WHERE id='{$sharerLinkID}'");
} else {
echo '0';
$dbsls->query("UPDATE ip_sharerlinks SET status='0' WHERE id='{$sharerLinkID}'");
}
$dbsls->close();
} else {
if (isset($_GET['state'])) {
$dbcs = new SQL(DB_SERVER, DB_USERNAME, DB_PASSWORD, DB_NAME, false);
$dbcs->query("SELECT * FROM ip_sharerlinks ORDER BY status");
while ($getr = $dbcs->fetch_assoc()) {
$state = $getr['status'];
echo $state;
}
$dbcs->close();
} else {
echo '404';
}
}
示例9: del_acc
function del_acc($acc_id)
{
global $characters_db, $logon_db, $corem_db, $realm_id, $user_lvl, $user_id, $tab_del_user_realmd, $tab_del_user_char, $tab_del_user_characters, $sql, $core;
$del_char = 0;
// get username name to delete from account table
if ($core == 1) {
$query = $sql["logon"]->query("SELECT login AS username FROM accounts WHERE acct='" . $acc_id . "'");
} else {
$query = $sql["logon"]->query("SELECT username FROM account WHERE id='" . $acc_id . "'");
}
$acct_name = $sql["logon"]->result($query, 0, "username");
// get the account's owner's SecurityLevel (not 100% perfect since we don't use the core gm)
$query = $sql["mgr"]->query("SELECT SecurityLevel FROM config_accounts WHERE Login='" . $acct_name . "'");
$gmlevel = $sql["mgr"]->result($query, 0, "SecurityLevel");
if ($user_lvl >= gmlevel($gmlevel) || $acc_id == $user_id) {
if ($core == 1) {
$char_count_query = "SELECT COUNT(*) FROM characters WHERE acct='" . $acct_id . "'";
} else {
$char_count_query = "SELECT COUNT(*) FROM characters WHERE account='" . $acct_id . "'";
}
$online = $sql["char"]->result($sql["char"]->query($char_count_query), 0);
if (!$online > 0) {
foreach ($characters_db as $db) {
$sqlx = new SQL();
$sqlx->connect($db["addr"], $db["user"], $db["pass"], $db["name"], $db["encoding"]);
if ($core == 1) {
$result = $sqlx->query("SELECT guid FROM characters WHERE acct='" . $acc_id . "'");
} else {
$result = $sqlx->query("SELECT guid FROM characters WHERE account='" . $acc_id . "'");
}
while ($row = $sqlx->fetch_assoc($result)) {
$temp = del_char($row["guid"], $db["id"]);
$del_char++;
}
// MaNGOS: Delete character_tutorial
if ($core == 2) {
$sqlx->query("DELETE FROM character_tutorial WHERE account='" . $owner_acc_id . "'");
}
// Trinity: Delete account_tutorial
if ($core == 3) {
$sqlx->query("DELETE FROM account_tutorial WHERE accountId='" . $owner_acc_id . "'");
}
// ArcEmu: Delete account_data for this user
if ($core == 1) {
$sqlx->query("DELETE FROM account_data WHERE acct='" . $owner_acc_id . "'");
}
}
if ($core == 1) {
$sql["logon"]->query("DELETE FROM accounts WHERE acct='" . $acc_id . "'");
} else {
$sql["logon"]->query("DELETE FROM account WHERE id='" . $acc_id . "'");
}
$sql["mgr"]->query("DELETE FROM point_system_invites WHERE PlayersAccount='" . $acc_id . "'");
$sql["mgr"]->query("DELETE FROM config_accounts WHERE Login='" . $acct_name . "'");
if ($sql["logon"]->affected_rows()) {
return array(true, $del_char);
}
}
}
return array(false, $del_char);
}
示例10: do_update
//.........这里部分代码省略.........
if ($AllowableRace[$t] & 8) {
$tmp = $tmp + 8;
}
if ($AllowableRace[$t] & 16) {
$tmp = $tmp + 16;
}
if ($AllowableRace[$t] & 32) {
$tmp = $tmp + 32;
}
if ($AllowableRace[$t] & 64) {
$tmp = $tmp + 64;
}
if ($AllowableRace[$t] & 128) {
$tmp = $tmp + 128;
}
if ($AllowableRace[$t] & 256) {
$tmp = $tmp + 256;
}
if ($AllowableRace[$t] & 512) {
$tmp = $tmp + 512;
}
}
}
if ($tmp) {
$AllowableRace = $tmp;
} else {
$AllowableRace = -1;
}
if ($_POST['type'] == "add_new") {
$sql_query = "INSERT INTO item_template (entry, class, subclass, name,displayid, Quality, Flags, BuyCount, BuyPrice, SellPrice, InventoryType, AllowableClass, AllowableRace, ItemLevel,\n RequiredLevel, RequiredSkill, RequiredSkillRank, requiredspell, requiredhonorrank, RequiredCityRank, RequiredReputationFaction, RequiredReputationRank, maxcount, stackable, ContainerSlots, stat_type1,\n stat_value1, stat_type2, stat_value2, stat_type3, stat_value3, stat_type4, stat_value4, stat_type5, stat_value5, stat_type6, stat_value6, stat_type7, stat_value7, stat_type8, stat_value8, stat_type9,\n stat_value9, stat_type10, stat_value10, dmg_min1, dmg_max1, dmg_type1, dmg_min2, dmg_max2, dmg_type2, armor, holy_res, fire_res, nature_res, frost_res, shadow_res, arcane_res, delay, ammo_type,\n RangedModRange, spellid_1, spelltrigger_1, spellcharges_1, spellppmRate_1, spellcooldown_1, spellcategory_1, spellcategorycooldown_1,\n spellid_2, spelltrigger_2, spellcharges_2, spellppmRate_2, spellcooldown_2, spellcategory_2, spellcategorycooldown_2, spellid_3, spelltrigger_3, spellcharges_3, spellppmRate_3, spellcooldown_3, spellcategory_3, spellcategorycooldown_3,\n spellid_4, spelltrigger_4, spellcharges_4, spellppmRate_4, spellcooldown_4, spellcategory_4, spellcategorycooldown_4, spellid_5, spelltrigger_5, spellcharges_5, spellppmRate_5, spellcooldown_5, spellcategory_5, spellcategorycooldown_5,\n bonding, description, PageText, LanguageID, PageMaterial, startquest, lockid, Material, sheath, RandomProperty, block, itemset, MaxDurability, area, BagFamily, Map, ScriptName, DisenchantID,RequiredDisenchantSkill,\n ArmorDamageModifier,unk0,RandomSuffix,TotemCategory, socketColor_1, socketContent_1, socketColor_2, socketContent_2, socketColor_3, socketContent_3, socketBonus, GemProperties)\n VALUES ('{$entry}', '{$class}', '{$subclass}', '{$name}','{$displayid}', '{$Quality}', '{$Flags}', '{$BuyCount}', '{$BuyPrice}', '{$SellPrice}', '{$InventoryType}', '{$AllowableClass}', '{$AllowableRace}', '{$ItemLevel}', '{$RequiredLevel}',\n '{$RequiredSkill}', '{$RequiredSkillRank}', '{$requiredspell}', '{$requiredhonorrank}', '{$RequiredCityRank}', '{$RequiredReputationFaction}', '{$RequiredReputationRank}', '{$maxcount}', '{$stackable}', '{$ContainerSlots}', '{$stat_type1}',\n '{$stat_value1}', '{$stat_type2}', '{$stat_value2}', '{$stat_type3}', '{$stat_value3}', '{$stat_type4}', '{$stat_value4}', '{$stat_type5}', '{$stat_value5}', '{$stat_type6}', '{$stat_value6}', '{$stat_type7}', '{$stat_value7}', '{$stat_type8}', '{$stat_value8}',\n '{$stat_type9}', '{$stat_value9}', '{$stat_type10}', '{$stat_value10}', '{$dmg_min1}', '{$dmg_max1}', '{$dmg_type1}', '{$dmg_min2}', '{$dmg_max2}', '{$dmg_type2}', '{$armor}', '{$holy_res}', '{$fire_res}', '{$nature_res}', '{$frost_res}', '{$shadow_res}', '{$arcane_res}', '{$delay}', '{$ammo_type}', '{$RangedModRange}', '{$spellid_1}', '{$spelltrigger_1}', '{$spellcharges_1}', '{$spellppmRate_1}', '{$spellcooldown_1}',\n '{$spellcategory_1}', '{$spellcategorycooldown_1}', '{$spellid_2}', '{$spelltrigger_2}', '{$spellcharges_2}', '{$spellppmRate_2}', '{$spellcooldown_2}', '{$spellcategory_2}', '{$spellcategorycooldown_2}', '{$spellid_3}', '{$spelltrigger_3}', '{$spellcharges_3}', '{$spellppmRate_3}',\n '{$spellcooldown_3}', '{$spellcategory_3}', '{$spellcategorycooldown_3}', '{$spellid_4}', '{$spelltrigger_4}', '{$spellcharges_4}', '{$spellppmRate_4}', '{$spellcooldown_4}', '{$spellcategory_4}', '{$spellcategorycooldown_4}', '{$spellid_5}', '{$spelltrigger_5}',\n '{$spellcharges_5}', '{$spellppmRate_5}', '{$spellcooldown_5}', '{$spellcategory_5}', '{$spellcategorycooldown_5}', '{$bonding}', '{$description}', '{$PageText}', '{$LanguageID}', '{$PageMaterial}', '{$startquest}', '{$lockid}', '{$Material}', '{$sheath}', '{$RandomProperty}', '{$block}',\n '{$itemset}', '{$MaxDurability}', '{$area}', '{$BagFamily}', '{$Map}', '{$ScriptName}', '{$DisenchantID}', '{$RequiredDisenchantSkill}','{$ArmorDamageModifier}','{$unk0}','{$RandomSuffix}', '{$TotemCategory}', '{$socketColor_1}', '{$socketContent_1}', '{$socketColor_2}',\n '{$socketContent_2}', '{$socketColor_3}', '{$socketContent_3}', '{$socketBonus}', '{$GemProperties}')";
} elseif ($_POST['type'] == "edit") {
$sql_query = "UPDATE item_template SET ";
$result = $sql->query("SELECT `item_template`.`entry`,`class`,`subclass`,`unk0`,IFNULL(" . ($deplang != 0 ? "name_loc{$deplang}" : "NULL") . ",`name`) as name,`displayid`,`Quality`,`Flags`,`BuyCount`,`BuyPrice`,`SellPrice`,`InventoryType`,`AllowableClass`,`AllowableRace`,`ItemLevel`,`RequiredLevel`,`RequiredSkill`,`RequiredSkillRank`,`requiredspell`,`requiredhonorrank`,`RequiredCityRank`,`RequiredReputationFaction`,`RequiredReputationRank`,`maxcount`,`stackable`,`ContainerSlots`,`stat_type1`,`stat_value1`,`stat_type2`,`stat_value2`,`stat_type3`,`stat_value3`,`stat_type4`,`stat_value4`,`stat_type5`,`stat_value5`,`stat_type6`,`stat_value6`,`stat_type7`,`stat_value7`,`stat_type8`,`stat_value8`,`stat_type9`,`stat_value9`,`stat_type10`,`stat_value10`,`dmg_min1`,`dmg_max1`,`dmg_type1`,`dmg_min2`,`dmg_max2`,`dmg_type2`,`armor`,`holy_res`,`fire_res`,`nature_res`,`frost_res`,`shadow_res`,`arcane_res`,`delay`,`ammo_type`,`RangedModRange`,`spellid_1`,`spelltrigger_1`,`spellcharges_1`,`spellppmRate_1`,`spellcooldown_1`,`spellcategory_1`,`spellcategorycooldown_1`,`spellid_2`,`spelltrigger_2`,`spellcharges_2`,`spellppmRate_2`,`spellcooldown_2`,`spellcategory_2`,`spellcategorycooldown_2`,`spellid_3`,`spelltrigger_3`,`spellcharges_3`,`spellppmRate_3`,`spellcooldown_3`,`spellcategory_3`,`spellcategorycooldown_3`,`spellid_4`,`spelltrigger_4`,`spellcharges_4`,`spellppmRate_4`,`spellcooldown_4`,`spellcategory_4`,`spellcategorycooldown_4`,`spellid_5`,`spelltrigger_5`,`spellcharges_5`,`spellppmRate_5`,`spellcooldown_5`,`spellcategory_5`,`spellcategorycooldown_5`,`bonding`,`description`,`PageText`,`LanguageID`,`PageMaterial`,`startquest`,`lockid`,`Material`,`sheath`,`RandomProperty`,`RandomSuffix`,`block`,`itemset`,`MaxDurability`,`area`,`Map`,`BagFamily`,`TotemCategory`,`socketColor_1`,`socketContent_1`,`socketColor_2`,`socketContent_2`,`socketColor_3`,`socketContent_3`,`socketBonus`,`GemProperties`,`RequiredDisenchantSkill`,`ArmorDamageModifier`,`ScriptName`,`DisenchantID`,`FoodType`,`minMoneyLoot`,`maxMoneyLoot` FROM item_template LEFT JOIN locales_item ON item_template.entry = locales_item.entry WHERE item_template.entry = '{$entry}'");
if ($item_templ = $sql->fetch_assoc($result)) {
if ($item_templ['class'] != $class) {
$sql_query .= "class='{$class}',";
}
if ($item_templ['subclass'] != $subclass) {
$sql_query .= "subclass='{$subclass}',";
}
if ($item_templ['name'] != $name) {
$sql_query .= "name='{$name}',";
}
if ($item_templ['displayid'] != $displayid) {
$sql_query .= "displayid='{$displayid}',";
}
if ($item_templ['Quality'] != $Quality) {
$sql_query .= "Quality='{$Quality}',";
}
if ($item_templ['Flags'] != $Flags) {
$sql_query .= "Flags='{$Flags}',";
}
if ($item_templ['BuyCount'] != $BuyCount) {
$sql_query .= "BuyCount='{$BuyCount}',";
}
if ($item_templ['BuyPrice'] != $BuyPrice) {
$sql_query .= "BuyPrice='{$BuyPrice}',";
}
if ($item_templ['SellPrice'] != $SellPrice) {
$sql_query .= "SellPrice='{$SellPrice}',";
}
if ($item_templ['InventoryType'] != $InventoryType) {
$sql_query .= "InventoryType='{$InventoryType}',";
}
if ($item_templ['AllowableClass'] != $AllowableClass) {
$sql_query .= "AllowableClass='{$AllowableClass}',";
示例11: SQL
<?php
// page header, and any additional required libraries
require_once 'header.php';
require_once 'config/forum.conf.php';
require_once 'libs/forum_lib.php';
require_once 'libs/bbcode_lib.php';
// minimum permission to view page
valid_login($action_permission['read']);
$sqlm = new SQL();
$sqlm->connect($mmfpm_db['addr'], $mmfpm_db['user'], $mmfpm_db['pass'], $mmfpm_db['name']);
$cid = $sqlm->query('
SELECT category, name, description, side_access, level_post_topic, level_read, level_post
FROM mm_forum_categories');
while ($category = $sqlm->fetch_assoc($cid)) {
if (!isset($category['level_read'])) {
$category['level_read'] = 0;
}
if (!isset($category['level_post'])) {
$category['level_post'] = 0;
}
if (!isset($category['level_post_topic'])) {
$category['level_post_topic'] = 0;
}
if (!isset($category['side_access'])) {
$category['side_access'] = 'ALL';
}
$fid = $sqlm->query('
SELECT forum, category, name, description, side_access, level_post_topic, level_read, level_post
FROM mm_forum_forums
WHERE category = ' . $category['category'] . '');
示例12: instances
function instances()
{
global $output, $lang_instances, $realm_id, $world_db, $mmfpm_db, $itemperpage;
$sqlw = new SQL();
$sqlw->connect($world_db[$realm_id]['addr'], $world_db[$realm_id]['user'], $world_db[$realm_id]['pass'], $world_db[$realm_id]['name']);
//-------------------SQL Injection Prevention--------------------------------
// this page has multipage support and field ordering, so we need these
$start = isset($_GET['start']) ? $sqlw->quote_smart($_GET['start']) : 0;
if (is_numeric($start)) {
} else {
$start = 0;
}
$order_by = isset($_GET['order_by']) ? $sqlw->quote_smart($_GET['order_by']) : 'levelMin';
if (preg_match('/^[_[:lower:]]{1,11}$/', $order_by)) {
} else {
$order_by = 'levelMin';
}
$dir = isset($_GET['dir']) ? $sqlw->quote_smart($_GET['dir']) : 1;
if (preg_match('/^[01]{1}$/', $dir)) {
} else {
$dir = 1;
}
$order_dir = $dir ? 'ASC' : 'DESC';
$dir = $dir ? 0 : 1;
//-------------------SQL Injection Prevention--------------------------------
// for multipage support
$all_record = $sqlw->result($sqlw->query('SELECT count(*) FROM instance_template'), 0);
// main data that we need for this page, instances
$result = $sqlw->query('
SELECT map, levelMin, levelMax
FROM instance_template
ORDER BY ' . $order_by . ' ' . $order_dir . ' LIMIT ' . $start . ', ' . $itemperpage . ';');
//---------------Page Specific Data Starts Here--------------------------
$output .= '
<center>
<table class="top_hidden">
<tr>
<td width="25%" align="right">';
// multi page links
$output .= $lang_instances['total'] . ' : ' . $all_record . '<br /><br />' . generate_pagination('instances.php?order_by=' . $order_by . '&dir=' . ($dir ? 0 : 1), $all_record, $itemperpage, $start);
// column headers, with links for sorting
$output .= '
</td>
</tr>
</table>
<table class="lined">
<tr>
<th width="20%"><a href="instances.php?order_by=map&start=' . $start . '&dir=' . $dir . '"' . ($order_by === 'map' ? ' class="' . $order_dir . '"' : '') . '>' . $lang_instances['map'] . '</a></th>
<th width="5%"><a href="instances.php?order_by=levelMin&start=' . $start . '&dir=' . $dir . '"' . ($order_by === 'levelMin' ? ' class="' . $order_dir . '"' : '') . '>' . $lang_instances['level_min'] . '</a></th>
<th width="5%"><a href="instances.php?order_by=levelMax&start=' . $start . '&dir=' . $dir . '"' . ($order_by === 'levelMax' ? ' class="' . $order_dir . '"' : '') . '>' . $lang_instances['level_max'] . '</a></th>
<th width="20%">' . $lang_instances['area'] . '</th>
<th width="10%">' . $lang_instances['type'] . '</th>
<th width="5%">' . $lang_instances['expansion'] . '</th>
<th width="5%">' . $lang_instances['ppl'] . '</th>
</tr>';
$sqlm = new SQL();
$sqlm->connect($mmfpm_db['addr'], $mmfpm_db['user'], $mmfpm_db['pass'], $mmfpm_db['name']);
while ($instances = $sqlw->fetch_assoc($result)) {
$output .= '
<tr valign="top">
<td>' . get_map_name($instances['map'], $sqlm) . '</td>
<td>' . char_get_level_color($instances['levelMin']) . '</td>
<td>' . char_get_level_color($instances['levelMax']) . '</td>
<td>' . get_map_zone($instances['map'], $sqlm) . '</td>
<td>' . get_map_type($instances['map'], $sqlm) . '</td>
<td>' . get_map_exp($instances['map'], $sqlm) . '</td>
<td>' . get_map_ppl($instances['map'], $sqlm) . '</td>
</tr>';
}
unset($reset);
unset($hours);
unset($days);
unset($instances);
unset($result);
$output .= '
</table>
<table class="top_hidden">
<tr>
<td width="25%" align="right">';
// multi page links
$output .= $lang_instances['total'] . ' : ' . $all_record . '<br /><br />' . generate_pagination('instances.php?order_by=' . $order_by . '&dir=' . ($dir ? 0 : 1), $all_record, $itemperpage, $start);
unset($start);
$output .= '
</td>
</tr>
</table>
</center>';
}
示例13: do_update
//.........这里部分代码省略.........
} else {
$item = 0;
}
if (isset($_POST['del_loot_items']) && $_POST['del_loot_items'] != '') {
$del_loot_items = $sql->quote_smart($_POST['del_loot_items']);
} else {
$del_loot_items = NULL;
}
if (isset($_POST['involvedrelation']) && $_POST['involvedrelation'] != '') {
$involvedrelation = $sql->quote_smart($_POST['involvedrelation']);
} else {
$involvedrelation = 0;
}
if (isset($_POST['del_involvedrelation']) && $_POST['del_involvedrelation'] != '') {
$del_involvedrelation = $sql->quote_smart($_POST['del_involvedrelation']);
} else {
$del_involvedrelation = NULL;
}
if (isset($_POST['questrelation']) && $_POST['questrelation'] != '') {
$questrelation = $sql->quote_smart($_POST['questrelation']);
} else {
$questrelation = 0;
}
if (isset($_POST['del_questrelation']) && $_POST['del_questrelation'] != '') {
$del_questrelation = $sql->quote_smart($_POST['del_questrelation']);
} else {
$del_questrelation = NULL;
}
if ($_POST['opp_type'] == "add_new") {
$sql_query = "INSERT INTO gameobject_template ( entry, type, displayId, name, faction, flags, size, data0, data1,\r\n data2, data3, data4, data5, data6, data7, data8, data9, data10, data11, data12, data13,\r\n data14, data15, data16, data17, data18, data19, data20, data21, data22, data23, ScriptName )\r\n VALUES ( '{$entry}', '{$type}', '{$displayId}', '{$name}', '{$faction}', '{$flags}', '{$size}', '{$data0}', '{$data1}',\r\n '{$data2}', '{$data3}', '{$data4}', '{$data5}', '{$data6}', '{$data7}', '{$data8}', '{$data9}', '{$data10}', '{$data11}',\r\n '{$data12}', '{$data13}', '{$data14}', '{$data15}', '{$data16}', '{$data17}', '{$data18}', '{$data19}', '{$data20}',\r\n '{$data21}', '{$data22}', '{$data23}', '{$ScriptName}' )";
} elseif ($_POST['opp_type'] == "edit") {
$sql_query = "UPDATE gameobject_template SET ";
$result = $sql->query("SELECT gameobject_template.`entry`,`type`,`displayId`,IFNULL(" . ($deplang != 0 ? "name_loc{$deplang}" : "NULL") . ",`name`) as name,`faction`,`flags`,`size`,`data0`,`data1`,`data2`,`data3`,`data4`,`data5`,`data6`,`data7`,`data8`,`data9`,`data10`,`data11`,`data12`,`data13`,`data14`,`data15`,`data16`,`data17`,`data18`,`data19`,`data20`,`data21`,`data22`,`data23`,`ScriptName` FROM gameobject_template LEFT JOIN locales_gameobject ON gameobject_template.entry = locales_gameobject.entry WHERE gameobject_template.entry = '{$entry}'");
if ($go_templ = $sql->fetch_assoc($result)) {
if ($go_templ['type'] != $type) {
$sql_query .= "type='{$type}',";
}
if ($go_templ['displayId'] != $displayId) {
$sql_query .= "displayId='{$displayId}',";
}
if ($go_templ['name'] != $name) {
$sql_query .= "name='{$name}',";
}
if ($go_templ['faction'] != $faction) {
$sql_query .= "faction='{$faction}',";
}
if ($go_templ['flags'] != $flags) {
$sql_query .= "flags='{$flags}',";
}
if ($go_templ['size'] != $size) {
$sql_query .= "size='{$size}',";
}
if ($go_templ['data0'] != $data0) {
$sql_query .= "data0='{$data0}',";
}
if ($go_templ['data1'] != $data1) {
$sql_query .= "data1='{$data1}',";
}
if ($go_templ['data2'] != $data2) {
$sql_query .= "data2='{$data2}',";
}
if ($go_templ['data3'] != $data3) {
$sql_query .= "data3='{$data3}',";
}
if ($go_templ['data4'] != $data4) {
$sql_query .= "data4='{$data4}',";
示例14: general
function general()
{
global $output, $corem_db, $world_db, $core;
// we need $core to be set
if ($core == 0) {
$core = detectcore();
}
$sqlm = new SQL();
$sqlm->connect($corem_db["addr"], $corem_db["user"], $corem_db["pass"], $corem_db["name"], $corem_db["encoding"]);
$sqlw = new SQL();
$sqlw->connect($world_db[1]["addr"], $world_db[1]["user"], $world_db[1]["pass"], $world_db[1]["name"], $world_db[1]["encoding"]);
$subsection = isset($_GET["subsection"]) ? $sqlm->quote_smart($_GET["subsection"]) : 1;
$output .= '
<table id="sidebar">
<tr>
<td ' . ($subsection == "more" ? 'class="current"' : '') . '>
<a href="admin.php?section=general&subsection=more">' . lang("admin", "more") . '</a>
</td>
</tr>
<tr>
<td ' . ($subsection == "version" ? 'class="current"' : '') . '>
<a href="admin.php?section=general&subsection=version">' . lang("admin", "version") . '</a>
</td>
</tr>
<tr>
<td ' . ($subsection == "mail" ? 'class="current"' : '') . '>
<a href="admin.php?section=general&subsection=mail">' . lang("admin", "mail") . '</a>
</td>
</tr>
<tr>
<td ' . ($subsection == "irc" ? 'class="current"' : '') . '>
<a href="admin.php?section=general&subsection=irc">' . lang("admin", "irc") . '</a>
</td>
</tr>
<tr>
<td ' . ($subsection == "proxy" ? 'class="current"' : '') . '>
<a href="admin.php?section=general&subsection=proxy">' . lang("admin", "proxy") . '</a>
</td>
</tr>
<tr>
<td ' . ($subsection == "datasite" ? 'class="current"' : '') . '>
<a href="admin.php?section=general&subsection=datasite">' . lang("admin", "datasite") . '</a>
</td>
</tr>
<tr>
<td ' . ($subsection == "acctcreation" ? 'class="current"' : '') . '>
<a href="admin.php?section=general&subsection=acctcreation">' . lang("admin", "acct_creation") . '</a>
</td>
</tr>
<tr>
<td ' . ($subsection == "guests" ? 'class="current"' : '') . '>
<a href="admin.php?section=general&subsection=guests">' . lang("admin", "guests") . '</a>
</td>
</tr>
<tr>
<td ' . ($subsection == "extratools" ? 'class="current"' : '') . '>
<a href="admin.php?section=general&subsection=extratools">' . lang("admin", "extra_tools") . '</a>
</td>
</tr>
<tr>
<td ' . ($subsection == "internalmap" ? 'class="current"' : '') . '>
<a href="admin.php?section=general&subsection=internalmap">' . lang("admin", "internal_map") . '</a>
</td>
</tr>
<tr>
<td ' . ($subsection == "validip" ? 'class="current"' : '') . '>
<a href="admin.php?section=general&subsection=validip">' . lang("admin", "validip") . '</a>
</td>
</tr>
<tr>
<td ' . ($subsection == "ads" ? 'class="current"' : '') . '>
<a href="admin.php?section=general&subsection=ads">' . lang("admin", "ads") . '</a>
</td>
</tr>
<tr>
<td ' . ($subsection == "gmlevels" ? 'class="current"' : '') . '>
<a href="admin.php?section=general&subsection=gmlevels">' . lang("admin", "gm_levels") . '</a>
</td>
</tr>
</table>';
if (isset($_GET["error"])) {
$output .= '
<div id="misc_error">';
} else {
$output .= '
<div id="misc">';
}
$sub_action = isset($_GET["subaction"]) ? $_GET["subaction"] : '';
switch ($subsection) {
case "version":
if (!$sub_action) {
$show_version_show = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Show_Version_Show'"));
$show_version_version = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Show_Version_Version'"));
$show_version_version_lvl = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Show_Version_Version_Lvl'"));
$show_version_revision = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Show_Version_SVNRev'"));
$show_version_revision_lvl = $sqlm->fetch_assoc($sqlm->query("SELECT * FROM config_misc WHERE `Key`='Show_Version_SVNRev_Lvl'"));
$output .= '
<form action="admin.php" method="get" id="form">
<div>
<input type="hidden" name="section" value="general" />
//.........这里部分代码省略.........
示例15: do_purchase
function do_purchase()
{
global $output, $characters_db, $raffle_id, $user_name, $user_id, $sql, $core;
// make sure the money character (if provided) is not an injection
if (isset($_GET["money_character"])) {
$money_character = explode("-", $_GET["money_character"]);
$char_choice = $money_character[1];
$char_choice = isset($_GET["money_character"]) ? $char_choice : NULL;
$char_choice = is_numeric($char_choice) ? $char_choice : 0;
$char_realm = $money_character[0];
$char_realm = is_numeric($char_realm) ? $char_realm : 0;
// check that the realm id is at least a number
if ($char_realm == 0) {
error(lang("global", "err_invalid_input"));
}
}
// get our raffle
$query = "SELECT * FROM point_system_raffles WHERE entry='" . $raffle_id . "'";
$result = $sql["mgr"]->query($query);
$raffle = $sql["mgr"]->fetch_assoc($result);
// get our usage
$query = "SELECT * FROM point_system_raffle_tickets WHERE raffle='" . $coupon_id . "' AND user='" . $user_id . "'";
$result = $sql["mgr"]->query($query);
$my_usage = $sql["mgr"]->num_rows($result);
// get overall usage
$query = "SELECT * FROM point_system_raffle_tickets WHERE raffle='" . $coupon_id . "'";
$result = $sql["mgr"]->query($query);
$usage = $sql["mgr"]->num_rows($result);
// check whether this raffle is available for us to use
if ($raffle["tickets_per_iser"] != -1 && $raffle["tickets_per_user"] <= $my_usage || $raffle["ticket_limit"] != -1 && $raffle["ticket_limit"] <= $usage) {
redirect("point_system.php?action=view_raffle&raffle_id=" . $raffle_id . "&error=3");
}
// if the raffle requires payment in credits, deduct those
if ($raffle["cost_credits"] != 0) {
// get our credit balance
$query = "SELECT credits FROM config_accounts WHERE Login='" . $user_name . "'";
$result = $sql["mgr"]->query($query);
$result = $sql["mgr"]->fetch_assoc($result);
$credits = $result["credits"];
// first, we check whether we have normal credits and less than required
if ($credits > -1) {
if ($credits < $raffle["cost_credits"]) {
redirect("point_system.php?action=view_raffle&raffle_id=" . $raffle_id . "&error=4");
} else {
// deduct the credits from our account
$query = "UPDATE config_accounts SET credits=credits-'" . $raffle["cost_credits"] . "' WHERE Login='" . $user_name . "'";
$result = $sql["mgr"]->query($query);
}
}
}
// if the raffle requires payment in monies, deduct those
if ($raffle["cost_money"] != 0) {
$sqlt = new SQL();
$sqlt->connect($characters_db[$char_realm]["addr"], $characters_db[$char_realm]["user"], $characters_db[$char_realm]["pass"], $characters_db[$char_realm]["name"], $characters_db[$char_realm]["encoding"]);
// the selected character's money
if ($core == 1) {
$char_query = "SELECT gold AS money, online FROM characters WHERE guid='" . $char_choice . "'";
} else {
$char_query = "SELECT money, online FROM characters WHERE guid='" . $char_choice . "'";
}
$char_result = $sqlt->query($char_query);
$char = $sqlt->fetch_assoc($char_result);
// make sure the character has enough money and is offline
if ($char["money"] <= $raffle["cost_money"]) {
redirect("point_system.php?action=view_raffle&raffle_id=" . $raffle_id . "&error=5");
}
if ($char["online"]) {
redirect("point_system.php?action=view_raffle&raffle_id=" . $raffle_id . "&error=6");
}
// deduct the required money from the character's gold
if ($core == 1) {
$query = "UPDATE characters SET gold=gold-'" . $raffle["cost_money"] . "' WHERE guid='" . $char_choice . "'";
} else {
$query = "UPDATE characters SET money=money-'" . $raffle["cost_money"] . "' WHERE guid='" . $char_choice . "'";
}
$result = $sqlt->query($query);
}
// make an entry for our usage
$query = "INSERT INTO point_system_raffle_tickets (raffle, user, date_purchased) VALUES ('" . $raffle_id . "', '" . $user_id . "', NOW())";
$result = $sql["mgr"]->query($query);
redirect("point_system.php?action=view_raffle&purchased=1");
}