本文整理汇总了PHP中insertBD函数的典型用法代码示例。如果您正苦于以下问题:PHP insertBD函数的具体用法?PHP insertBD怎么用?PHP insertBD使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了insertBD函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: pseudo_exists
function pseudo_exists($pseudo)
{
$query = Nw::$DB->query('SELECT COUNT(*) as count FROM ' . Nw::$prefix_table . 'members WHERE u_pseudo = \'' . insertBD(trim($pseudo)) . '\'') or Nw::$DB->trigger(__LINE__, __FILE__);
$dn = $query->fetch_assoc();
$query->free();
return $dn['count'] > 0;
}
示例2: search_news_bytag
function search_news_bytag($tag, $etat, $page = '', $element_par_page = 0)
{
$add_champs_sql = '';
$add_jointure_sql = '';
$list_news = array();
$end_rqt_sql = '';
$clause_etat = $etat != 0 ? 'n_etat = ' . intval($etat) . ' AND ' : '';
if (!empty($page) && is_numeric($page)) {
$premierMessageAafficher = ($page - 1) * $element_par_page;
$end_rqt_sql = ' LIMIT ' . $premierMessageAafficher . ', ' . $element_par_page . ' ';
}
// Si l'utilisateur est connecté
if (is_logged_in()) {
$add_champs_sql = ', f_id_membre, f_type, v_id_membre';
$add_jointure_sql = ' LEFT JOIN ' . Nw::$prefix_table . 'news_flags ON (n_id = f_id_news AND f_id_membre = ' . intval(Nw::$dn_mbr['u_id']) . ')';
$add_jointure_sql .= ' LEFT JOIN ' . Nw::$prefix_table . 'news_vote ON (n_id = v_id_news AND v_id_membre = ' . intval(Nw::$dn_mbr['u_id']) . ')';
}
// Rqt SQL
$rqt_list_news = Nw::$DB->query('SELECT t_tag AS first_tag, c_id, c_nom, c_rewrite, n_resume, n_nb_votes, n_nb_versions, n_id, n_id_auteur, n_id_cat, n_titre, n_etat, n_vues, n_private, n_nbr_coms, i_id, i_nom,
' . decalageh('n_date', 'date_news') . ', u_id, u_pseudo, u_alias, u_avatar' . $add_champs_sql . '
FROM ' . Nw::$prefix_table . 'news
LEFT JOIN ' . Nw::$prefix_table . 'members ON n_id_auteur = u_id' . $add_jointure_sql . '
LEFT JOIN ' . Nw::$prefix_table . 'categories ON c_id = n_id_cat
LEFT JOIN ' . Nw::$prefix_table . 'news_images ON i_id = n_id_image
LEFT JOIN ' . Nw::$prefix_table . 'tags ON t_id_news = n_id
WHERE ' . $clause_etat . 't_tag = \'' . insertBD(trim(urldecode($tag))) . '\' GROUP BY n_id ORDER BY n_date DESC' . $end_rqt_sql) or Nw::$DB->trigger(__LINE__, __FILE__);
while ($donnees_news = $rqt_list_news->fetch_assoc()) {
$list_news[] = $donnees_news;
}
return $list_news;
}
示例3: main
protected function main()
{
if (!is_logged_in()) {
redir(Nw::$lang['common']['need_login'], false, 'users-10.html');
}
$this->set_title(Nw::$lang['users']['item_mdp']);
$this->set_tpl('membres/options_pass.html');
$this->add_css('forms.css');
$this->set_filAriane(array(Nw::$lang['users']['mes_options_title'] => array('users-60.html'), Nw::$lang['users']['item_mdp'] => array('')));
if (isset($_POST['submit']) && !multi_empty(trim($_POST['old']), trim($_POST['nw_pass1']), trim($_POST['nw_pass2']))) {
$bf_token = 'jJ_=éZAç1l';
$ft_token = 'ù%*àè1ç0°dezf';
$pass_membre = insertBD(sha1($bf_token . trim($_POST['old']) . $ft_token));
if ($_POST['nw_pass1'] == $_POST['nw_pass2']) {
if (Nw::$dn_mbr['u_password'] == $pass_membre) {
inc_lib('users/chg_password');
chg_password($_POST['nw_pass1'], Nw::$dn_mbr['u_id']);
if (!empty($_COOKIE['nw_pass'])) {
$time_expire = time() + 10 * 365 * 24 * 3600;
setcookie('nw_ident', Nw::$dn_mbr['u_id'], $time_expire);
setcookie('nw_pass', $pass_membre, $time_expire);
}
redir(Nw::$lang['users']['mdp_change'], true, 'users-60.html');
} else {
redir(Nw::$lang['users']['not_root_password'], false, 'users-63.html');
}
} else {
redir(Nw::$lang['users']['sames_password'], false, 'users-63.html');
}
}
}
示例4: add_ban_ip
function add_ban_ip($ip, $id_modo, $duree, $motif, $motif_admin)
{
inc_lib('bbcode/parse');
$motif_admin = parse(insertBD(trim($motif_admin)));
$motif = insertBD(trim($motif_admin));
Nw::$DB->query("INSERT INTO " . Nw::$prefix_table . "ban_ip(ban_ip, ban_id_modo,\n ban_date, ban_date_end, ban_is_end, ban_motif, ban_motif_admin)\n VALUES(" . ip2long($ip) . ", " . intval($id_modo) . ", NOW(),\n NOW() + " . intval($duree) . " DAY, 0, '" . $motif . "', '" . $motif_admin . "'");
}
示例5: count_exit_cookies
/**
* Un utilisateur tente de connecter avec les cookies
* @author Cam
* @param $id ID du membre
* @param $pass Mot de passe (crypté)
* @return integer
*/
public static function count_exit_cookies($id, $pass)
{
$query = Nw::$DB->query('SELECT COUNT(*) as count FROM ' . Nw::$prefix_table . 'members WHERE u_id=' . intval($id) . ' AND u_password=\'' . insertBD($pass) . '\'');
$data = $query->fetch_assoc();
$query->free();
return $data['count'];
}
示例6: delete_cmt_news
function delete_cmt_news($id_news, $id_comment)
{
// Le commentaire est juste remplacé par un message
if (Nw::$droits['can_del_all_comments'] && !empty($_POST['raison']) || !Nw::$droits['can_del_all_comments']) {
$message_masque = $_POST['raison'];
if (!Nw::$droits['can_del_all_comments']) {
$message_masque = Nw::$lang['news']['cmt_deletedby_himself'];
}
Nw::$DB->query('UPDATE ' . Nw::$prefix_table . 'news_commentaires SET c_masque = 1, c_masque_raison = \'' . insertBD(trim($message_masque)) . '\', c_masque_modo = ' . intval(Nw::$dn_mbr['u_id']) . ' WHERE c_id_news = ' . intval($id_news) . ' AND c_id = ' . intval($id_comment)) or Nw::$DB->trigger(__LINE__, __FILE__);
}
// Suppression définitive du commentaire
if (empty($_POST['raison']) && isset($_POST['rlly_delete'])) {
$add_sql = '';
$query = Nw::$DB->query('SELECT c_id FROM ' . Nw::$prefix_table . 'news_commentaires WHERE c_id_news = ' . intval($id_news) . ' AND c_id <> ' . intval($id_comment) . ' ORDER BY c_date DESC LIMIT 1') or Nw::$DB->trigger(__LINE__, __FILE__);
$dn = $query->fetch_assoc();
$query_stats = Nw::$DB->query('SELECT c_id_membre FROM ' . Nw::$prefix_table . 'news_commentaires WHERE c_id_news = ' . intval($id_news) . ' AND c_id = ' . intval($id_comment)) or Nw::$DB->trigger(__LINE__, __FILE__);
$dn_stats = $query->fetch_assoc();
if (!empty($dn['c_id'])) {
$add_sql = ', n_last_com = ' . intval($dn['c_id']);
}
Nw::$DB->query('DELETE FROM ' . Nw::$prefix_table . 'news_commentaires WHERE c_id_news = ' . intval($id_news) . ' AND c_id = ' . intval($id_comment)) or Nw::$DB->trigger(__LINE__, __FILE__);
Nw::$DB->query('UPDATE ' . Nw::$prefix_table . 'news SET n_nbr_coms = n_nbr_coms - 1' . $add_sql . ' WHERE n_id = ' . intval($id_news)) or Nw::$DB->trigger(__LINE__, __FILE__);
Nw::$DB->query('UPDATE ' . Nw::$prefix_table . 'members_stats SET s_nb_coms = s_nb_coms - 1 WHERE s_id_membre = ' . intval($dn_stats['c_id_membre'])) or Nw::$DB->trigger(__LINE__, __FILE__);
}
}
示例7: main
protected function main()
{
if (!is_logged_in() && !check_auth('view_histo_all_news')) {
header('Location: ./');
}
$this->set_title(Nw::$lang['news']['historiques_news']);
$this->set_tpl('news/log_admin.html');
$this->add_css('code.css');
$this->set_filAriane(array(Nw::$lang['news']['news_section'] => array('news-70.html'), Nw::$lang['news']['historiques_news'] => array('')));
$get_param = '';
$param_tpl = '';
if (!empty($_GET['t'])) {
$get_param = 'l_titre LIKE "%' . insertBD(urldecode($_GET['t'])) . '%" OR l_texte LIKE "%' . insertBD(urldecode($_GET['t'])) . '%"';
$param_tpl = htmlspecialchars($_GET['t']);
}
inc_lib('news/count_news_logs');
$nombre_logs = count_news_logs($get_param);
// Pagination
$page = isset($_GET['page']) ? intval($_GET['page']) : 1;
$nombreDePages = ceil($nombre_logs / Nw::$pref['nb_logs_admin']);
// On vérifie que la page existe bien
if ($nombreDePages > 0 && $page > $nombreDePages) {
redir(Nw::$lang['common']['pg_not_exist'], false, 'news-21.html?t=' . $param_tpl);
}
/**
* Affichage du logo
**/
inc_lib('news/get_news_logs');
$donnees_logs = get_news_logs($get_param, 'l_date DESC', $page, Nw::$pref['nb_logs_admin']);
foreach ($donnees_logs as $donnees) {
Nw::$tpl->setBlock('log', array('ACTION' => $donnees['l_action'], 'ACTION_LOG' => isset(Nw::$lang['news']['log_news_' . $donnees['l_action']]) ? Nw::$lang['news']['log_news_' . $donnees['l_action']] : '', 'TEXTE' => nl2br($donnees['l_texte']), 'DATE' => date_sql($donnees['date'], $donnees['heures_date'], $donnees['jours_date']), 'AUTEUR' => $donnees['u_pseudo'], 'AUTEUR_ID' => $donnees['u_id'], 'AUTEUR_AVATAR' => $donnees['u_avatar'], 'AUTEUR_ALIAS' => $donnees['u_alias'], 'NEWS_ID' => $donnees['l_id_news'], 'NEWS_TITRE' => $donnees['n_titre'], 'TITRE_ACTU' => $donnees['l_titre'], 'IP' => long2ip($donnees['l_ip'])));
}
Nw::$tpl->set(array('TITRE' => urldecode($param_tpl), 'LIST_PG' => list_pg($nombreDePages, $page, 'news-21%s.html?t=' . $param_tpl)));
}
示例8: get_info_mbr
function get_info_mbr($res, $by = null)
{
if (is_null($by)) {
if (is_numeric($res)) {
$where_clause = 'u_id = ' . intval($res);
} else {
$where_clause = 'u_alias = \'' . insertBD(trim($res)) . '\'';
}
} elseif ($by == 'alias') {
$where_clause = 'u_alias = \'' . insertBD(trim($res)) . '\'';
} elseif ($by == 'id') {
$where_clause = 'u_id = ' . intval($res);
} elseif ($by == 'mail') {
$where_clause = 'u_email = \'' . insertBD($res) . '\'';
} elseif ($by == 'identifier') {
$where_clause = 'u_identifier = \'' . insertBD($res) . '\'';
} elseif ($by == 'pseudo') {
$where_clause = 'u_pseudo = \'' . insertBD($res) . '\'';
}
$query = Nw::$DB->query('SELECT u_id, u_alias, u_avatar, u_pseudo, u_group,
u_localisation, u_ident_unique, u_bio, ' . decalageh('u_date_register', 'date_register') . ',
' . decalageh('u_last_visit', 'last_visit') . ', u_password, u_code_act, u_active,
u_email, u_decalage, DATE_FORMAT(u_date_naissance, "%d/%m/%Y") AS date_naissance,
g_titre, g_icone
FROM ' . Nw::$prefix_table . 'members
LEFT JOIN ' . Nw::$prefix_table . 'groups ON g_id = u_group
WHERE ' . $where_clause) or Nw::$DB->trigger(__LINE__, __FILE__);
return $query->fetch_assoc();
}
示例9: add_mbr
function add_mbr($pseudo, $password, $email, $identifier = '', $valide = 0)
{
$bf_token = 'jJ_=éZAç1l';
$ft_token = 'ù%*àè1ç0°dezf';
$key_alea_code_activate = md5(uniqid(mt_rand()));
// Enregistrement de l'utilisateur dans la base de données
Nw::$DB->query('INSERT INTO ' . Nw::$prefix_table . 'members (u_pseudo, u_alias, u_identifier, u_password, u_email, u_group, u_date_register, u_active, u_code_act, u_ip)
VALUES(\'' . insertBD(trim($pseudo)) . '\', \'' . rewrite(trim($pseudo)) . '\', \'' . insertBD(trim($identifier)) . '\', \'' . insertBD(sha1($bf_token . trim($password) . $ft_token)) . '\', \'' . insertBD(trim($email)) . '\',
4, NOW(), ' . intval($valide) . ', \'' . insertBD($key_alea_code_activate) . '\', \'' . get_ip() . '\')') or Nw::$DB->trigger(__LINE__, __FILE__);
$id_new_membre = Nw::$DB->insert_id;
$identifiant_unique = md5($id_new_membre . uniqid(rand(), true));
$lien_activation = Nw::$site_url . 'users-32.html?mid=' . $id_new_membre . '&ca=' . $key_alea_code_activate;
Nw::$DB->query('UPDATE ' . Nw::$prefix_table . 'members SET u_ident_unique = \'' . Nw::$DB->real_escape_string($identifiant_unique) . '\' WHERE u_id = ' . intval($id_new_membre)) or Nw::$DB->trigger(__LINE__, __FILE__);
Nw::$DB->query('INSERT INTO ' . Nw::$prefix_table . 'members_stats (s_id_membre) VALUES(' . intval($id_new_membre) . ')') or Nw::$DB->trigger(__LINE__, __FILE__);
inc_lib('users/mail2gd');
mail2gd($identifiant_unique, trim($email));
inc_lib('newsletter/add_abonnement');
add_abonnement(trim($email), $id_new_membre);
// Envoie d'email de validation
if ($valide == 0) {
$txt_mail = sprintf(Nw::$lang['users']['mail_confirm_insc'], $pseudo, Nw::$site_url, Nw::$site_name, $lien_activation, $lien_activation, $lien_activation);
@envoi_mail(trim($email), sprintf(Nw::$lang['users']['confirm_inscription'], Nw::$site_name), $txt_mail);
} else {
// Le compte est confirmé, on met à jour le nbr de membres
inc_lib('admin/gen_cachefile_nb_members');
gen_cachefile_nb_members();
generate_members_sitemap();
}
return $id_new_membre;
}
示例10: mbr_act_exists
function mbr_act_exists($idm, $code_act)
{
$query = Nw::$DB->query('SELECT COUNT(*) as count
FROM ' . Nw::$prefix_table . 'members WHERE u_id=' . intval($idm) . ' AND u_code_act=\'' . insertBD($code_act) . '\'') or Nw::$DB->trigger(__LINE__, __FILE__);
$dn = $query->fetch_assoc();
$query->free();
return $dn['count'] > 0;
}
示例11: insertRecurso
function insertRecurso($recurso, $bd)
{
//$bd = openBD();
$sql_insert = "INSERT INTO recurso (id, tipo, fecha_publicacion, usuario_id, ubicacion)\n VALUES (NULL, '" . mysqli_real_escape_string($bd, $recurso->getTipo()) . "',\n '" . mysqli_real_escape_string($bd, $recurso->getFechaPublicacion()) . "',\n '" . mysqli_real_escape_string($bd, $recurso->getUsuario()) . "',\n '" . mysqli_real_escape_string($bd, $recurso->getUbicacion()) . "');";
$resultado = insertBD($sql_insert, $bd);
//var_dump($resultado);
//closeBD($bd);
}
示例12: edit_grp
function edit_grp($id)
{
$couleur = isset($_POST['couleur']) ? 1 : 0;
Nw::$DB->query('UPDATE ' . Nw::$prefix_table . 'groups
SET g_nom = \'' . insertBD(trim($_POST['nom'])) . '\', g_titre = \'' . insertBD(trim($_POST['titre'])) . '\',
g_icone = \'' . insertBD(trim($_POST['icone'])) . '\', g_couleur = ' . $couleur . '
WHERE g_id = ' . intval($id)) or Nw::$DB->trigger(__LINE__, __FILE__);
}
示例13: count_search_results
function count_search_results($tag, $etat)
{
$clause_etat = $etat != 0 ? 'n_etat = ' . intval($etat) . ' AND ' : '';
$query = Nw::$DB->query('SELECT COUNT(*) AS count FROM ' . Nw::$prefix_table . 'news
LEFT JOIN ' . Nw::$prefix_table . 'tags ON t_id_news = n_id
WHERE ' . $clause_etat . 't_tag = \'' . insertBD(trim(urldecode($tag))) . '\'') or Nw::$DB->trigger(__LINE__, __FILE__);
$dn = $query->fetch_assoc();
return $dn['count'];
}
示例14: add_grp
function add_grp()
{
$couleur = isset($_POST['couleur']) ? 1 : 0;
Nw::$DB->query('INSERT INTO ' . Nw::$prefix_table . 'groups (g_nom, g_titre,
g_icone, g_couleur) VALUES(\'' . insertBD(trim($_POST['nom'])) . '\',
\'' . insertBD(trim($_POST['titre'])) . '\', \'' . insertBD(trim($_POST['icone'])) . '\',
' . $couleur . ')') or Nw::$DB->trigger(__LINE__, __FILE__);
return Nw::$DB->insert_id;
}
示例15: chg_password
function chg_password($pass, $idm, $code_act = '')
{
$bf_token = 'jJ_=éZAç1l';
$ft_token = 'ù%*àè1ç0°dezf';
$sql_code_act = !empty($code_act) ? ' AND u_code_act=\'' . insertBD($code_act) . '\'' : '';
Nw::$DB->query('UPDATE ' . Nw::$prefix_table . 'members
SET u_password=\'' . insertBD(sha1($bf_token . $pass . $ft_token)) . '\'
WHERE u_id=' . intval($idm) . $sql_code_act) or Nw::$DB->trigger(__LINE__, __FILE__);
}