本文整理汇总了PHP中db_get_row函数的典型用法代码示例。如果您正苦于以下问题:PHP db_get_row函数的具体用法?PHP db_get_row怎么用?PHP db_get_row使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了db_get_row函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fn_settings_actions_addons_access_restrictions_admin_reverse_ip_access
/**
* Reverse IP filter
*/
function fn_settings_actions_addons_access_restrictions_admin_reverse_ip_access(&$new_value, $old_value)
{
$ip = fn_get_ip(true);
if ($new_value == 'Y') {
$ip_data = db_get_row("SELECT item_id, status FROM ?:access_restriction WHERE ip_from = ?i AND ip_to = ?i AND type IN ('aas', 'aab', 'aar')", $ip['host'], $ip['host']);
if (empty($ip_data) || empty($ip_data['item_id'])) {
// Add IP
$restrict_ip = array('ip_from' => $ip['host'], 'ip_to' => $ip['host'], 'type' => 'aas', 'timestamp' => TIME, 'expires' => '0', 'status' => 'A');
$__data = array();
$__data['item_id'] = db_query("REPLACE INTO ?:access_restriction ?e", $restrict_ip);
$__data['type'] = 'aas';
foreach (fn_get_translation_languages() as $__data['lang_code'] => $_v) {
$__data['reason'] = __('store_admin', '', $__data['lang_code']);
db_query("REPLACE INTO ?:access_restriction_reason_descriptions ?e", $__data);
}
fn_set_notification('W', __('warning'), __('your_ip_added', array('[ip]' => long2ip($ip['host']))));
} elseif (empty($ip_data['status']) || $ip_data['status'] != 'A') {
// Change IP status to available
db_query("UPDATE ?:access_restriction SET ?u WHERE item_id = ?i", array('status' => 'A'), $ip_data['item_id']);
fn_set_notification('W', __('warning'), __('your_ip_enabled', array('[ip]' => long2ip($ip['host']))));
}
} else {
// Delete IP
$ips_data = db_get_array("SELECT item_id, type FROM ?:access_restriction WHERE ip_from <= ?i AND ip_to >= ?i AND type IN ('aas', 'aab', 'aar')", $ip['host'], $ip['host']);
if (!empty($ips_data)) {
foreach ($ips_data as $ip_data) {
db_query("DELETE FROM ?:access_restriction WHERE item_id = ?i", $ip_data['item_id']);
db_query("DELETE FROM ?:access_restriction_reason_descriptions WHERE item_id = ?i AND type = ?s", $ip_data['item_id'], $ip_data['type']);
}
fn_set_notification('W', __('warning'), __('your_ip_removed', array('[ip]' => long2ip($ip['host']))));
}
}
return true;
}
示例2: init
public static function init($reinit = false, $config = array())
{
self::$active_debug_mode = false;
self::$allow_backtrace_sql = isset($_REQUEST['sql_backtrace']);
self::$debugger_cookie = !empty($_COOKIE['debugger']) ? $_COOKIE['debugger'] : '';
if ($reinit) {
Registry::registerCache('debugger', SESSION_ALIVE_TIME, Registry::cacheLevel('time'), true);
self::$actives = fn_get_storage_data('debugger_active');
self::$actives = !empty(self::$actives) ? unserialize(self::$actives) : array();
$active_in_registry = !empty(self::$actives[self::$debugger_cookie]) && time() - self::$actives[self::$debugger_cookie] < 0 ? true : false;
}
$debugger_token = !empty($config) ? $config['debugger_token'] : Registry::get('config.debugger_token');
switch (true) {
case defined('AJAX_REQUEST') && substr($_REQUEST['dispatch'], 0, 8) !== 'debugger':
break;
case defined('DEBUG_MODE') && DEBUG_MODE == true:
case !$reinit && (!empty(self::$debugger_cookie) || isset($_REQUEST[$debugger_token])):
self::$active_debug_mode = true;
break;
case !$reinit:
break;
// next if reinit
// next if reinit
case !empty(self::$debugger_cookie) && !empty($active_in_registry):
self::$active_debug_mode = true;
break;
case isset($_REQUEST[$debugger_token]):
$salt = '';
if ($_SESSION['auth']['user_type'] == 'A' && $_SESSION['auth']['is_root'] == 'Y') {
$user_admin = db_get_row('SELECT email, password FROM ?:users WHERE user_id = ?i', $_SESSION['auth']['user_id']);
$salt = $user_admin['email'] . $user_admin['password'];
}
if ($debugger_token != self::DEFAULT_TOKEN || !empty($salt)) {
// for non-default token allow full access
self::$debugger_cookie = substr(md5(SESSION::getId() . $salt), 0, 8);
$active_in_registry = true;
self::$active_debug_mode = true;
}
if (AREA == 'C' && !empty($_REQUEST[$debugger_token])) {
if (!empty(self::$actives[$_REQUEST[$debugger_token]]) && time() - self::$actives[$_REQUEST[$debugger_token]] < 0) {
$active_in_registry = true;
self::$debugger_cookie = $_REQUEST[$debugger_token];
self::$active_debug_mode = true;
}
}
fn_set_cookie('debugger', self::$debugger_cookie, SESSION_ALIVE_TIME);
break;
}
if ($reinit && self::$active_debug_mode && !empty(self::$debugger_cookie)) {
self::$actives[self::$debugger_cookie] = time() + self::EXPIRE_DEBUGGER;
fn_set_storage_data('debugger_active', serialize(self::$actives));
$active_in_registry = true;
}
if ($reinit && !empty(self::$debugger_cookie) && empty($active_in_registry)) {
fn_set_cookie('debugger', '', 0);
unset(self::$actives[self::$debugger_cookie]);
fn_set_storage_data('debugger_active', serialize(self::$actives));
}
return self::$active_debug_mode;
}
示例3: fn_reward_points_get_cart_product_data
function fn_reward_points_get_cart_product_data($product_id, &$_pdata, $product)
{
$_pdata = fn_array_merge($_pdata, db_get_row("SELECT is_pbp, is_oper, is_op FROM ?:products WHERE product_id = ?i", $product_id));
if (isset($product['extra']['configuration'])) {
$_pdata['extra']['configuration'] = $product['extra']['configuration'];
}
}
示例4: fn_api_auth_routines
function fn_api_auth_routines($request, $auth)
{
$status = true;
$user_login = !empty($request['user_login']) ? trim($request['user_login']) : '';
$password = !empty($request['password']) ? $request['password'] : '';
$field = 'email';
$condition = '';
if (fn_allowed_for('ULTIMATE')) {
if (Registry::get('settings.Stores.share_users') == 'N' && AREA != 'A') {
$condition = fn_get_company_condition('?:users.company_id');
}
}
$user_data = db_get_row("SELECT * FROM ?:users WHERE {$field} = ?s" . $condition, $user_login);
if (empty($user_data)) {
$user_data = db_get_row("SELECT * FROM ?:users WHERE {$field} = ?s AND user_type IN ('A', 'V', 'P')", $user_login);
}
if (!empty($user_data)) {
$user_data['usergroups'] = fn_get_user_usergroups($user_data['user_id']);
}
if (!empty($user_data['status']) && $user_data['status'] == 'D') {
fn_set_notification('E', __('error'), __('error_account_disabled'));
$status = false;
}
$salt = isset($user_data['salt']) ? $user_data['salt'] : '';
return array($status, $user_data, $user_login, $password, $salt);
}
示例5: execute
function execute($requests)
{
$u = $GLOBALS['AUTH']->uid();
$sessid = session_id();
$sql = 'SELECT c_member_id, nickname FROM c_member WHERE c_member_id <> ?';
$params = array($u);
$members = db_get_all($sql, $params);
$sql = 'SELECT c_member_id, nickname FROM c_member WHERE c_member_id = ?';
$params = array($u);
$my_info = db_get_row($sql, $params);
array_unshift($members, $my_info);
$id = $requests['target_id'];
$group = biz_getGroupData($id);
if ($u != $group['admin_id']) {
die('アクセスできません。');
}
foreach ($members as $key => $value) {
if (biz_isGroupMember($value['c_member_id'], $id)) {
$members[$key]['joined'] = true;
} else {
$members[$key]['joined'] = false;
}
}
$this->set('inc_navi', fetch_inc_navi('h'));
$this->set("c_invite_list", $members);
$this->set("group", $group);
$this->set("c_member_id", $u);
return 'success';
}
示例6: fn_age_verification_category_check
function fn_age_verification_category_check($category_id)
{
if (!empty($_SESSION['auth']['age'])) {
$age = $_SESSION['auth']['age'];
} else {
$age = 0;
}
while ($category_id) {
$data = db_get_row("SELECT category_id, parent_id, age_verification, age_limit FROM ?:categories WHERE category_id = ?i", $category_id);
if (empty($data)) {
return array(false, 0);
}
if ($data['age_verification'] == 'Y') {
if (!$age) {
return array('form', $data['category_id']);
} else {
if ($age < $data['age_limit']) {
return array('deny', $data['category_id']);
}
}
}
$category_id = $data['parent_id'];
}
return array(false, 0);
}
示例7: db_get_field
function db_get_field($sql, $field)
{
$row = db_get_row($sql);
if (count($row) > 0) {
return $row[0][$field];
}
return "";
}
示例8: fn_exim_get_user_info
function fn_exim_get_user_info($email)
{
if (!empty($email)) {
$user = db_get_row("SELECT company_id, is_root FROM ?:users WHERE email = ?s", $email);
} else {
$user = false;
}
return $user;
}
示例9: getProductImage
function getProductImage($product_id)
{
$image_path = db_get_row("SELECT image_path FROM cscart_images WHERE image_id = (SELECT detailed_id FROM cscart_images_links WHERE object_type='product' AND type='M' AND object_id='{$product_id}')");
//return Storage::instance('images')->getAbsolutePath($image_path['image_path']);
if (file_exists($_SERVER["DOCUMENT_ROOT"] . '/images/detailed/0/' . $image_path['image_path'])) {
return 'http://' . $_SERVER['SERVER_NAME'] . '/images/detailed/0/' . $image_path['image_path'];
}
return 'http://' . $_SERVER['SERVER_NAME'] . '/images/detailed/1/' . $image_path['image_path'];
}
示例10: fn_get_banner_data
function fn_get_banner_data($banner_id, $lang_code = CART_LANGUAGE)
{
$status_condition = AREA == 'A' ? '' : " AND ?:banners.status IN ('A', 'H') ";
$banner = db_get_row("SELECT ?:banners.banner_id, ?:banners.status, ?:banners.url, ?:banner_descriptions.banner, ?:banners.type, ?:banners.target, ?:banners.localization, ?:banners.timestamp, ?:banner_descriptions.description FROM ?:banners LEFT JOIN ?:banner_descriptions ON ?:banner_descriptions.banner_id = ?:banners.banner_id AND ?:banner_descriptions.lang_code = ?s WHERE ?:banners.banner_id = ?i ?p", $lang_code, $banner_id, $status_condition);
if (!empty($banner)) {
$banner['main_pair'] = fn_get_image_pairs($banner['banner_id'], 'banner', 'M', true, false, $lang_code);
}
return $banner;
}
示例11: fn_get_postcode_location
function fn_get_postcode_location($postcode_location_id, $lang_code = CART_LANGUAGE)
{
$fields = array('?:postcode_locations.*', '?:postcode_location_descriptions.*', '?:country_descriptions.country as country_title');
$join = db_quote(" LEFT JOIN ?:postcode_location_descriptions ON ?:postcode_locations.postcode_location_id = ?:postcode_location_descriptions.postcode_location_id AND ?:postcode_location_descriptions.lang_code = ?s", $lang_code);
$join .= db_quote(" LEFT JOIN ?:country_descriptions ON ?:postcode_locations.country = ?:country_descriptions.code AND ?:country_descriptions.lang_code = ?s", $lang_code);
$condition = db_quote(" ?:postcode_locations.postcode_location_id = ?i ", $postcode_location_id);
$condition .= AREA == 'C' && defined('CART_LOCALIZATION') ? fn_get_localizations_condition('?:postcode_locations.localization') : '';
$postcode_location = db_get_row('SELECT ?p FROM ?:postcode_locations ?p WHERE ?p', implode(', ', $fields), $join, $condition);
return $postcode_location;
}
示例12: _processProfileFields
protected function _processProfileFields()
{
$fields = array('profile_show', 'checkout_show', 'partner_show');
$billing = db_get_row("SELECT " . implode(', ', $fields) . " FROM ?:profile_fields WHERE field_name = 'email' AND section = 'B'");
$shipping = array();
foreach ($fields as $field) {
$shipping[$field] = $billing[$field] == 'Y' ? 'N' : 'Y';
}
return db_query("UPDATE ?:profile_fields SET ?u WHERE field_name = 'email' AND section = 'S'", $shipping);
}
示例13: db_banner_is_after_auth_banner
/**
* 認証後のみ表示されるバナーかどうかをバナーIDから確認
*
* @param int $c_banner_id
* @return bool
*/
function db_banner_is_after_auth_banner($c_banner_id)
{
$sql = 'SELECT is_hidden_before, is_hidden_after FROM c_banner WHERE c_banner_id = ?';
$params = array($c_banner_id);
$c_banner = db_get_row($sql, $params);
if ($c_banner['is_hidden_before'] && !$c_banner['is_hidden_after']) {
return true;
} else {
return false;
}
}
示例14: getProductImage
function getProductImage($product_id)
{
$image_path = db_get_row("SELECT image_path FROM cscart_images WHERE image_id = (SELECT detailed_id FROM cscart_images_links WHERE object_type='product' AND type='M' AND object_id='{$product_id}')");
if (!$image_path['image_path']) {
return $this->http . '/images/no_image.gif';
}
if (file_exists($_SERVER["DOCUMENT_ROOT"] . '/images/detailed/0/' . $image_path['image_path'])) {
return $this->http . '/images/detailed/0/' . $image_path['image_path'];
}
return $this->http . '/images/detailed/1/' . $image_path['image_path'];
}
示例15: fn_get_store_location
function fn_get_store_location($store_location_id, $lang_code = CART_LANGUAGE)
{
$fields = array('?:store_locations.*', '?:store_location_descriptions.*', '?:country_descriptions.country as country_title');
$join = db_quote(" LEFT JOIN ?:store_location_descriptions ON ?:store_locations.store_location_id = ?:store_location_descriptions.store_location_id AND ?:store_location_descriptions.lang_code = ?s", $lang_code);
$join .= db_quote(" LEFT JOIN ?:country_descriptions ON ?:store_locations.country = ?:country_descriptions.code AND ?:country_descriptions.lang_code = ?s", $lang_code);
$condition = db_quote(" ?:store_locations.store_location_id = ?i ", $store_location_id);
$condition .= AREA == 'C' && defined('CART_LOCALIZATION') ? fn_get_localizations_condition('?:store_locations.localization') : '';
$store_location = db_get_row('SELECT ?p FROM ?:store_locations ?p WHERE ?p', implode(', ', $fields), $join, $condition);
$store_location["image_pairs"] = fn_get_image_pairs($store_location_id, 'store_locations', 'M', true, true, $lang_code);
$store_location["additional_image_pairs"] = fn_get_image_pairs($store_location_id, 'store_locations', 'A', true, true, $lang_code);
return $store_location;
}