本文整理汇总了PHP中database::fetch方法的典型用法代码示例。如果您正苦于以下问题:PHP database::fetch方法的具体用法?PHP database::fetch怎么用?PHP database::fetch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类database
的用法示例。
在下文中一共展示了database::fetch方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get
public static function get($variable, $default)
{
$s = database::select("variables", array("variable_value"), "variable_name='%var'", array("%var" => $variable));
if (($b = database::fetch($s, PDO::FETCH_COLUMN)) != null) {
return json_decode($b, true);
} else {
return $default;
}
}
示例2: Auth
public function Auth($email, $password)
{
$database = new database();
$result = $database->query("SELECT * FROM member WHERE email = '{$email}'and password = '{$password}'");
if ($result) {
$userSet = $database->fetch($result);
}
return isset($userSet) ? $userSet : FALSE;
}
示例3: fetchByPicId
public function fetchByPicId($id)
{
$database = new database();
$result = $database->query("SELECT * FROM personal_pic where member_id = {$id}");
if ($result) {
$userSet = $database->fetch($result);
}
return isset($userSet) ? $userSet : FALSE;
}
示例4: list_command
public static function list_command($nick, $ircdata = array())
{
$term = $ircdata[0];
$limit = $ircdata[1];
$mode = isset($ircdata[2]) ? strtolower($ircdata[2]) : '';
if (!core::$nicks[$nick]['ircop'] || services::user_exists($nick, true, array('display', 'identified')) === false) {
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_ACCESS_DENIED);
return false;
}
// they've gotta be identified and opered..
if (trim($term) == '' || trim($limit) == '' || isset($mode) && !in_array($mode, array('', 'suspended'))) {
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_INVALID_SYNTAX_RE, array('help' => 'LIST'));
return false;
}
// invalid syntax
if (!preg_match('/([0-9]+)\\-([0-9]+)/i', $limit)) {
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_INVALID_SYNTAX_RE, array('help' => 'LIST'));
return false;
}
// invalid syntax
$total = database::select('users', array('id'));
$total = database::num_rows($total);
$nicks = self::_find_match($term, $mode, $limit);
// try and find a match
if (database::num_rows($nicks) == 0) {
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_LIST_BOTTOM, array('num' => 0, 'total' => $total));
return false;
}
// no nicks?
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_LIST_TOP);
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_LIST_TOP2);
// top of list.
while ($user = database::fetch($nicks)) {
$false_nick = $user->display;
if (!isset($user->display[18])) {
$y = strlen($user->display);
for ($i = $y; $i <= 17; $i++) {
$false_nick .= ' ';
}
}
// this is just a bit of fancy fancy, so everything displays neat
if ($user->suspended == 0) {
$hostmask = explode('!', $user->last_hostmask);
$info = $hostmask[1];
} else {
$info = $user->suspend_reason;
}
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_LIST_ROW, array('nick' => $false_nick, 'info' => $info));
}
// loop through the nicks
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_LIST_BOTTOM, array('num' => database::num_rows($nicks) == 0 ? 0 : database::num_rows($nicks), 'total' => $total));
}
示例5: list_command
public static function list_command($nick, $ircdata = array())
{
$term = $ircdata[0];
$limit = $ircdata[1];
$mode = isset($ircdata[2]) ? strtolower($ircdata[2]) : '';
if (!core::$nicks[$nick]['ircop'] || services::user_exists($nick, true, array('display', 'identified')) === false) {
services::communicate(core::$config->chanserv->nick, $nick, &chanserv::$help->CS_ACCESS_DENIED);
return false;
}
// they've gotta be identified and opered..
if (trim($term) == '' || trim($limit) == '' || isset($mode) && !in_array($mode, array('', 'suspended'))) {
services::communicate(core::$config->chanserv->nick, $nick, &chanserv::$help->CS_INVALID_SYNTAX_RE, array('help' => 'INFO'));
return false;
}
// invalid syntax
if (!preg_match('/([0-9]+)\\-([0-9]+)/i', $limit)) {
services::communicate(core::$config->chanserv->nick, $nick, &chanserv::$help->CS_INVALID_SYNTAX_RE, array('help' => 'LIST'));
return false;
}
// invalid syntax
$total = database::select('chans', array('id'));
$total = database::num_rows($total);
$chans = self::_find_match($term, $mode, $limit);
// try and find a match
if (database::num_rows($chans) == 0) {
services::communicate(core::$config->chanserv->nick, $nick, &chanserv::$help->CS_LIST_BOTTOM, array('num' => 0, 'total' => $total));
return false;
}
// no channels?
services::communicate(core::$config->chanserv->nick, $nick, &chanserv::$help->CS_LIST_TOP);
services::communicate(core::$config->chanserv->nick, $nick, &chanserv::$help->CS_LIST_TOP2);
// top of the list
while ($channel = database::fetch($chans)) {
$false_chan = $channel->channel;
if (!isset($channel->channel[18])) {
$y = strlen($channel->channel);
for ($i = $y; $i <= 17; $i++) {
$false_chan .= ' ';
}
}
// this is just a bit of fancy fancy, so everything displays neat
if ($channel->suspended == 0) {
$info = chanserv::get_flags($channel->channel, 'd');
} else {
$info = $channel->suspend_reason;
}
// suspend reason, or description?
services::communicate(core::$config->chanserv->nick, $nick, &chanserv::$help->CS_LIST_ROW, array('chan' => $false_chan, 'info' => $info));
}
// loop through the channels
services::communicate(core::$config->chanserv->nick, $nick, &chanserv::$help->CS_LIST_BOTTOM, array('num' => database::num_rows($chans) == 0 ? 0 : database::num_rows($chans), 'total' => $total));
}
示例6: node_load
public static function node_load($nid)
{
if (!self::node_exist($nid)) {
return false;
}
$node = database::fetch(database::select("node", array(), "nid='%nid'", array('%nid' => $nid)));
$nt = self::load_node_type($node->type);
$table_node = $nt->table_name;
$fields = database::fetch(database::select($table_node, array(), "nid='%nid'", array('%nid' => $nid)), PDO::FETCH_ASSOC);
if ($fields != false) {
foreach ($fields as $k => $v) {
$node->{$k} = $v;
}
}
return $node;
}
示例7: database
<?php
require 'libraries/database.php';
$email = $_REQUEST['email'];
$password = $_REQUEST['matKhau'];
$data = new database("timphongtro");
$sql = "SELECT * FROM taikhoan WHERE email='{$email}' AND MatKhau='{$password}'";
$data->query($sql);
header('Content-type: text/xml');
echo "<result>";
if ($data->num_rows() == 0) {
echo "false";
} else {
$result = $data->fetch();
echo $result['IDTaiKhoan'];
}
echo "</result>";
示例8: get_flags
public static function get_flags($chan, $flag)
{
if ($flag == 'd') {
$param_field = 'desc';
} elseif ($flag == 'u') {
$param_field = 'url';
} elseif ($flag == 'e') {
$param_field = 'email';
} elseif ($flag == 'w') {
$param_field = 'welcome';
} elseif ($flag == 'm') {
$param_field = 'modelock';
} elseif ($flag == 't') {
$param_field = 'topicmask';
} else {
return false;
}
// translate. some craq.
$chan_flags_q = database::select('chans_flags', array('id', 'channel', 'flags', $param_field), array('channel', '=', $chan));
$chan_flags = database::fetch($chan_flags_q);
// get our flags records
return $chan_flags->{$param_field};
}
示例9: get_block
public static function get_block($blockname)
{
return database::fetch(database::select("blocks", array(), "block=%block", array("%block" => $blockname)));
}
示例10: is_enabled
public static function is_enabled($module_name)
{
$res = database::fetch(database::select("module_manager", array("module_enabled"), "module_name = '%module'", array("%module" => $module_name)), PDO::FETCH_COLUMN);
if ($res) {
return $res == 1;
}
return false;
}
示例11: set_flag
public static function set_flag($nick, $chan, $target, $flag, $param = '')
{
$mode = $flag[0];
$r_flag = $flag[1];
// get the real flag, eg. V, v and mode
if (chanserv::check_levels($target, $chan, array($r_flag), false, false, false, false)) {
$user_flag_q = database::select('chans_levels', array('id', 'channel', 'target', 'flags'), array('channel', '=', $chan, 'AND', 'target', '=', $target));
if ($mode == '-') {
if ($nick == $target && $r_flag == 'F') {
services::communicate(core::$config->chanserv->nick, $nick, &chanserv::$help->CS_LEVELS_BAD_FLAG, array('flag' => $flag));
return false;
}
// someone is trying to de-founder themselves?
if (strpos(self::$set[$target], '-') === false) {
self::$set[$target] .= '-';
}
// ok, no - ?
$user_flag = database::fetch($user_flag_q);
// get the flag record
$new_user_flags = str_replace($r_flag, '', $user_flag->flags);
if ($new_user_flags == '') {
database::delete('chans_levels', array('channel', '=', $chan, 'AND', 'target', '=', $target));
} else {
database::update('chans_levels', array('flags' => $new_user_flags), array('channel', '=', $chan, 'AND', 'target', '=', $target));
}
// check if it's empty, if it is just delete the row
self::$set[$target] .= $r_flag;
// some magic :O
return true;
} else {
self::$already_set[$target] .= $r_flag;
// some magic :O
return false;
}
// the user has the flag, so, if it's - remove it, if it is +
// we send a message back.
} else {
$user_flag_q = database::select('chans_levels', array('id', 'channel', 'target', 'flags'), array('channel', '=', $chan, 'AND', 'target', '=', $target));
if ($mode == '+') {
if (strpos(self::$set[$target], '+') === false) {
self::$set[$target] .= '+';
}
// ok, no + ?
if (database::num_rows($user_flag_q) > 0) {
$user_flag = database::fetch($user_flag_q);
$new_user_flags = $user_flag->flags . $r_flag;
if ($r_flag == 'b' && $mode == '+') {
database::update('chans_levels', array('flags' => $new_user_flags, 'reason' => $param), array('channel', '=', $chan, 'AND', 'target', '=', $target));
} else {
database::update('chans_levels', array('flags' => $new_user_flags), array('channel', '=', $chan, 'AND', 'target', '=', $target));
}
// update.
self::$set[$target] .= $r_flag;
// some magic :O
return true;
} else {
if ($r_flag == 'b' && $mode == '+') {
database::insert('chans_levels', array('channel' => $chan, 'target' => $target, 'flags' => $r_flag, 'reason' => $param));
} else {
database::insert('chans_levels', array('channel' => $chan, 'target' => $target, 'flags' => $r_flag));
}
// insert.
self::$set[$target] .= $r_flag;
// some magic :O
return true;
}
} else {
self::$not_set[$target] .= $r_flag;
// some magic :O
return false;
}
// the user doesn't have the flag, so if it's + add it, if it is -
// we send a message back, basically the opposite of above.
}
}
示例12: header
require './lib/perms.php';
require './lib/user.php';
require './lib/modlet.php';
require './lib/xmlparser.php';
if (!$set['installed']) {
header('Location: ./install/index.php');
}
set_error_handler('error');
error_reporting(E_ALL);
set_magic_quotes_runtime(0);
// Open connection to database
$db = new database($set['db_host'], $set['db_user'], $set['db_pass'], $set['db_name'], $set['db_port'], $set['db_socket']);
if (!$db->connection) {
error(QUICKSILVER_ERROR, 'A connection to the database could not be established and/or the specified database could not be found.', __FILE__, __LINE__);
}
$settings = $db->fetch("SELECT settings_data FROM {$set['prefix']}settings LIMIT 1");
$set = array_merge($set, unserialize($settings['settings_data']));
$modules = array_merge($set['optional_modules'], array('help', 'mod', 'post', 'register', 'login', 'forum', 'topic'));
if (!isset($_GET['a']) || !in_array($_GET['a'], $modules)) {
$module = 'board';
} else {
$module = $_GET['a'];
}
require './func/' . $module . '.php';
$qsf = new $module();
$qsf->pre = $set['prefix'];
$qsf->db = $db;
$qsf->get['a'] = $module;
$qsf->sets = $set;
if ($qsf->sets['output_buffer'] && isset($qsf->server['HTTP_ACCEPT_ENCODING']) && stristr($qsf->server['HTTP_ACCEPT_ENCODING'], 'gzip')) {
ob_start('ob_gzhandler');
示例13: while
$champX = "pseudo";
$equipeX = "joueur";
$equipesX = "joueurs";
$EquipeX = "Joueur";
$EquipesX = "Joueurs";
$show = "show_joueur";
$nom_participant = "nom_joueur";
}
}
/*** chargement de la variable des 'gardes' de l'utilisateur ***/
if ($s_joueur) {
$db->select("id,grade");
$db->from("{$dbprefix}joueurs");
$db->where("id = {$s_joueur}");
$res = $db->exec();
while ($grade_ch = $db->fetch($res)) {
// A est 'le' chef
if (eregi('a', $grade_ch->grade)) {
$grade['a'] = 'a';
}
// B peut tout faire sauf modifier 'le chef'
if (eregi('b', $grade_ch->grade)) {
$grade['b'] = 'b';
}
// C peut modifier la configuration (mods comprit)
if (eregi('c', $grade_ch->grade)) {
$grade['c'] = 'c';
}
// D gère les downloads
if (eregi('d', $grade_ch->grade)) {
$grade['d'] = 'd';
示例14: identify_command
public static function identify_command($nick, $ircdata = array())
{
$password = $ircdata[0];
if (trim($password) == '') {
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_INVALID_SYNTAX_RE, array('help' => 'IDENTIFY'));
return false;
}
// wrong syntax damit!
if ($user = services::user_exists($nick, false, array('display', 'pass', 'identified', 'validated', 'salt', 'vhost'))) {
if ($user->validated == 0) {
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_AWAITING_VALIDATION);
return false;
} elseif ($user->identified == 1) {
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_ALREADY_IDENTIFIED);
return false;
} else {
if ($user->pass == sha1($password . $user->salt)) {
timer::remove(array('ns_identify', 'secured_callback', array($nick)));
// remove the secured timer. if there is one
ircd::on_user_login($nick);
// registered mode
database::update('users', array('identified' => 1, 'last_hostmask' => core::get_full_hostname($nick), 'last_timestamp' => 0), array('display', '=', $nick));
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_IDENTIFIED);
// right, standard identify crap
core::alog(core::$config->nickserv->nick . ': ' . core::get_full_hostname($nick) . ' identified for nick ' . core::$nicks[$nick]['nick']);
// logchan
if ($user->vhost != '' && isset(modules::$list['os_vhost'])) {
if (substr_count($user->vhost, '@') == 1) {
$new_host = explode('@', $user->vhost);
$ident = $new_host[0];
$host = $new_host[1];
ircd::setident(core::$config->operserv->nick, $user->display, $ident);
ircd::sethost(core::$config->operserv->nick, $user->display, $host);
} else {
ircd::sethost(core::$config->operserv->nick, $user->display, $user->vhost);
}
}
// first thing we do, check if they have a vhost, if they do, apply it.
$failed_attempts = database::select('failed_attempts', array('nick', 'mask', 'time'), array('nick', '=', $nick));
if (database::num_rows($failed_attempts) > 0) {
services::communicate(core::$config->nickserv->nick, $nick, '' . database::num_rows($failed_attempts) . ' failed login(s) since last login.');
while ($row = database::fetch($failed_attempts)) {
services::communicate(core::$config->nickserv->nick, $nick, 'Failed login from: ' . $row->mask . ' on ' . date("F j, Y, g:i a", $row->time) . '');
}
// loop through the failed attempts messaging them to the user
database::delete('failed_attempts', array('nick', '=', $nick));
// clear them now that they've been seen
}
// we got any failed attempts? HUMM
$hostname = core::get_full_hostname($nick);
// generate a hostname.
if (core::$config->settings->mode_on_id == 'yes' && isset(modules::$list['cs_levels'])) {
foreach (core::$chans as $chan => $cdata) {
$access_array = cs_levels::get_access($chan);
// get the access array
if ($nick == core::$config->chanserv->nick) {
continue;
}
// skip us :D
$hostname = core::get_full_hostname($nick);
// get the hostname ready.
foreach ($access_array as $target => $access) {
if ($target == $nick) {
$remove_access = false;
// don't remove access
cs_levels::give_access($chan, $nick, $access, chanserv::check_flags($chan, array('S')));
// give them access
continue 2;
// continue to next loop cause we've found a match
} elseif (strpos($target, '@') !== false && services::match($hostname, $target)) {
$remove_access = false;
// don't remove access
cs_levels::give_access($chan, $nick, $access, chanserv::check_flags($chan, array('S')));
// give them access
continue 2;
// continue to next loop cause we've found a match
} elseif (strpos(core::$chans[$chan]['users'][$nick], 'o') !== false) {
$remove_access = true;
// set remove access to true
continue 1;
// continue to next loop to check other access records
} else {
continue 1;
// continue to next loop to check other access records
}
// we check if the user has access, if they do break;
// we also check if they dont have access and have op, if they do remove it.
}
// loop through the access records
}
// loop through channels, check if they are in any
}
// check if mode_on_id is set, also cs_access is enabled, and lets do a remote access gain :D
} else {
services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_INVALID_PASSWORD);
core::alog(core::$config->nickserv->nick . ': Invalid password from ' . core::get_full_hostname($nick));
// some logging stuff
database::insert('failed_attempts', array('nick' => $nick, 'mask' => core::get_full_hostname($nick), 'time' => core::$network_time));
core::$nicks[$nick]['failed_attempts']++;
// ooh, we have something to log :)
//.........这里部分代码省略.........
示例15: database
<?php
require 'libraries/database.php';
$idN = $_REQUEST['idN'];
$data = new database("timphongtro");
$sql1 = "select * from taikhoan_o_phongtro where IDTaiKhoan='{$idN}'";
$data->query($sql1);
if ($data->num_rows() != 0) {
$result1 = $data->fetch();
$idP = $result1['IDPhongTro'];
$sql2 = "select * from phongtro where IDPhongTro='{$idP}'";
$data->query($sql2);
$result2 = $data->fetch();
$sql3 = "select * from taikhoan_o_phongtro, taikhoan where taikhoan_o_phongtro.IDTaiKhoan=taikhoan.IDTaiKhoan and IDPhongTro='{$idP}'";
$data->query($sql3);
$result3 = $data->fetchAll('user');
header('Content-type: text/xml');
echo "<result>";
echo "<idP>" . $idP . "</idP>";
echo "<dienTich>" . $result2['DienTich'] . "</dienTich>";
echo "<gia>" . $result2['GiaPhong'] . "</gia>";
echo "<khuVuc>" . $result2['KhuVuc'] . "</khuVuc>";
echo "<diaChi>" . $result2['DiaChi'] . "</diaChi>";
echo "<boSung>" . $result2['ThongTinBoSung'] . "</boSung>";
echo "<tinhTrang>" . $result2['TinhTrang'] . "</tinhTrang>";
echo "<soNguoiO>" . $result2['SoNguoiTrongPhong'] . "</soNguoiO>";
echo "<danhSachNguoiO>";
foreach ($result3 as $index => $user) {
if (is_array($user)) {
foreach ($user as $key => $value) {
echo "<" . $key . ">";