本文整理汇总了PHP中ba_db_query函数的典型用法代码示例。如果您正苦于以下问题:PHP ba_db_query函数的具体用法?PHP ba_db_query怎么用?PHP ba_db_query使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ba_db_query函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GetBunkAvailability
function GetBunkAvailability($eventid, $bookingtype, $bunks)
{
global $link, $today, $db_prefix;
$sql = "select ifnull(sum(bkBunkAllocated), 0) as BunksAllocated from {$db_prefix}bookings where bkEventID = {$eventid} ";
if ($bookingtype != "All") {
$sql .= " and bkBookAs = '{$bookingtype}' ";
}
$result = ba_db_query($link, $sql);
$BookingTypeAvailable = ba_db_fetch_row($result);
$BookingTypeCount = $BookingTypeAvailable[0];
if ($BookingTypeCount >= $bunks) {
return false;
}
return true;
}
示例2: elseif
if (ba_db_query($link, "INSERT INTO {$dbprefix}osps (ospName, ospShortName) VALUES ('Natural Claws', 'Natural Claws')") === False) {
echo "<span class = 'sans-warn'>Error adding OSP<br />\n";
}
if (ba_db_query($link, "INSERT INTO {$dbprefix}osps (ospName, ospShortName) VALUES ('Oathbreaker', 'Oathbreaker')") === False) {
echo "<span class = 'sans-warn'>Error adding OSP<br />\n";
}
if (ba_db_query($link, "INSERT INTO {$dbprefix}osps (ospName, ospShortName, ospAllowAdditionalText) VALUES ('Regeneration (10m) [Damage type]', 'Regen 10m', 1)") === False) {
echo "<span class = 'sans-warn'>Error adding OSP<br />\n";
}
if (ba_db_query($link, "INSERT INTO {$dbprefix}osps (ospName, ospShortName) VALUES ('Retractable Claws', 'Retract Claw')") === False) {
echo "<span class = 'sans-warn'>Error adding OSP<br />\n";
}
if (ba_db_query($link, "INSERT INTO {$dbprefix}osps (ospName, ospShortName) VALUES ('Ritual Crafter', 'Ritual Crafr')") === False) {
echo "<span class = 'sans-warn'>Error adding OSP<br />\n";
}
if (ba_db_query($link, "INSERT INTO {$dbprefix}osps (ospName, ospShortName) VALUES ('Self Repairing Armour', 'Slf Rep Armr')") === False) {
echo "<span class = 'sans-warn'>Error adding OSP<br />\n";
}
if (ba_db_query($link, "INSERT INTO {$dbprefix}osps (ospName, ospShortName) VALUES ('Spell Tempering (Master)', 'Spl Temp Mstr')") === False) {
echo "<span class = 'sans-warn'>Error adding OSP<br />\n";
}
} elseif ($_POST['btnSubmit'] != '' && $_POST['txtKey'] != CRYPT_KEY) {
echo "<span class = 'sans-warn'>Wrong value entered for CRYPT_KEY</span>";
}
?>
</p>
<p><a href = "./">Installation Tests & Tools</a></p>
<?php
include '../inc/inc_foot.php';
示例3: ba_db_real_escape_string
//Change SQL query so that plPassword and plLoginCounter are both updated
$sql = "UPDATE {$db_prefix}players SET plPassword = 'ACCOUNT DISABLED', plLoginCounter = " . $iLoginCounter . " WHERE plEmail LIKE '" . ba_db_real_escape_string($link, $sEmail) . "'";
$sMessage = "You have entered an incorrect password too many times. Your account has been disabled.<br>" . "An e-mail has been sent to your e-mail address with instructions on how to re-enable your account.";
//E-mail user
$sBody = "This is an automated message from " . SYSTEM_NAME . ". Your account has been disabled, because " . "an incorrect password was entered too many times. You can re-enable your account by resetting your " . "password (Follow the 'Get a new password' link from the front page). If you have any problems, " . "please contact " . TECH_CONTACT_NAME . " at " . TECH_CONTACT_MAIL . " to have your account re-enabled.\n\n" . fnSystemURL();
mail($sEmail, SYSTEM_NAME . ' - account disabled', $sBody, "From:" . SYSTEM_NAME . " <" . TECH_CONTACT_MAIL . ">");
//E-mail admin and log a warning
$sBody = "Account with e-mail address {$sEmail} has been disabled, after too many failed login attempts.\n" . "Latest attempt was from IP address {$_SERVER['REMOTE_ADDR']}\n" . "An e-mail has been sent to the user.\n\n" . fnSystemURL();
mail(TECH_CONTACT_MAIL, SYSTEM_NAME . ' - account disabled', $sBody, "From:" . SYSTEM_NAME . " <" . TECH_CONTACT_MAIL . ">");
LogWarning($sBody);
} elseif ($row['plPassword'] == 'ACCOUNT DISABLED') {
//Account has been previously disabled. Just display message - do not send e-mail
$sMessage = "Your account has been disabled. To re-enable it, either <a href = 'retrieve.php'>request a new password</a>" . " or e-mail " . TECH_CONTACT_NAME . ", using the link below";
}
//Run query to update plLoginCounter (and plPassword, if account is being disabled)
ba_db_query($link, $sql) . $sql;
}
} else {
//User is not logging in, so reset login cookies
//Cookies are reset here, but values will not be available until next page load. Note that Lynx (and others?)
//do not seem to reset cookies when they are set null value, so we set them to zero, then set them to null
setcookie('BA_PlayerID', 0);
setcookie('BA_PlayerID', '');
setcookie('BA_LoginTime', 0);
setcookie('BA_LoginTime', '');
//Because cookie value will not be available until next page load, reset value of $iPlayerID & $iLoginTime
$PLAYER_ID = 0;
$fLoginTime = 0;
}
include 'inc/inc_head_html.php';
?>
示例4: ListNames
function ListNames($link, $sTable, $sColumn, $sDefault = '', $iDefaultNum = 0)
{
//Initialise $iOptionNum
$iOptionNum = 1;
//Query database to get group names
$result = ba_db_query($link, "SELECT {$sColumn} FROM {$sTable} ORDER BY {$sColumn}");
while ($row = ba_db_fetch_row($result)) {
//Note that " is used instead of ' in case there is a ' in any of the names
echo '<option value = "' . htmlentities(stripslashes($row[0])) . '"';
if ($row[0] == $sDefault || $iOptionNum++ == $iDefaultNum) {
echo ' selected';
}
echo ">" . htmlentities(stripslashes($row[0])) . "</option>\n";
}
}
示例5: htmlentities
</td></tr>
<tr><td colspan = '4'><b>Special items/powers/creatures</b> (you must have valid lammies<br>
in order to use them at the event). Please enter one per line.<br>
<textarea rows = "4" cols = "60" name = "txtSpecial"><?php
echo htmlentities(stripslashes($sOSP));
?>
</textarea>
</td></tr>
</table>
<p>
<b>OSPs</b><br>
<?php
//New and exciting way
//Get character's OSPs. Fill an array with the details. The array can then be queried, avoiding repeated DB queries
$result = ba_db_query($link, "SELECT * FROM {$db_prefix}ospstaken, {$db_prefix}osps WHERE otPlayerID = {$PLAYER_ID} AND ospID = otOspID");
//$asOSP will hold the OSP names, $aiOspID will hold the OSP ID numbers
$asOSP = array();
$aiOspID = array();
echo "<ul id='osplist'>";
while ($row = ba_db_fetch_assoc($result)) {
$asOSP[] = $row['ospName'];
$aiOspID[] = $row['otOspID'];
echo "<li id=osp" . $row['ospID'] . ">" . $row['ospName'];
echo "<input type='hidden' name='hospID" . $row['ospID'] . "' value='" . $row['ospID'] . "' />";
if ($row['ospAllowAdditionalText'] == 1) {
echo " (<input type='text' value='" . $row['otAdditionalText'] . "' name='ospAdditionalText" . $row['ospID'] . "' />)";
}
echo " <input type='button' onclick='removeosp(" . $row['ospID'] . "); return false;' value='x' /></li>\n";
}
echo "</ul>";
示例6: CheckReferrer
function CheckReferrer($Referrer_Check, $Referrer_Check_2 = "")
{
global $PLAYER_ID;
$bForceLogin = True;
//Get referrer, minus the query string
$sReferrer = parse_url($_SERVER['HTTP_REFERER'], PHP_URL_SCHEME) . '://' . parse_url($_SERVER['HTTP_REFERER'], PHP_URL_HOST) . parse_url($_SERVER['HTTP_REFERER'], PHP_URL_PATH);
if ($sReferrer == fnSystemURL() . $Referrer_Check) {
$bForceLogin = False;
}
if ($sReferrer == fnSystemURL() . $Referrer_Check_2) {
$bForceLogin = False;
}
//Special case - start page, with trailing slash but no 'index.php'
if (fnSystemURL() == $sReferrer && $Referrer_Check == 'index.php') {
$bForceLogin = False;
}
//Special case - start page, with no trailing slash
if (substr(fnSystemURL(), 0, strlen(fnSystemURL()) - 1) == $Referrer && $Referrer_Check == 'index.php') {
$bForceLogin = False;
}
if ($bForceLogin) {
//Delete any existing session and force new login
$sql = "DELETE FROM " . DB_PREFIX . "sessions WHERE ssPlayerID = {$PLAYER_ID}";
ba_db_query($link, $sql);
LogWarning("Form submitted from {$sReferrer} (expected " . fnSystemURL() . "{$Referrer_Check})\nPlayer ID: {$PLAYER_ID}");
ForceLogin();
} else {
return True;
}
}
示例7: stripslashes
}
//Date payment received
$dPaid = stripslashes($row['bkDatePaymentConfirmed']);
$iYear = substr($dPaid, 0, 4);
$iMonth = substr($dPaid, 5, 2);
$iDate = substr($dPaid, 8, 2);
$sPaid = "{$iDate}-{$iMonth}-{$iYear}";
echo '"' . $sPaid . '",';
//Amounts paid
echo '"' . $row['bkAmountPaid'] . '",';
echo '"' . $row['bkAmountExpected'] . '",';
//OSPs - one per column
if (USE_SHORT_OS_NAMES) {
$osps = ba_db_query($link, "SELECT ospShortName as ospExportName, otOspID, otAdditionalText FROM {$db_prefix}ospstaken, {$db_prefix}osps " . "WHERE otPlayerID = {$row['plPlayerID']} AND ospID = otOspID ORDER BY ospShortName");
} else {
$osps = ba_db_query($link, "SELECT ospName as ospExportName, otOspID, otAdditionalText FROM {$db_prefix}ospstaken, {$db_prefix}osps " . "WHERE otPlayerID = {$row['plPlayerID']} AND ospID = otOspID ORDER BY ospName");
}
$sOSList = "";
while ($record = ba_db_fetch_assoc($osps)) {
$sOSList .= '"' . stripslashes($record['ospExportName']);
if ($record['otAdditionalText'] != "") {
$sOSList .= " (" . stripslashes($record['otAdditionalText']) . ")";
}
$sOSList .= '",';
//Extra spell card OSPs
if ($record['otOspID'] == 6) {
$iCards = $iCards + 4;
}
if ($record['otOspID'] == 7) {
$iCards = $iCards + 8;
}
示例8: LogError
}
if (ba_db_query($link, "UPDATE {$sPrefix}players SET pleMedicalInfo = AES_ENCRYPT(AES_DECRYPT(pleMedicalInfo, '{$sOldKey}'), '{$sNewKey}')") === False) {
LogError('Error updating field pleMedicalInfo whilst changing encryption key');
$sMsg = 'There was an error updating your encryption key';
}
if (ba_db_query($link, "UPDATE {$sPrefix}players SET pleEmergencyNumber = AES_ENCRYPT(AES_DECRYPT(pleEmergencyNumber, '{$sOldKey}'), '{$sNewKey}')") === False) {
LogError('Error updating field pleEmergencyNumber whilst changing encryption key');
$sMsg = 'There was an error updating your encryption key';
}
if ($sMsg == '') {
$sMsg = 'Encryption Key Changed';
}
}
if ($_POST['btnChangeSalt'] != '' && CheckReferrer('root_keychange.php')) {
$sql = "UPDATE {$sPrefix}players SET plOldSalt = 1";
if (ba_db_query($link, $sql) === False) {
LogError('Error updating field plOldSalt whilst changing password salt');
$sMsg = 'There was an error updating your password salt';
} else {
$sMsg = 'Password salt changed';
}
}
?>
<h1><?php
echo TITLE;
?>
- Encryption Key</h1>
<?php
if ($sMsg != '') {
示例9: sha1
//Check password length
if (strlen($_POST['txtPassword1']) < MIN_PASS_LEN) {
$sWarn .= "Password must be at least " . MIN_PASS_LEN . " characters long<br>\n";
}
if ($sWarn == '') {
//Set up UPDATE query
$sHashPass = sha1($_POST['txtPassword1'] . PW_SALT);
$sql = "UPDATE {$db_prefix}players SET plPassword = '{$sHashPass}', plLoginCounter = 0 " . "WHERE plPlayerID = {$admin_player_id}";
//Run UPDATE query
if (ba_db_query($link, $sql)) {
//Query should affect exactly one row. Log a warning if it affected more
if (ba_db_affected_rows($link) > 1) {
LogWarning("More than one row updated during password reset (admin_pw_reset.php). Player ID: {$admin_player_id}");
}
//Get user's e-mail address
$result = ba_db_query($link, "SELECT plEmail FROM {$db_prefix}players WHERE plPlayerID = {$admin_player_id}");
$row = ba_db_fetch_assoc($result);
$sEmail = $row['plEmail'];
if (SEND_PASSWORD) {
//E-mail user with new password
$sBody = "Your password for " . SYSTEM_NAME . " has been changed. " . "Your new details are below:\n\n" . "E-mail: {$sEmail}\nPassword: {$_POST[txtPassword1]}\n" . "Player ID: " . PID_PREFIX . sprintf('%03s', $admin_player_id) . "\n" . "OOC Name: " . $row['plFirstName'] . " " . $row['plSurname'] . "\n\n" . fnSystemURL();
mail($sEmail, SYSTEM_NAME . ' - password change', $sBody, "From:" . SYSTEM_NAME . " <" . EVENT_CONTACT_MAIL . ">");
}
} else {
$sWarn = "There was a problem resetting the password<br>\n";
LogError("Error updating OOC information (admin_pw_reset.php). Player ID: {$admin_player_id}");
}
//Redirect to start page
$sURL = fnSystemURL() . '../start.php?green=' . urlencode('Password has been reset, and account enabled, for player ID ' . PID_PREFIX . sprintf('%03s', $admin_player_id));
if (SEND_PASSWORD) {
$sURL .= '. The new password has been e-mailed to the player';
示例10: elseif
} elseif (strtolower($_POST['btnSubmit']) == 'confirm' && CheckReferrer('ooc_view.php')) {
$sDate = date('Y-m-d');
//Check if player already has an entry in bookings table
$sql = "SELECT * FROM {$db_prefix}bookings WHERE bkPlayerID = {$PLAYER_ID}";
$result = ba_db_query($link, $sql);
//If player has not booked insert a new row
if (ba_db_num_rows($result) == 0) {
$sql = "INSERT INTO {$db_prefix}bookings (bkPlayerID, bkDateOOCConfirmed) VALUES ({$PLAYER_ID}, '{$sDate}')";
if (!ba_db_query($link, $sql)) {
$sWarn = "There was a problem confirming your OOC details";
LogError("Error inserting new OOC booking.\nPlayer ID: {$PLAYER_ID}");
}
} else {
//Update existing row
$sql = "UPDATE {$db_prefix}bookings SET bkDateOOCConfirmed = '{$sDate}' WHERE bkPlayerID = {$PLAYER_ID}";
if (!ba_db_query($link, $sql)) {
$sWarn = "There was a problem confirming your OOC details";
LogError("Error inserting new OOC booking.\nPlayer ID: {$PLAYER_ID}");
}
}
//Deals with whether this is a queued booking or not
/*
$pid = $PLAYER_ID;
$queuebooking = 0;
$dbprefix = DB_PREFIX;
if (USE_QUEUE > 0)
{
$sql = "SELECT chFaction, plBookAs FROM {$dbprefix}characters, {$dbprefix}players WHERE plPlayerID = $pid AND chPlayerID = $pid";
$result = ba_db_query ($link, $sql);
$row = ba_db_fetch_assoc ($result);
if ($row['plBookAs'] == 'Player' && $row['chFaction'] != DEFAULT_FACTION) { $queuebooking = 1;}
示例11: ba_db_query
<input type = 'submit' name = 'btnDelete' value = 'Delete'>
</p>
</form>
<?php
if ($_GET['btnQuery'] != '' && CheckReferrer('root_accesslog.php')) {
echo "<p>Showing up to {$iRecNum} records. Click on a column header to sort by that column.</p>\n";
echo "<table border = '1' class='sortable'>\n<thead>\n";
echo "<tr><th>Date & Time</th>\n";
echo "<th>Player ID</th>\n";
echo "<th>IP Address</th>\n";
echo "<th>Page</th>\n";
echo "<th>GET query</th>\n";
echo "<th>POST request</th></tr>\n</thead>\n<tbody>\n";
if ($_GET['rdoExportView'] == 'view') {
$result = ba_db_query($link, $sLogSQL);
while ($row = ba_db_fetch_assoc($result)) {
echo "<tr><td>{$row['alDateTime']}</td>\n";
echo "<td>{$row['alPlayerID']}</td>\n";
echo "<td>{$row['alIP']}";
if ($bDomain) {
echo "<br>" . gethostbyaddr($row['alIP']);
}
echo "</td>\n";
echo "<td>{$row['alPage']}</td>\n";
echo "<td>{$row['alGet']}</td>\n";
echo "<td>{$row['dPost']}</td></tr>\n";
}
}
echo "</tbody>\n<tfoot><tr>\n";
echo "<td><a href = 'root_accesslog.php?txtStart=" . urlencode($sDateStart) . "&" . "txtEnd=" . urlencode($sDateEnd) . "&" . "txtIP=" . urlencode($_GET['txtIP']) . "&" . "txtRecStart=" . urlencode($iRecStart - $iRecNum) . "&" . "txtRecNum=" . urlencode($iRecNum) . "&" . "selOrder=" . urlencode($_GET['selOrder']) . "&" . "btnQuery=Submit" . "'>Previous {$iRecNum}</a></td>\n";
示例12: formatdata
} else {
echo $cellstart . formatdata($row['chAncestor'], $bHTML) . $cellend . $separator;
}
echo $cellstart . formatdata($row['chNotes'], $bHTML) . $cellend . $separator;
//Get OSPs
$db_prefix = DB_PREFIX;
$ospSql = "SELECT otID, ospName, otAdditionalText FROM {$db_prefix}osps, {$db_prefix}ospstaken " . "WHERE otPlayerID = " . $row['plPlayerID'] . " AND otospID = ospID order by ospName";
$rOSPs = ba_db_query($link, $ospSql);
echo $cellstart;
while ($record = ba_db_fetch_assoc($rOSPs)) {
$celldata = $record['ospName'];
if ($record['otAdditionalText'] != "") {
$celldata .= " (" . $record['otAdditionalText'] . ")";
}
echo formatdata($celldata, $bHTML) . '; ';
}
echo $cellend . $separator;
//Get skills
$db_prefix = DB_PREFIX;
$skSql = "SELECT stSkillID, skName FROM {$db_prefix}skills, {$db_prefix}skillstaken " . "WHERE stPlayerID = " . $row['plPlayerID'] . " AND stSkillID = skID order by skName";
$rSkills = ba_db_query($link, $skSql);
echo $cellstart;
while ($record = ba_db_fetch_assoc($rSkills)) {
echo formatdata($record['skName'], $bHTML) . '; ';
}
echo $cellend . $rowend;
}
if ($_GET['action'] == 'view') {
echo "</table>\n";
include '../inc/inc_foot.php';
}
示例13: htmlentities
</td></tr>
<tr><td colspan = '4'><b>Special items/powers/creatures</b> (you must provide photcopies<br>
or scans for them to be valid at the event). Please enter one per line.<br>
<textarea name = "txtOSP"><?php
echo htmlentities(stripslashes($sOSP));
?>
</textarea>
</td></tr>
</table>
<p>
<b>OSPs</b><br>
<?php
//New and exciting way
//Get character's OSPs. Fill an array with the details. The array can then be queried, avoiding repeated DB queries
$result = ba_db_query($link, "SELECT * FROM {$db_prefix}ospstaken, {$db_prefix}osps WHERE otPlayerID = {$admin_player_id} AND ospID = otOspID");
//$asOSP will hold the OSP names, $aiOspID will hold the OSP ID numbers
$asOSP = array();
$aiOspID = array();
echo "<ul id='osplist'>";
while ($row = ba_db_fetch_assoc($result)) {
$asOSP[] = $row['ospName'];
$aiOspID[] = $row['otOspID'];
echo "<li id=osp" . $row['ospID'] . ">" . $row['ospName'];
echo "<input type='hidden' name='hospID" . $row['ospID'] . "' value='" . $row['ospID'] . "' />";
if ($row['ospAllowAdditionalText'] == 1) {
echo " (<input type='text' value='" . $row['otAdditionalText'] . "' name='ospAdditionalText" . $row['ospID'] . "' />)";
}
echo " <input type='button' onclick='removeosp(" . $row['ospID'] . "); return false;' value='x' /></li>\n";
}
echo "</ul>";
示例14: deleteBooking
function deleteBooking($bookingid)
{
global $today, $db_prefix, $link;
$sql = "DELETE FROM {$db_prefix}bookingitems WHERE biBookingID = " . $bookingid;
ba_db_query($link, $sql);
$sql = "DELETE FROM {$db_prefix}paymentrequests WHERE prBookingID = " . $bookingid;
ba_db_query($link, $sql);
$sql = "DELETE FROM {$db_prefix}bookings WHERE bkID = " . $bookingid;
ba_db_query($link, $sql);
}
示例15: ba_db_query
$sCond .= $sOR . " plEmail LIKE '%{$sMail}%'";
$sOR = ' OR';
}
if ($sCar != '') {
$sCond .= $sOR . " plCarRegistration LIKE '%{$sCar}%'";
$sOR = ' OR';
}
// Last one does not need $sOR to be set
if ($sCharName != '') {
$sCond .= $sOR . " chName LIKE '%{$sCharName}%'";
}
$sCond .= ")";
if (strlen($sCond) > 1) {
$sql .= "WHERE (" . $sCond;
}
$result = ba_db_query($link, $sql);
}
?>
<script src="../inc/sorttable.js" type="text/javascript"></script>
<h1><?php
echo TITLE;
?>
- Search</h1>
<p>
Enter search terms below. If any match, the player will be included in the results. Wildcards are not required.<br>
If all fields are left blank, all players will be returned.
</p>
<form action = "admin_search.php" method = "GET">