本文整理汇总了PHP中query_fetch_assoc函数的典型用法代码示例。如果您正苦于以下问题:PHP query_fetch_assoc函数的具体用法?PHP query_fetch_assoc怎么用?PHP query_fetch_assoc使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了query_fetch_assoc函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: analyze_database
function analyze_database()
{
$result = mysql_query('SHOW TABLES');
$i = 0;
while ($table = mysql_fetch_row($result)) {
if (preg_match("#^" . DBPREFIX . "#", $table[0])) {
$analysis[$i] = query_fetch_assoc('ANALYZE TABLE ' . $table[0]);
$i++;
}
}
unset($result);
if (isset($analysis)) {
return $analysis;
}
}
示例2: getClientGroups
/**
* Retrieve all Client's groups in an array
*
* Return FALSE if the specified Client is NOT linked to a Group OR if the GROUPID is invalid OR if the Client doesn't exists
*/
function getClientGroups($clientid)
{
if (query_numrows("SELECT `username` FROM `" . DBPREFIX . "client` WHERE `clientid` = '" . $clientid . "'") != 0 && query_numrows("SELECT `id` FROM `" . DBPREFIX . "groupMember` WHERE `clientid` = '" . $clientid . "'") != 0) {
// The specified client exists
$groupids = query_fetch_assoc("SELECT `groupids` FROM `" . DBPREFIX . "groupMember` WHERE `clientid` = '" . $clientid . "'");
$groupidsTable = explode(';', $groupids['groupids']);
// CSV
$i = 0;
foreach ($groupidsTable as $value) {
if (!empty($value)) {
$groups[$i] = $value;
$i++;
}
}
if (isset($groups)) {
return $groups;
}
}
return FALSE;
}
示例3: mysql_real_escape_string
$email = mysql_real_escape_string($_POST['email']);
###
/**
* Securimage - A PHP class for creating captcha images.
*
* VERSION: 3.0
* AUTHOR: Drew Phillips <drew@drew-phillips.com>
*/
require "../libs/securimage/securimage.php";
$securimage = new Securimage();
###
if ($securimage->check($_POST['captcha_code']) == TRUE) {
if (!empty($username) && !empty($email)) {
$numrows = query_numrows("SELECT `adminid` FROM `" . DBPREFIX . "admin` WHERE `username` = '" . $username . "' && `email` = '" . $email . "'");
if ($numrows == 1) {
$rows = query_fetch_assoc("SELECT `adminid`, `email` FROM `" . DBPREFIX . "admin` WHERE `username` = '" . $username . "'");
###
//Processing the password
$password = createRandomPassword(8);
$password2 = $password;
//Temp var for the email
$salt = hash('sha512', $username);
//Salt
$password = hash('sha512', $salt . $password);
//Hashed password with salt
query_basic("UPDATE `" . DBPREFIX . "admin` SET `password` = '" . $password . "' WHERE `adminid` = '" . $rows['adminid'] . "'");
###
$to = htmlentities($rows['email'], ENT_QUOTES);
$subject = T_('Reset Password');
$message = T_('Your password has been reset to:');
$message .= "<br /><br />{$password2}<br /><br />";
示例4: exit
$isSummary = TRUE;
###
if (isset($_GET['id']) && is_numeric($_GET['id'])) {
$boxid = $_GET['id'];
} else {
exit('Error: BoxID error.');
}
###
$return = 'boxip.php?id=' . urlencode($boxid);
require "../configuration.php";
require "./include.php";
$title = T_('Box IP Adresses');
if (query_numrows("SELECT `name` FROM `" . DBPREFIX . "box` WHERE `boxid` = '" . $boxid . "'") == 0) {
exit('Error: BoxID is invalid.');
}
$rows = query_fetch_assoc("SELECT `name`, `sshport` FROM `" . DBPREFIX . "box` WHERE `boxid` = '" . $boxid . "' LIMIT 1");
$ips = mysql_query("SELECT * FROM `" . DBPREFIX . "boxIp` WHERE `boxid` = '" . $boxid . "' ORDER BY `ipid`");
include "./bootstrap/header.php";
/**
* Notifications
*/
include "./bootstrap/notifications.php";
?>
<ul class="nav nav-tabs">
<li><a href="boxsummary.php?id=<?php
echo $boxid;
?>
"><?php
echo T_('Summary');
?>
</a></li>
示例5: unset
$_SESSION['msg-type'] = 'error';
unset($error);
header("Location: configgameedit.php?id=" . urlencode($gameid));
die;
}
###
//Security
$maxSlots = abs($maxSlots);
$defaultPort = abs($defaultPort);
$queryPort = abs($queryPort);
###
//Update
query_basic("UPDATE `" . DBPREFIX . "game` SET\n\t\t\t`game` = '" . $gameName . "',\n\t\t\t`status` = '" . $status . "',\n\t\t\t`maxslots` = '" . $maxSlots . "',\n\t\t\t`defaultport` = '" . $defaultPort . "',\n\t\t\t`cfg1name` = '" . $cfg1Name . "',\n\t\t\t`cfg1` = '" . $cfg1 . "',\n\t\t\t`cfg2name` = '" . $cfg2Name . "',\n\t\t\t`cfg2` = '" . $cfg2 . "',\n\t\t\t`cfg3name` = '" . $cfg3Name . "',\n\t\t\t`cfg3` = '" . $cfg3 . "',\n\t\t\t`cfg4name` = '" . $cfg4Name . "',\n\t\t\t`cfg4` = '" . $cfg4 . "',\n\t\t\t`cfg5name` = '" . $cfg5Name . "',\n\t\t\t`cfg5` = '" . $cfg5 . "',\n\t\t\t`cfg6name` = '" . $cfg6Name . "',\n\t\t\t`cfg6` = '" . $cfg6 . "',\n\t\t\t`cfg7name` = '" . $cfg7Name . "',\n\t\t\t`cfg7` = '" . $cfg7 . "',\n\t\t\t`cfg8name` = '" . $cfg8Name . "',\n\t\t\t`cfg8` = '" . $cfg8 . "',\n\t\t\t`cfg9name` = '" . $cfg9Name . "',\n\t\t\t`cfg9` = '" . $cfg9 . "',\n\t\t\t`startline` = '" . $startLine . "',\n\t\t\t`querytype` = '" . $queryType . "',\n\t\t\t`queryport` = '" . $queryPort . "',\n\t\t\t`cachedir` = '" . $cacheDir . "' WHERE `gameid` = '" . $gameid . "'");
###
//Update LGSL and servers
$servers = query_fetch_assoc("SELECT `serverid` FROM `" . DBPREFIX . "server` WHERE `gameid` = '" . $gameid . "'");
###
query_basic("UPDATE `" . DBPREFIX . "server` SET\n\t\t\t`game` = '" . $gameName . "' WHERE `serverid` = '" . $servers['serverid'] . "'");
###
query_basic("UPDATE `" . DBPREFIX . "lgsl` SET `type` = '" . $queryType . "' WHERE `id` = '" . $servers['serverid'] . "'");
###
unset($servers);
###
$_SESSION['msg1'] = T_('Game Updated Successfully!');
$_SESSION['msg2'] = T_('Your changes to the game have been saved.');
$_SESSION['msg-type'] = 'success';
header("Location: configgame.php");
die;
break;
case 'configgamedelete':
$gameid = $_GET['id'];
示例6: unset
if (!is_numeric($position)) {
$error .= 'Nieprawidłowy odnośnik. ';
}
if (query_numrows("SELECT `name` FROM `menu` WHERE `position` = '" . $position . "'") == 0) {
$error .= 'Taki odnośnik nie istnieje. ';
}
###
if (!empty($error)) {
$_SESSION['msg1'] = $error;
$_SESSION['msg-type'] = 'danger';
unset($error);
header("Location: admin.php?page=3");
die;
}
###
query_fetch_assoc("DELETE FROM `menu` WHERE `position` = '" . $position . "'");
###
$_SESSION['msg1'] = 'Pomyślnie usunięto odnośnik!';
$_SESSION['msg-type'] = 'success';
header("Location: admin.php?page=3");
die;
break;
//----------------------------------------------------
//----------------------------------------------------
case 'smsadd':
$csms = mysql_real_escape_string($_POST['csms']);
$nsms = mysql_real_escape_string($_POST['nsms']);
$asms = mysql_real_escape_string($_POST['asms']);
$assms = mysql_real_escape_string($_POST['assms']);
###
$error = '';
示例7: exit
$boxid = $_GET['id'];
} else {
exit('Error: BoxID error.');
}
###
$return = 'boxgamefile.php?id=' . urlencode($boxid);
require "../configuration.php";
require "./include.php";
require_once "../includes/func.ssh2.inc.php";
require_once "../libs/phpseclib/Crypt/AES.php";
require_once "../libs/gameinstaller/gameinstaller.php";
$title = T_('Box Game File Repositories');
if (query_numrows("SELECT `name` FROM `" . DBPREFIX . "box` WHERE `boxid` = '" . $boxid . "'") == 0) {
exit('Error: BoxID is invalid.');
}
$rows = query_fetch_assoc("SELECT * FROM `" . DBPREFIX . "box` WHERE `boxid` = '" . $boxid . "' LIMIT 1");
$games = mysql_query("SELECT * FROM `" . DBPREFIX . "game` ORDER BY `game`");
$aes = new Crypt_AES();
$aes->setKeyLength(256);
$aes->setKey(CRYPT_KEY);
// Get SSH2 Object OR ERROR String
$ssh = newNetSSH2($rows['ip'], $rows['sshport'], $rows['login'], $aes->decrypt($rows['password']));
if (!is_object($ssh)) {
$_SESSION['msg1'] = T_('Connection Error!');
$_SESSION['msg2'] = $ssh;
$_SESSION['msg-type'] = 'error';
}
$gameInstaller = new GameInstaller($ssh);
include "./bootstrap/header.php";
/**
* Notifications
示例8: T_
</th>
<th><?php
echo T_('Username');
?>
</th>
<th><?php
echo T_('Actions');
?>
</th>
</tr>
</thead>
<tbody>
<?php
if (!isset($error)) {
foreach ($clients as $key => $value) {
$client = query_fetch_assoc("SELECT `firstname`, `lastname`, `username` FROM `" . DBPREFIX . "client` WHERE `clientid` = '" . $value . "'");
?>
<tr>
<td><?php
echo $key + 1;
?>
</td>
<td><?php
echo htmlspecialchars($client['firstname'], ENT_QUOTES);
?>
</td>
<td><?php
echo htmlspecialchars($client['lastname'], ENT_QUOTES);
?>
</td>
<td><?php
示例9: exit
$isSummary = TRUE;
###
if (isset($_GET['id']) && is_numeric($_GET['id'])) {
$catid = $_GET['id'];
} else {
exit('Error: CatID error.');
}
###
$return = 'scriptcatedit.php?id=' . urlencode($catid);
require "../configuration.php";
require "./include.php";
$title = T_('Edit Script Category');
if (query_numrows("SELECT `name` FROM `" . DBPREFIX . "scriptCat` WHERE `id` = '" . $catid . "'") == 0) {
exit('Error: CatID is invalid.');
}
$rows = query_fetch_assoc("SELECT * FROM `" . DBPREFIX . "scriptCat` WHERE `id` = '" . $catid . "' LIMIT 1");
include "./bootstrap/header.php";
/**
* Notifications
*/
include "./bootstrap/notifications.php";
?>
<div class="well">
<form method="post" action="scriptprocess.php">
<input type="hidden" name="task" value="scriptcatedit" />
<input type="hidden" name="catid" value="<?php
echo $catid;
?>
" />
<label><?php
echo T_('Category Name');
示例10: defineLanguage
die;
}
/**
* Define Language Using 'php gettext'
*/
defineLanguage($_SESSION['clientlang']);
query_basic("UPDATE `" . DBPREFIX . "client` SET `lastactivity` = '" . $_SERVER['REQUEST_TIME'] . "' WHERE `clientid` = '" . $_SESSION['clientid'] . "'");
}
/**
* GET BrightGamePanel Database INFORMATION
* Load 'values' from `config` Table
*/
$panelName = query_fetch_assoc("SELECT `value` FROM `" . DBPREFIX . "config` WHERE `setting` = 'panelname' LIMIT 1");
$panelVersion = query_fetch_assoc("SELECT `value` FROM `" . DBPREFIX . "config` WHERE `setting` = 'panelversion' LIMIT 1");
$template = query_fetch_assoc("SELECT `value` FROM `" . DBPREFIX . "config` WHERE `setting` = 'clienttemplate' LIMIT 1");
$maintenance = query_fetch_assoc("SELECT `value` FROM `" . DBPREFIX . "config` WHERE `setting` = 'maintenance' LIMIT 1");
/**
* GET BGP CORE FILES INFORMATION
* Load version.xml (ROOT/.version/version.xml)
*/
$bgpCoreInfo = simplexml_load_file('./.version/version.xml');
/**
* VERSION CONTROL
* Check that core files are compatible with the current BrightGamePanel Database
*/
if ($panelVersion['value'] != $bgpCoreInfo->{'version'}) {
die;
}
/**
* CONSTANTS
*/
示例11: mysql_real_escape_string
$id = mysql_real_escape_string($_GET['id']);
}
}
###
if (isset($_POST['payment'])) {
$payment = mysql_real_escape_string($_POST['payment']);
} else {
if (isset($_GET['payment'])) {
$payment = mysql_real_escape_string($_GET['payment']);
}
}
//----------------------------------------------------+
if (!empty($id) && !empty($payment)) {
if (query_numrows("SELECT `name` FROM `offerts` WHERE `id` = '" . $id . "'") == 1) {
$offerts = query_fetch_assoc("SELECT * FROM `offerts` WHERE `id` = '" . $id . "' LIMIT 150");
$sms = query_fetch_assoc("SELECT `csms`, `nsms`, `asms` FROM `sms` WHERE `id` = '" . $offerts['amount'] . "' LIMIT 1");
?>
<p style="font-size: 25px">Wybrałeś Ofertę: <b><?php
echo $offerts['name'];
?>
</b>, jej koszt wynosi <b><?php
echo $sms['asms'];
?>
</b> zł.</p>
</hr>
<?php
if ($payment == 'sms') {
echo "<p>Wyślij smsa o treści: <b>" . $sms['csms'] . "</b> na numer: <b>" . $sms['nsms'] . "</b>.</p>";
}
?>
<br />
示例12: notifications
$error .= 'Kod jest za krótki. ';
}
if (query_numrows("SELECT `name` FROM `offerts` WHERE `id` = '" . $id . "'") != 1) {
$error .= 'Taka oferta nie istnieje. ';
}
###
if (!empty($error)) {
notifications($error, 'danger');
unset($error);
header("Location: product.php?id=" . $id . "&payment=" . $payment . "");
die;
}
###
$offert = query_fetch_assoc("SELECT `amount` FROM `offerts` WHERE `id` = '" . $id . "'");
$config = query_fetch_assoc("SELECT * FROM `config`");
$voucher = query_fetch_assoc("SELECT `amount`, `id` FROM `voucher` WHERE `code` = '" . $code . "' LIMIT 1");
###
if (query_numrows("SELECT `amount` FROM `voucher` WHERE `code` = '" . $code . "'") == 1 && $voucher['amount'] != 0) {
$amount = $voucher['amount'] - 1;
###
query_basic("UPDATE `voucher` SET `amount`='" . $amount . "' WHERE `id` = '" . $voucher['id'] . "'");
} else {
notifications('Ten kod jest błędny lub został już wykorzystany!', 'danger');
unset($error);
header("Location: product.php?id=" . $id . "&payment=" . $payment . "");
die;
}
###
define('MQ_SERVER_ADDR', $config['ip']);
define('MQ_SERVER_PORT', $config['port_rcon']);
define('MQ_SERVER_PASS', $config['password_rcon']);
示例13: exit
$isSummary = TRUE;
###
if (isset($_GET['id']) && is_numeric($_GET['id'])) {
$adminid = $_GET['id'];
} else {
exit('Error: AdminID error.');
}
###
$return = 'configadminedit.php?id=' . urlencode($adminid);
require "../configuration.php";
require "./include.php";
$title = T_('Edit Administrator');
if (query_numrows("SELECT `username` FROM `" . DBPREFIX . "admin` WHERE `adminid` = '" . $adminid . "'") == 0) {
exit('Error: AdminID is invalid.');
}
$rows = query_fetch_assoc("SELECT * FROM `" . DBPREFIX . "admin` WHERE `adminid` = '" . $adminid . "' LIMIT 1");
include "./bootstrap/header.php";
/**
* Notifications
*/
include "./bootstrap/notifications.php";
?>
<div class="well">
<form method="post" action="configadminprocess.php">
<input type="hidden" name="task" value="configadminedit" />
<input type="hidden" name="adminid" value="<?php
echo $adminid;
?>
" />
<label><?php
echo T_('Username');
示例14: T_
</tr>
</thead>
<tbody>
<?php
if ($groups == FALSE) {
?>
<tr>
<td colspan="3"><div style="text-align: center;"><span class="label label-warning"><?php
echo T_("This client doesn't belong to any groups.");
?>
</span></div></td>
</tr>
<?php
} else {
foreach ($groups as $key => $value) {
$group = query_fetch_assoc("SELECT `name`, `description` FROM `" . DBPREFIX . "group` WHERE `groupid` = '" . $value . "' LIMIT 1");
###
?>
<tr>
<td><?php
echo $key + 1;
?>
</td>
<td><?php
echo htmlspecialchars($group['name'], ENT_QUOTES);
?>
</td>
<td><?php
echo htmlspecialchars($group['description'], ENT_QUOTES);
?>
</td>
示例15: T_
* @categories Games/Entertainment, Systems Administration
* @package Bright Game Panel
* @author warhawk3407 <warhawk3407@gmail.com> @NOSPAM
* @copyleft 2013
* @license GNU General Public License version 3.0 (GPLv3)
* @version (Release 0) DEVELOPER BETA 8
* @link http://www.bgpanel.net/
*/
$page = 'myaccount';
$tab = 9;
$isSummary = TRUE;
$return = 'myaccount.php';
require "../configuration.php";
require "./include.php";
$title = T_('My Account');
$rows = query_fetch_assoc("SELECT * FROM `" . DBPREFIX . "admin` WHERE `adminid` = '" . $_SESSION['adminid'] . "' LIMIT 1");
include "./bootstrap/header.php";
/**
* Notifications
*/
include "./bootstrap/notifications.php";
?>
<ul class="nav nav-tabs">
<li class="active"><a href="#"><?php
echo T_('Profile');
?>
</a></li>
</ul>
<div class="well">
<form method="post" action="process.php">
<input type="hidden" name="task" value="myaccount" />