本文整理汇总了PHP中cs_sql_insert函数的典型用法代码示例。如果您正苦于以下问题:PHP cs_sql_insert函数的具体用法?PHP cs_sql_insert怎么用?PHP cs_sql_insert使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cs_sql_insert函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: cs_categories_create
function cs_categories_create($mod, $categories_name)
{
$return = 0;
if (empty($categories_name)) {
return 0;
}
$get = "categories_mod='" . $mod . "' AND categories_name = '" . cs_sql_escape($categories_name) . "'";
$get_data = cs_sql_select(__FILE__, 'categories', 'categories_id', $get, 'categories_name');
if (empty($get_data['categories_id'])) {
$columns = array('categories_mod', 'categories_name');
$values = array($mod, $categories_name);
cs_sql_insert(__FILE__, 'categories', $columns, $values);
$find = "categories_mod='" . $mod . "' AND categories_name = '" . cs_sql_escape($categories_name) . "'";
$find_data = cs_sql_select(__FILE__, 'categories', 'categories_id', $find, 'categories_name');
$return = $find_data['categories_id'];
} else {
$return = $get_data['categories_id'];
}
return $return;
}
示例3: array_values
}
$result = array_values(array_diff($all_smileys, $act_smileys));
if (!empty($result)) {
$counter = 0;
for ($run = 0; $run < count($result); $run++) {
$data['file'][$run]['name'] = $result[$run];
$data['file'][$run]['preview'] = cs_html_img('uploads/abcode/' . $result[$run]);
$data['file'][$run]['run'] = empty($data['file'][$run]['run']) ? '' : $data['file'][$run]['run'];
$data['file'][$run]['order'] = empty($_POST['order_' . $counter]) ? '' : (int) $_POST['order_' . $counter];
$data['file'][$run]['counter'] = $counter;
$counter++;
}
}
} else {
for ($run = 0; $run < count($data['file']); $run++) {
$sql_cells = array('abcode_func', 'abcode_pattern', 'abcode_file', 'abcode_order');
$sql_saves = array('img', $data['file'][$run]['run'], $data['file'][$run]['name'], $data['file'][$run]['order']);
cs_sql_insert(__FILE__, 'abcode', $sql_cells, $sql_saves);
}
cs_cache_delete('abcode_smileys');
cs_cache_delete('abcode_content');
cs_redirect($cs_lang['changes_done'], 'abcode', 'manage');
}
if (empty($data['file'])) {
$data['if']['no_smileys'] = true;
$data['if']['smileys'] = false;
} else {
$data['if']['no_smileys'] = false;
$data['if']['smileys'] = true;
}
echo cs_subtemplate(__FILE__, $data, 'abcode', 'import');
示例4: foreach
$data['users']['nick'] = $users_nick;
$matches[1] = $cs_lang['pic_infos'];
$return_types = '';
foreach ($img_filetypes as $add) {
$return_types .= empty($return_types) ? $add : ', ' . $add;
}
$matches[2] = $cs_lang['max_width'] . $op_clans['max_width'] . ' px' . cs_html_br(1);
$matches[2] .= $cs_lang['max_height'] . $op_clans['max_height'] . ' px' . cs_html_br(1);
$matches[2] .= $cs_lang['max_size'] . cs_filesize($op_clans['max_size']) . cs_html_br(1);
$matches[2] .= $cs_lang['filetypes'] . $return_types;
$data['clans']['clip'] = cs_abcode_clip($matches);
echo cs_subtemplate(__FILE__, $data, 'clans', 'create');
} else {
$clans_cells = array_keys($cs_clans);
$clans_save = array_values($cs_clans);
cs_sql_insert(__FILE__, 'clans', $clans_cells, $clans_save);
if (!empty($files['picture']['tmp_name'])) {
$where = "clans_name = '" . cs_sql_escape($cs_clans['clans_name']) . "'";
$getid = cs_sql_select(__FILE__, 'clans', 'clans_id', $where);
$filename = 'picture-' . $getid['clans_id'] . '.' . $extension;
cs_upload('clans', $filename, $files['picture']['tmp_name']);
$cs_clans2['clans_picture'] = $filename;
$clans2_cells = array_keys($cs_clans2);
$clans2_save = array_values($cs_clans2);
cs_sql_update(__FILE__, 'clans', $clans2_cells, $clans2_save, $getid['clans_id']);
}
if ($account['access_wizard'] == 5) {
cs_redirect($cs_lang['create_done'], 'clans', 'manage');
} else {
cs_redirect($cs_lang['create_done'], 'clans');
}
示例5: cs_html_br
$error++;
$errormsg .= $cs_lang['no_text'] . cs_html_br(1);
}
$exists = cs_sql_count(__FILE__, 'boardreport', "threads_id = " . (int) $tid . " AND comments_id = " . (int) $cid);
if (!empty($exists)) {
$error++;
$errormsg .= $cs_lang['report_exists'] . cs_html_br(1);
}
}
if (!empty($error)) {
$data['lang']['body'] = $errormsg;
} elseif (!isset($_POST['submit'])) {
$data['lang']['body'] = $cs_lang['fill_out_all_fields'];
} else {
$data['lang']['body'] = $cs_lang['report_success'];
}
if (!empty($error) or !isset($_POST['submit'])) {
$data['action']['form'] = cs_url('board', 'report');
$data['report']['tid'] = $tid;
$data['report']['cid'] = $cid;
} else {
$report_cells = array('threads_id', 'comments_id', 'users_id', 'boardreport_time', 'boardreport_text');
$report_save = array($tid, $cid, $account['users_id'], cs_time(), $report);
cs_sql_insert(__FILE__, 'boardreport', $report_cells, $report_save);
cs_cache_delete('count_boardreport');
require_once 'mods/notifymods/functions.php';
$users_nick = cs_sql_select(__FILE__, 'users', 'users_nick', 'users_id = ' . $account['users_id']);
notifymods_mail('board', $account['users_id'], array($users_nick['users_nick'], $cs_thread['threads_headline'], $report));
cs_redirect($cs_lang['report_success'], 'board', 'thread', 'where=' . $tid);
}
echo cs_subtemplate(__FILE__, $data, 'board', 'report');
示例6: 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);
示例7: isset
$cs_gallery_pic['gallery_name'] = $name;
$cs_gallery_pic['gallery_status'] = isset($_POST['gallery_status']) ? $_POST['gallery_status'] : 0;
$cs_gallery_pic['gallery_access'] = isset($_POST['gallery_access']) ? $_POST['gallery_access'] : 0;
$cs_gallery_pic['gallery_watermark'] = $_POST['gallery_watermark'];
if (!empty($_POST['gallery_watermark'])) {
$watermark_pos = $_POST['watermark_pos'];
$watermark_trans = $_POST['gallery_watermark_trans'];
$cs_gallery_pic['gallery_watermark_pos'] = $watermark_pos . '|--@--|' . $watermark_trans;
}
$extension = strlen(strrchr($name, "."));
$file = strlen($name);
$filename = substr($name, 0, $file - $extension);
$cs_gallery_pic['gallery_titel'] = $filename;
$cs_gallery_pic['gallery_time'] = cs_time();
$gallery_cells = array_keys($cs_gallery_pic);
$gallery_save = array_values($cs_gallery_pic);
cs_sql_insert(__FILE__, 'gallery', $gallery_cells, $gallery_save);
}
$data['pics'][$run]['img'] = cs_html_img('mods/gallery/image.php?picname=' . $name);
$data['pics'][$run]['name'] = $name;
}
}
}
cs_redirect($cs_lang['create_done'], 'gallery');
}
if (!isset($_POST['submit_1'])) {
if (!isset($_POST['submit']) or !empty($error)) {
$data['if']['start'] = TRUE;
}
}
echo cs_subtemplate(__FILE__, $data, 'gallery', 'manage_advanced');
示例8: cs_html_br
$error .= cs_html_br(1) . '- ' . $cs_lang['double'];
}
if (empty($account['users_id']) || $cs_shout['shoutbox_name'] != $account['users_nick']) {
$nick_valid = cs_sql_count(__FILE__, 'users', 'users_nick = \'' . cs_sql_escape($cs_shout['shoutbox_name']) . '\'');
if (!empty($nick_valid)) {
$error .= cs_html_br(1) . '- ' . $cs_lang['user_exists'];
}
}
if (!empty($error)) {
$data['lang']['body'] = $cs_lang['errors'] . ' ' . $error;
$data['form']['url'] = cs_url('shoutbox', 'create');
$data['form']['name'] = cs_secure($cs_shout['shoutbox_name']);
$data['form']['message'] = cs_secure($cs_shout['shoutbox_text']);
if (!empty($captcha) && empty($account['users_id'])) {
$data['form']['captcha'] = cs_html_img('mods/captcha/generate.php?time=' . cs_time() . '&mini');
$data['form']['show'] = cs_subtemplate(__FILE__, $data, 'shoutbox', 'captcha');
} else {
$data['form']['show'] = '';
}
echo cs_subtemplate(__FILE__, $data, 'shoutbox', 'create');
} else {
$cells = array_keys($cs_shout);
$values = array_values($cs_shout);
cs_sql_insert(__FILE__, 'shoutbox', $cells, $values);
$data['shoutbox']['done'] = cs_html_link($uri, $cs_lang['continue'], 0);
echo cs_subtemplate(__FILE__, $data, 'shoutbox', 'submit');
}
} else {
$data['shoutbox']['no_submit'] = $cs_lang['no_submit'];
echo cs_subtemplate(__FILE__, $data, 'shoutbox', 'no_submit');
}
示例9: cs_abcode_features
if (empty($cs_main['rte_html'])) {
$data['abcode']['features'] = cs_abcode_features('news_text', $abcode[3], 1);
$data['abcode']['smileys'] = cs_abcode_smileys('news_text', 1);
$data['abcode']['features_readmore'] = cs_abcode_features('news_readmore', $abcode[3], 1);
$data['abcode']['smileys_readmore'] = cs_abcode_smileys('news_readmore', 1);
$data['if']['rte_html'] = false;
$data['if']['abcode'] = true;
} else {
$data['if']['rte_html'] = true;
$data['if']['abcode'] = false;
$data['rte']['html'] = cs_rte_html('news_text', $cs_news['news_text']);
$data['rte']['html_readmore'] = cs_rte_html('news_readmore', $cs_news['news_readmore']);
}
$data['news']['loop'] = $run_loop;
$data['news']['news_readmore_active'] = $cs_news['news_readmore_active'] == 1 ? 'checked="checked"' : '';
$data['news']['news_close'] = $cs_news['news_close'] == 1 ? 'checked="checked"' : '';
$data['news']['news_public'] = $cs_news['news_public'] == 1 ? 'checked="checked"' : '';
$data['news']['news_attached'] = $cs_news['news_attached'] == 1 ? 'checked="checked"' : '';
$data['news']['check_publish'] = !empty($cs_news['news_publishs_at']) ? 'checked="checked"' : '';
$data['news']['news_publishs_at'] = cs_dateselect('date', 'unix', !empty($cs_news['news_publishs_at']) ? $cs_news['news_publishs_at'] : cs_time(), 1995);
echo cs_subtemplate(__FILE__, $data, 'news', 'create');
} else {
$news_cells = array_keys($cs_news);
$news_save = array_values($cs_news);
cs_sql_insert(__FILE__, 'news', $news_cells, $news_save);
cs_cache_delete('news_publish');
if (!empty($cs_news['news_public'])) {
include_once 'mods/news/rss.php';
}
cs_redirect($cs_lang['news_created'], 'news');
}
示例10: cs_abcode_smileys
$levels++;
}
$data['cat']['abcode_smileys'] = cs_abcode_smileys('categories_text');
$data['cat']['abcode_features'] = cs_abcode_features('categories_text');
$matches[1] = $cs_lang['pic_infos'];
$return_types = '';
foreach ($img_filetypes as $add) {
$return_types .= empty($return_types) ? $add : ', ' . $add;
}
$matches[2] = $cs_lang['max_width'] . $op_categories['max_width'] . ' px' . cs_html_br(1);
$matches[2] .= $cs_lang['max_height'] . $op_categories['max_height'] . ' px' . cs_html_br(1);
$matches[2] .= $cs_lang['max_size'] . cs_filesize($op_categories['max_size']) . cs_html_br(1);
$matches[2] .= $cs_lang['filetypes'] . $return_types;
$data['cat']['picup_clip'] = cs_abcode_clip($matches);
echo cs_subtemplate(__FILE__, $data, 'categories', 'create');
} else {
$categories_cells = array_keys($cs_categories);
$categories_save = array_values($cs_categories);
cs_sql_insert(__FILE__, 'categories', $categories_cells, $categories_save);
if (!empty($files_gl['picture']['tmp_name'])) {
$where = "categories_name = '" . cs_sql_escape($cs_categories['categories_name']) . "'";
$getid = cs_sql_select(__FILE__, 'categories', 'categories_id', $where);
$filename = 'picture-' . $getid['categories_id'] . '.' . $extension;
cs_upload('categories', $filename, $files_gl['picture']['tmp_name']);
$cs_categories2['categories_picture'] = $filename;
$categories2_cells = array_keys($cs_categories2);
$categories2_save = array_values($cs_categories2);
cs_sql_update(__FILE__, 'categories', $categories2_cells, $categories2_save, $getid['categories_id']);
}
cs_redirect($cs_lang['create_done'], 'categories', 'manage', 'where=' . $cs_categories['categories_mod']);
}
示例11: foreach
$run = 0;
$run2 = 0;
foreach ($cs_rounds as $round) {
$run2++;
$data['maps'][$run]['name'] = $round['maps_name'];
$data['maps'][$run]['result'] = $round['rounds_score1'] . ' : ' . $round['rounds_score2'];
$data['maps'][$run]['rounds_id'] = $round['rounds_id'];
$up = $run2 != 1 ? cs_link($img_up, 'wars', 'rounds', 'id=' . $wars_id . '&up=' . $round['rounds_id']) : '-';
$down = $run2 != $count ? cs_link($img_down, 'wars', 'rounds', 'id=' . $wars_id . '&down=' . $round['rounds_id']) : '-';
$data['maps'][$run]['up_down'] = $up . ' ' . $down;
$run++;
}
} else {
$data['if']['rounds'] = false;
}
echo cs_subtemplate(__FILE__, $data, 'wars', 'rounds');
} else {
if (!empty($new_map)) {
$get_game_id = cs_sql_select(__FILE__, 'wars', 'games_id', 'wars_id = \'' . $cs_rounds['wars_id'] . '\'');
$cells1 = array('maps_name', 'games_id');
$values1 = array($_POST['new_map'], $get_game_id['games_id']);
cs_sql_insert(__FILE__, 'maps', $cells1, $values1);
$cs_rounds['maps_id'] = cs_sql_insertid(__FILE__);
} else {
$cs_rounds['maps_id'] = (int) $_POST['maps_id'];
}
$cells2 = array_keys($cs_rounds);
$values2 = array_values($cs_rounds);
cs_sql_insert(__FILE__, 'rounds', $cells2, $values2);
cs_redirect($cs_lang['create_done'], 'wars', 'rounds', 'id=' . $cs_rounds['wars_id']);
}
示例12: empty
$data['check']['multi_yes'] = $_POST['events_multi'] == 'yes' ? $selected : '';
$data['data']['events_multix'] = $_POST['events_multix'];
$checked = 'checked="checked"';
$data['check']['close'] = empty($cs_events['events_close']) ? '' : $checked;
$data['check']['cancel'] = empty($cs_events['events_cancel']) ? '' : $checked;
echo cs_subtemplate(__FILE__, $data, 'events', 'create');
} else {
settype($cs_events['events_guestsmin'], 'integer');
settype($cs_events['events_guestsmax'], 'integer');
settype($cs_events['events_needage'], 'integer');
$events_cells = array_keys($cs_events);
$events_save = array_values($cs_events);
cs_sql_insert(__FILE__, 'events', $events_cells, $events_save);
if ($_POST['events_multi'] == 'yes') {
$mode = date('I', $cs_events['events_time']);
for ($run = 0; $run < $_POST['events_multix']; $run++) {
$cs_events['events_time'] = strtotime("+1 week", $cs_events['events_time']);
if (date('I', $cs_events['events_time']) > $mode) {
$cs_events['events_time'] = $cs_events['events_time'] - 3600;
$mode = 1;
} elseif (date('I', $cs_events['events_time']) < $mode) {
$cs_events['events_time'] = $cs_events['events_time'] + 3600;
$mode = 0;
}
$events_cells = array_keys($cs_events);
$events_save = array_values($cs_events);
cs_sql_insert(__FILE__, 'events', $events_cells, $events_save);
}
}
cs_redirect($cs_lang['create_done'], 'events');
}
示例13: elseif
} else {
$error = $cs_lang['error_id'];
}
}
if (!isset($_POST['submit'])) {
$data['head']['body'] = $cs_lang['body_create'];
} elseif (!empty($error)) {
$data['head']['body'] = $error;
}
if (!empty($error) or !isset($_POST['submit'])) {
$data['buddys']['nick'] = $buddys_nick;
if (empty($users_add_id)) {
$more = 'onkeyup="Clansphere.ajax.user_autocomplete(\'buddys_nick\', \'output\', \'' . $cs_main['php_self']['dirname'] . '\')" id="buddys_nick"';
$data['if']['empty_users_id'] = TRUE;
$data['if']['users_id'] = FALSE;
$data['input']['more'] = $more;
} else {
$data['if']['empty_users_id'] = FALSE;
$data['if']['users_id'] = TRUE;
$data['buddys']['nick_sec'] = cs_secure($buddys_nick);
}
$data['abcode']['smileys'] = cs_abcode_smileys('buddys_notice');
$data['abcode']['features'] = cs_abcode_features('buddys_notice');
$data['create']['buddys_notice'] = $buddys_notice;
echo cs_subtemplate(__FILE__, $data, 'buddys', 'create');
} else {
$buddys_cells = array('users_id', 'buddys_user', 'buddys_time', 'buddys_notice');
$buddys_save = array($users_id, $buddys_id, $time, $buddys_notice);
cs_sql_insert(__FILE__, 'buddys', $buddys_cells, $buddys_save);
cs_redirect($cs_lang['create_done'], 'buddys', 'center');
}
示例14: foreach
foreach ($matches as $matchnr => $match) {
$cs_cups = array();
$cs_cups['cups_id'] = $id;
$cs_cups['squad1_id'] = isset($match['squad_id1']) ? $match['squad_id1'] : 0;
$cs_cups['squad2_id'] = isset($match['squad_id2']) ? $match['squad_id2'] : 0;
$cs_cups['cupmatches_loserbracket'] = $match['loserbracket'];
$cs_cups['cupmatches_round'] = $match['round'];
$cs_cups['cupmatches_tree_order'] = $match['tree_order'];
$cs_cups['cupmatches_match'] = $matchnr;
$cs_cups['cupmatches_nextmatch'] = $match['nextmatch'];
$cs_cups['cupmatches_nextmatchlb'] = $match['nextmatchlb'];
$cs_cups['cupmatches_seed1'] = $match['seed1'];
$cs_cups['cupmatches_seed2'] = $match['seed2'];
$cells = array_keys($cs_cups);
$values = array_values($cs_cups);
cs_sql_insert(__FILE__, 'cupmatches', $cells, $values);
}
/* autoclose the matches */
cs_cups_autoclose($id);
}
cs_redirect($cs_lang['started_successfully'], 'cups', 'manage');
} else {
$id = (int) $_GET['id'];
$cupsel = cs_sql_select(__FILE__, 'cups', 'cups_teams, cups_system', 'cups_id = ' . $id);
if ($cupsel['cups_system'] == CS_CUPS_TYPE_TEAMS) {
// remove squads automatically which doesn't exist anymore in the database
$del = cs_sql_select(__FILE__, 'cupsquads cq LEFT JOIN {pre}_squads sq ON cq.squads_id = sq.squads_id', 'cq.squads_id', 'sq.squads_id IS NULL AND cups_id = ' . $id, 0, 0, 0);
if (!empty($del)) {
foreach ($del as $del_id) {
cs_sql_delete(__FILE__, 'cupsquads', $del_id['squads_id'], 'squads_id');
}
示例15: cs_translate
$cs_lang = cs_translate('boardranks');
$data = array();
if (isset($_POST['submit'])) {
$boardranks_min = $_POST['boardranks_min'];
$boardranks_name = $_POST['boardranks_name'];
$error = '';
if ($boardranks_min == '') {
$error .= $cs_lang['no_min'] . cs_html_br(1);
}
if (empty($boardranks_name)) {
$error .= $cs_lang['no_name'] . cs_html_br(1);
}
} else {
$boardranks_min = '';
$boardranks_name = '';
}
if (!isset($_POST['submit']) or empty($error)) {
$data['head']['body'] = $cs_lang['body'];
} elseif (!empty($error)) {
$data['head']['body'] = $error;
}
if (!empty($error) or !isset($_POST['submit'])) {
$data['boardranks']['min'] = $boardranks_min;
$data['boardranks']['name'] = $boardranks_name;
echo cs_subtemplate(__FILE__, $data, 'boardranks', 'create');
} else {
$cells = array('boardranks_min', 'boardranks_name');
$content = array($boardranks_min, $boardranks_name);
cs_sql_insert(__FILE__, 'boardranks', $cells, $content);
cs_redirect($cs_lang['create_done'], 'boardranks');
}