本文整理汇总了PHP中cs_sql_select函数的典型用法代码示例。如果您正苦于以下问题:PHP cs_sql_select函数的具体用法?PHP cs_sql_select怎么用?PHP cs_sql_select使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cs_sql_select函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: cs_newsletter_emails
function cs_newsletter_emails($select)
{
$from = '';
$where = '';
$check_to = explode('?', $select);
switch ($check_to[0]) {
case 1:
$from = 'users usr';
$where = '';
break;
break;
case 2:
$from = 'access acs INNER JOIN {pre}_users usr ON usr.access_id = acs.access_id ';
$where = "acs.access_id = " . (int) $check_to[1];
break;
break;
case 3:
$from = 'squads squ INNER JOIN {pre}_members meb ON meb.squads_id = squ.squads_id ' . 'INNER JOIN {pre}_users usr ON meb.users_id = usr.users_id';
$where = "squ.squads_id = " . (int) $check_to[1];
break;
break;
case 4:
$from = 'clans cln INNER JOIN {pre}_squads squ ON squ.clans_id = cln.clans_id ' . 'INNER JOIN {pre}_members meb ON meb.squads_id = squ.squads_id ' . 'INNER JOIN {pre}_users usr ON meb.users_id = usr.users_id';
$where = "cln.clans_id = " . (int) $check_to[1];
break;
break;
}
$select = 'usr.users_email AS email';
$where_add = 'usr.users_newsletter = 1 AND usr.users_active = 1 AND usr.users_delete = 0';
$where = empty($where) ? $where_add : $where . ' AND ' . $where_add;
return cs_sql_select(__FILE__, $from, $select, $where, 0, 0, 0);
}
示例2: cs_pictures_upload
function cs_pictures_upload($file, $mod, $fid, $ajaxclean = 1)
{
if (!empty($_POST['del_picture'])) {
cs_pictures_delete($_POST['del_picture']);
}
if (empty($file['tmp_name'])) {
return true;
}
settype($fid, 'integer');
$types_allowed = array('image/jpeg', 'image/png', 'image/pjpeg', 'image/x-png');
if (!in_array($file['type'], $types_allowed)) {
return false;
}
$exts = array('image/jpeg' => 'jpg', 'image/png' => 'png', 'image/pjpeg' => 'jpg', 'image/x-png' => 'png');
$ext = $exts[$file['type']];
$where = "pictures_fid = '" . $fid . "' AND pictures_mod = '" . $mod . "'";
$already = cs_sql_select(__FILE__, 'pictures', 'pictures_id', $where);
$pictures_id = $already['pictures_id'];
if (empty($already)) {
$vars = array();
$vars['pictures_mod'] = $mod;
$vars['pictures_fid'] = $fid;
cs_sql_insert(__FILE__, 'pictures', array_keys($vars), array_values($vars));
$pictures_id = cs_sql_insertid(__FILE__);
}
if (!cs_upload('pictures', 'picture-' . $pictures_id . '.' . $ext, $file['tmp_name'], $ajaxclean)) {
cs_sql_delete(__FILE__, 'pictures', $pictures_id);
return false;
}
$cells = array('pictures_file');
$content = array('picture-' . $pictures_id . '.' . $ext);
cs_sql_update(__FILE__, 'pictures', $cells, $content, $pictures_id);
return true;
}
示例3: cs_find_move
function cs_find_move($folders_id, $usersgallery_id)
{
$sql_tmp = cs_sql_select(__FILE__, 'usersgallery', 'usersgallery_id', 'folders_id = ' . $folders_id, 'usersgallery_id DESC', 0, 0);
$tmp = 0;
foreach ($sql_tmp as $search_tmp) {
if (in_array($usersgallery_id, $search_tmp)) {
return $tmp;
}
$tmp++;
}
return FALSE;
}
示例4: notifymods_mail
function notifymods_mail($mod, $users_id = 0, $var = NULL)
{
// $mail_text[$lang] = cs_translate('notifymods'); // not implicitly necessary
if (!is_array($var)) {
$var = array($var);
}
$mails_send = 0;
$from = "notifymods ntm INNER JOIN {pre}_users usr ON ntm.notifymods_user = usr.users_id";
$where = "ntm.notifymods_user != '" . $users_id . "' \n AND usr.users_delete != 1\n AND usr.users_active = 1\n AND ntm.notifymods_" . $mod . " = 1";
$ntm_users = cs_sql_select(__FILE__, $from, 'usr.users_lang, usr.users_email', $where, 0, 0, 0);
$pattern1 = '/\'(?<mod>.*)_text\'\\](\\s*)=(\\s*)\'(?<value>.*)\';/';
$pattern2 = '/\'(?<mod>.*)_subject\'\\](\\s*)=(\\s*)\'(?<value>.*)\';/';
if (!empty($ntm_users)) {
foreach ($ntm_users as $mail_user) {
$lang = empty($mail_user['users_lang']) ? $cs_main['def_lang'] : $mail_user['users_lang'];
if (empty($mail_text[$lang][$mod . '_text'])) {
$mail_text[$lang] = cs_cache_load('lang_notifymods_' . $lang);
if ($mail_text[$lang] === FALSE and file_exists('lang/' . $lang . '/notifymods.php')) {
// read lang-file and search for text- & subject-placeholder
$fp = fopen('lang/' . $lang . '/notifymods.php', 'r');
$file_content = '';
while (!feof($fp)) {
$file_content .= fgets($fp, 4096);
}
fclose($fp);
preg_match_all($pattern1, $file_content, $match);
$run = 0;
foreach ($match['mod'] as $lang_mod) {
$mail_text[$lang][$lang_mod . '_text'] = $match['value'][$run];
$run++;
}
preg_match_all($pattern2, $file_content, $match);
$run = 0;
foreach ($match['mod'] as $lang_mod) {
$mail_text[$lang][$lang_mod . '_subject'] = $match['value'][$run];
$run++;
}
cs_cache_save('lang_notifymods_' . $lang, $mail_text[$lang]);
}
}
if (empty($text[$lang])) {
$text[$lang] = empty($var) ? $mail_text[$lang][$mod . '_text'] : vsprintf($mail_text[$lang][$mod . '_text'], $var);
}
if (cs_mail($mail_user['users_email'], $mail_text[$lang][$mod . '_subject'], $text[$lang])) {
$mails_send++;
}
}
return $mails_send;
}
}
示例5: cs_captchacheck
function cs_captchacheck($input, $mini = 0)
{
if (!extension_loaded('gd')) {
return true;
}
$ip = cs_getip();
$timeout = cs_time() - 900;
$string = empty($mini) ? cs_sql_escape($input) : 'mini_' . cs_sql_escape($input);
$cond = 'captcha_ip = \'' . cs_sql_escape($ip) . '\' AND ';
$cond .= 'captcha_time > \'' . $timeout . '\' AND ';
$cond .= 'captcha_string = \'' . $string . '\'';
$hash_db = cs_sql_select(__FILE__, 'captcha', 'captcha_id', $cond);
if (empty($hash_db)) {
return false;
}
cs_sql_delete(__FILE__, 'captcha', $hash_db['captcha_id']);
return true;
}
示例6: cs_board_last
function cs_board_last($board_id)
{
settype($board_id, 'integer');
$from = 'threads thr LEFT JOIN {pre}_users usr ON thr.users_id = usr.users_id LEFT JOIN {pre}_users uco ON thr.threads_last_user = uco.users_id';
$where = "thr.board_id = '" . $board_id . "'";
$cells = 'thr.threads_last_time AS board_last_time, thr.threads_headline AS board_last_thread, thr.threads_id AS board_last_threadid, ' . 'thr.threads_last_user AS board_last_userid, uco.users_nick AS board_last_user, ' . 'usr.users_nick AS create_user, usr.users_id AS create_userid, thr.threads_time AS create_time';
$last_sql = cs_sql_select(__FILE__, $from, $cells, $where, 'thr.threads_last_time DESC');
if (empty($last_sql)) {
$last_sql = array('board_last_time' => 0, 'board_last_thread' => 0, 'board_last_threadid' => 0, 'board_last_user' => 0, 'board_last_userid' => 0);
} else {
# fallback to creation if no last data is available
if (empty($last_sql['board_last_user'])) {
$last_sql['board_last_user'] = $last_sql['create_user'];
$last_sql['board_last_userid'] = $last_sql['create_userid'];
$last_sql['board_last_time'] = $last_sql['create_time'];
}
unset($last_sql['create_user'], $last_sql['create_userid'], $last_sql['create_time']);
}
cs_sql_update(__FILE__, 'board', array_keys($last_sql), array_values($last_sql), $board_id);
return $last_sql;
}
示例7: cs_categories_dropdown2
function cs_categories_dropdown2($mod, $categories_id = 0, $new = 1, $name = 'categories_id')
{
global $account;
$data = array();
$cells = 'categories_id, categories_name, categories_subid';
$categories = cs_sql_select(__FILE__, 'categories', $cells, "categories_mod = '" . $mod . "' AND categories_access <= '" . $account['access_news'] . "'", 'categories_subid ASC, categories_name', 0, 0);
$categories = cs_catsort($categories);
$data['categories']['options'] = '';
if (!empty($categories)) {
foreach ($categories as $cat) {
$blank = '';
if (!empty($cat['layer'])) {
for ($i = 0; $i < $cat['layer']; $i++) {
$blank .= ' ';
}
$blank .= '»';
}
$data['categories']['options'] .= cs_html_option($blank . $cat['categories_name'], $cat['categories_id'], $cat['categories_id'] == $categories_id);
}
}
$data['if']['new'] = !empty($new) ? TRUE : FALSE;
$data['dropdown']['name'] = $name;
return cs_subtemplate(__FILE__, $data, 'categories', 'cat_dropdown2');
}
示例8: array_keys
} else {
$cs_maps['games_id'] = (int) $_POST['games_id'];
$cs_maps['maps_name'] = $_POST['maps_name'];
$cs_maps['server_name'] = $_POST['server_name'];
$cs_maps['maps_text'] = $_POST['maps_text'];
$maps_id = (int) $_POST['maps_id'];
if (empty($_POST['pic_del']) and empty($files_gl['picture']['tmp_name'])) {
$cells = array_keys($cs_maps);
$values = array_values($cs_maps);
cs_sql_update(__FILE__, 'maps', $cells, $values, $maps_id);
} elseif (isset($_POST['pic_del']) and empty($files_gl['picture']['tmp_name'])) {
$select = cs_sql_select(__FILE__, 'maps', 'maps_picture', 'maps_id = \'' . $maps_id . '\'');
cs_unlink('maps', $select['maps_picture']);
$cs_maps['maps_picture'] = '';
$cells = array_keys($cs_maps);
$values = array_values($cs_maps);
cs_sql_update(__FILE__, 'maps', $cells, $values, $maps_id);
} else {
$select = cs_sql_select(__FILE__, 'maps', 'maps_picture', 'maps_id = \'' . $maps_id . '\'');
$url = 'uploads/maps/' . $select['maps_picture'];
cs_unlink('maps', $select['maps_picture']);
$filename = 'picture-' . $maps_id . '.' . $extension;
cs_upload('maps', $filename, $files_gl['picture']['tmp_name']);
$cs_maps['maps_picture'] = $filename;
$cells = array_keys($cs_maps);
$values = array_values($cs_maps);
cs_sql_update(__FILE__, 'maps', $cells, $values, $maps_id);
}
cs_redirect($cs_lang['changes_done'], 'maps');
}
}
示例9: cs_datereal
<?php
// ClanSphere 2010 - www.clansphere.net
// $Id$
$thisday = cs_datereal('m-d');
$output = array();
$data = array();
$data = cs_cache_load('navbirth');
$cs_lang = cs_translate('users');
$options = cs_sql_option(__FILE__, 'users');
if ($data['day'] != $thisday) {
$data['day'] = $thisday;
$select = 'users_id, users_nick, users_age';
$where = "users_age LIKE '%-" . $data['day'] . "' AND users_hidden NOT LIKE '%users_age%' AND users_active = 1";
$order = 'users_nick ASC';
$data['users'] = cs_sql_select(__FILE__, 'users', $select, $where, $order, 0, 0);
cs_cache_save('navbirth', $data);
}
if (empty($data['users'])) {
echo $cs_lang['no_data'];
} else {
$count = empty($options['navbirth_max_users']) ? count($data['users']) : min(count($data['users']), $options['navbirth_max_users']);
for ($run = 0; $run < $count; $run++) {
$birth = explode('-', $data['users'][$run]['users_age']);
$output['users'][$run]['age'] = cs_datereal('Y') - $birth[0];
$output['users'][$run]['day'] = $birth[2];
$output['users'][$run]['month'] = $birth[1];
$output['users'][$run]['year'] = $birth[0];
$output['users'][$run]['user'] = cs_user($data['users'][$run]['users_id'], $data['users'][$run]['users_nick']);
$output['users'][$run]['messageurl'] = cs_url('messages', 'create', 'to_id=' . $data['users'][$run]['users_id']);
}
示例10: explode
$birth = explode('-', $cs_clan['clans_since']);
$age = cs_datereal('Y') - $birth[0];
if (cs_datereal('m') <= $birth[1]) {
$age--;
}
if (cs_datereal('d') >= $birth[2] and cs_datereal('m') == $birth[1]) {
$age++;
}
$content .= ' (' . $age . ')';
$data['clans']['since'] = $content;
} else {
$data['clans']['since'] = '-';
}
$select = 'squads_name, games_id, squads_id';
$where = "clans_id = '" . $cs_clans_id . "'";
$cs_squads = cs_sql_select(__FILE__, 'squads', $select, $where, 'squads_order, squads_name', 0, 0);
$squads_loop = count($cs_squads);
$data['lang']['game'] = $cs_lang['game'];
$data['lang']['squads'] = $cs_lang[$op_squads['label']];
$data['lang']['members'] = $cs_lang[$op_members['label']];
if (empty($squads_loop)) {
$data['squads'] = '';
}
for ($run = 0; $run < $squads_loop; $run++) {
if (!empty($cs_squads[$run]['games_id'])) {
$data['squads'][$run]['game'] = cs_html_img('uploads/games/' . $cs_squads[$run]['games_id'] . '.gif');
} else {
$data['squads'][$run]['game'] = '';
}
$data['squads'][$run]['squads'] = cs_link(cs_secure($cs_squads[$run]['squads_name']), 'squads', 'view', 'id=' . $cs_squads[$run]['squads_id']);
$where = "squads_id='" . $cs_squads[$run]['squads_id'] . "'";
示例11: elseif
} else {
$history['history_text'] = '';
$history['history_time'] = '';
$history['users_id'] = 0;
}
if (!isset($_POST['submit']) and !isset($_POST['preview'])) {
$data['head']['body'] = $cs_lang['body'];
} elseif (!empty($error)) {
$data['head']['body'] = $error;
} elseif (isset($_POST['preview'])) {
$data['head']['body'] = $cs_lang['preview'];
}
if (isset($_POST['preview']) and empty($error)) {
$data['if']['preview'] = TRUE;
$data['preview']['date'] = cs_date('unix', $history['history_time'], 1);
$cs_user = cs_sql_select(__FILE__, 'users', 'users_nick, users_active', "users_id = '" . $history['users_id'] . "'");
$data['preview']['user'] = cs_user($history['users_id'], $cs_user['users_nick'], $cs_user['users_active']);
$data['preview']['text'] = cs_secure($history['history_text'], 1, 1, 1, 1);
}
if (!empty($error) or !isset($_POST['submit']) or isset($_POST['preview'])) {
if (empty($cs_main['rte_html'])) {
$data['if']['no_rte_html'] = 1;
$data['history']['abcode_smileys'] = cs_abcode_smileys('history_text', 1);
$data['history']['abcode_features'] = cs_abcode_features('history_text', 1, 1);
$data['history']['text'] = $history['history_text'];
$data['if']['rte_html'] = 0;
} else {
$data['if']['rte_html'] = 1;
$data['if']['no_rte_html'] = 0;
$data['history']['rte_html'] = cs_rte_html('history_text', $history['history_text']);
}
示例12: cs_translate
// ClanSphere 2010 - www.clansphere.net
// $Id$
$cs_lang = cs_translate('board');
$count_abo = cs_sql_count(__FILE__, 'abonements', 'users_id=' . $account['users_id']);
$count_att = cs_sql_count(__FILE__, 'boardfiles', 'users_id=' . $account['users_id']);
$data = array();
$data['head']['getmsg'] = cs_getmsg();
$data['count']['abos'] = $count_abo;
$data['count']['attachments'] = $count_att;
$data['link']['abos'] = cs_url('board', 'center');
$data['link']['attachments'] = cs_url('board', 'attachments');
$data['link']['avatar'] = cs_url('board', 'avatar');
$data['action']['form'] = cs_url('board', 'signature');
$data['signature']['smileys'] = cs_abcode_smileys('signature');
$data['signature']['abcode'] = cs_abcode_features('signature');
$signature_sql = cs_sql_select($file, 'users', 'users_signature', "users_id = '" . $account['users_id'] . "'");
$signature = $signature_sql['users_signature'];
$signature = isset($_POST['signature']) ? $_POST['signature'] : $signature;
$signature = preg_replace_callback("=\\[img\\](.*?)\\[/img\\]=si", "cs_abcode_resize", $signature);
$signature = preg_replace_callback("=\\[img width\\=(.*?) height\\=(.*?)\\](.*?)\\[/img\\]=si", "cs_abcode_resize", $signature);
$data['signature']['text'] = $signature;
$data['signature']['preview'] = cs_secure($signature, 1, 1);
$data['if']['preview'] = (isset($_POST['preview']) and !empty($signature)) ? 1 : 0;
if (isset($_POST['submit'])) {
$signature_cells = array('users_signature');
$signature_save = array($signature);
cs_sql_update(__FILE__, 'users', $signature_cells, $signature_save, $account['users_id']);
cs_redirect($cs_lang['create_done'], 'board', 'signature');
}
$data['signature']['text'] = cs_secure($data['signature']['text']);
echo cs_subtemplate(__FILE__, $data, 'board', 'signature');
示例13: cs_html_option
$data['access']['options'] .= cs_html_option($levels . ' - ' . $cs_lang['lev_' . $levels], $levels, $sel);
$levels++;
}
$levels = 0;
$data['show']['options'] = '';
while ($levels < 2) {
$cs_gallery['gallery_status'] == $levels ? $sel = 1 : ($sel = 0);
$data['show']['options'] .= cs_html_option($levels . ' - ' . $cs_lang['show_' . $levels], $levels, $sel);
$levels++;
}
$cs_gallery['gallery_watermark'] = '';
$gallery_watermark_trans = '20';
if (extension_loaded('gd')) {
$no_watermark = $cs_lang['no_watermark'];
$no_cat_data_watermark = array('0' => array('categories_id' => '', 'categories_mod' => 'gallery-watermark', 'categories_name' => $no_watermark, 'categories_picture' => ''));
$cat_data_watermark_1 = cs_sql_select(__FILE__, 'categories', '*', "categories_mod = 'gallery-watermark'", 'categories_name', 0, 0);
if (empty($cat_data_watermark_1)) {
$cat_data_watermark = $no_cat_data_watermark;
} else {
$cat_data_watermark = array_merge($no_cat_data_watermark, $cat_data_watermark_1);
}
$search_value = $cs_gallery['gallery_watermark'];
if (!empty($search_value)) {
foreach ($cat_data_watermark as $key => $row) {
foreach ($row as $cell) {
if (strpos($cell, $search_value) !== FALSE) {
$watermark_id = $key;
}
}
}
}
示例14: cs_html_br
}
if (empty($cs_clans['clans_short'])) {
$error++;
$errormsg .= $cs_lang['no_short'] . cs_html_br(1);
}
$where = "clans_name = '" . cs_sql_escape($cs_clans['clans_name']) . "'";
$where .= " AND clans_id != " . (int) $clans_id;
$search = cs_sql_count(__FILE__, 'clans', $where);
if (!empty($search)) {
$error++;
$errormsg .= $cs_lang['name_exists'] . cs_html_br(1);
}
} else {
$cells = 'clans_name, clans_short, clans_tag, clans_tagpos, clans_country, clans_url, clans_since, clans_pwd, clans_picture, users_id';
$cs_clans = cs_sql_select(__FILE__, 'clans', $cells, "clans_id = " . (int) $clans_id);
$cs_users = cs_sql_select(__FILE__, 'users', 'users_nick', 'users_id = ' . (int) $cs_clans['users_id']);
$users_nick = $cs_users['users_nick'];
}
if (!isset($_POST['submit'])) {
$data['lang']['body'] = $cs_lang['errors_here'];
}
if (!empty($error)) {
$data['lang']['body'] = $errormsg;
}
if (!empty($error) or !isset($_POST['submit'])) {
$data['lang']['mod'] = $cs_lang[$op_clans['label']];
$data['clans']['name'] = cs_secure($cs_clans['clans_name']);
$data['clans']['short'] = cs_secure($cs_clans['clans_short']);
$data['clans']['tag'] = cs_secure($cs_clans['clans_tag']);
if ($cs_clans['clans_tagpos'] == '1') {
$data['select']['before'] = 'selected="selected"';
示例15: array
if (!empty($_POST['games_creator'])) {
$games_creator = $_POST['games_creator'];
}
if (!empty($_POST['games_url'])) {
$games_url = $_POST['games_url'];
}
if (!empty($_POST['games_version'])) {
$games_version = $_POST['games_version'];
}
$data['lang']['body'] = !isset($_POST['submit']) ? $cs_lang['body_create'] : $errormsg;
if (isset($_POST['submit']) && empty($games_error) && empty($symbol_error)) {
$games_cells = array('games_name', 'games_version', 'games_released', 'games_creator', 'categories_id', 'games_url', 'games_usk');
$games_save = array($games_name, $games_version, $games_release, $games_creator, $categories_id, $games_url, $games_usk);
cs_sql_insert(__FILE__, 'games', $games_cells, $games_save);
$where = "games_name = '" . cs_sql_escape($games_name) . "'";
$getid = cs_sql_select(__FILE__, 'games', 'games_id', $where);
if (!empty($files['symbol']['tmp_name']) and $symbol_error == 0) {
$filename = $getid['games_id'] . '.' . $extension;
cs_upload('games', $filename, $files['symbol']['tmp_name']);
} else {
copy('uploads/games/0.gif', 'uploads/games/' . (int) $getid['games_id'] . '.gif');
}
cs_redirect($cs_lang['create_done'], 'games');
}
$data['url']['form'] = cs_url('games', 'create');
$data['games']['name'] = $games_name;
$data['games']['version'] = $games_version;
$data['games']['genre'] = cs_categories_dropdown('games', $categories_id);
$data['games']['release'] = cs_dateselect('datum', 'date', $games_release);
$data['games']['creator'] = $games_creator;
$data['games']['homepage'] = $games_url;