function redirect_if_logged_in($path) { if (is_logged_in()) { header('Location: ' . C_BASEURL . $path); exit; } }
protected function main() { if (!is_logged_in()) { header('Location: mobile.html'); } $this->set_tpl('mobile/categories/list_news.html'); $this->load_lang_file('news'); // On compte le nbr de news en rédaction inc_lib('news/count_news'); $nombre_news = count_news('n_etat = 1'); // Pagination $page = (!empty($_GET['page']) and is_numeric($_GET['page']) and $_GET['page'] > 0) ? (int) $_GET['page'] : 1; $nombreDePages = ceil($nombre_news / Nw::$pref['nb_news_redac']); // On vérifie bien que la page existe if ($nombreDePages > 0 && $page > $nombreDePages) { redir(Nw::$lang['common']['pg_not_exist'], false, './mobile.html'); } // On recherche toutes les news en rédaction inc_lib('news/get_list_news'); $list_dn_news = get_list_news('n_etat = 1', 'n_date DESC', $page, Nw::$pref['nb_news_redac']); // On affiche toutes les news en rédaction foreach ($list_dn_news as $donnees_news) { Nw::$tpl->setBlock('news', array('ID' => $donnees_news['n_id'], 'CAT_ID' => $donnees_news['c_id'], 'CAT_TITRE' => $donnees_news['c_nom'], 'IMAGE_ID' => $donnees_news['i_id'], 'IMAGE_NOM' => $donnees_news['i_nom'], 'TITRE' => $donnees_news['n_titre'], 'RESUME' => $donnees_news['n_resume'], 'REWRITE' => rewrite($donnees_news['n_titre']), 'AUTEUR' => $donnees_news['u_pseudo'], 'AUTEUR_ID' => $donnees_news['u_id'], 'AUTEUR_ALIAS' => $donnees_news['u_alias'], 'AUTEUR_AVATAR' => $donnees_news['u_avatar'], 'DATE' => date_sql($donnees_news['date_news'], $donnees_news['heures_date_news'], $donnees_news['jours_date_news']), 'NBR_COMS' => sprintf(Nw::$lang['news']['nbr_comments_news'], $donnees_news['n_nbr_coms'], $donnees_news['n_nbr_coms'] > 1 ? Nw::$lang['news']['add_s_comments'] : ''), 'VOTES' => $donnees_news['n_nb_votes'], 'VOTES_NEG' => $donnees_news['n_nb_votes_neg'], 'HAS_VOTED' => is_logged_in() ? $donnees_news['v_id_membre'] : 0)); } Nw::$tpl->set(array('LIST_PG' => list_pg($nombreDePages, $page, 'mobile-2%s.html'), 'NB_NEWS' => $nombre_news, 'TITLE' => Nw::$lang['news']['en_attente_title'], 'TITLE_REWRITE' => 'news_en_attente', 'INC_HEAD' => empty($_SERVER['HTTP_AJAX']))); }
public function __construct() { parent::__construct(); is_logged_in(); $this->load->model('users_model'); $this->load->model('common_model'); }
protected function main() { if (!is_logged_in()) { redir(Nw::$lang['common']['need_login'], false, 'users-10.html'); } // Si le paramètre ID manque if (empty($_GET['id']) || !is_numeric($_GET['id'])) { header('Location: news-70.html'); } // Cette news existe vraiment ? inc_lib('news/news_exists'); if (news_exists($_GET['id']) == false) { redir(Nw::$lang['news']['news_not_exist'], false, 'news-70.html'); } inc_lib('news/get_info_news'); $donnees_news = get_info_news($_GET['id']); // Ce n'est pas l'auteur de la news, il ne peut la proposer if ($donnees_news['n_id_auteur'] != Nw::$dn_mbr['u_id']) { redir(Nw::$lang['news']['dont_propose_news'], false, 'news-70.html'); } // La news a déjà été proposée if ($donnees_news['n_etat'] == 2) { redir(Nw::$lang['news']['news_already_attente'], false, 'news-80.html'); } // Proposition de la news inc_lib('news/propose_news_votes'); propose_news_votes($_GET['id']); redir(Nw::$lang['news']['msg_news_attente'], true, 'news-80.html'); }
protected function main() { // Seuls les membres peuvent créer des brouillons if (!is_logged_in()) { redir(Nw::$lang['common']['need_login'], false, 'users-10.html'); } // Si le paramètre ID manque if (empty($_GET['id']) || !is_numeric($_GET['id'])) { header('Location: ./'); } // Cette news existe vraiment ? inc_lib('news/news_exists'); if (news_exists($_GET['id']) == false) { redir(Nw::$lang['news']['news_not_exist'], false, './'); } // Pour rediriger le visiteur d'où il est venu if (!empty($_SERVER['HTTP_REFERER']) && strpos($_SERVER['HTTP_REFERER'], Nw::$site_url) !== false && strpos($_SERVER['HTTP_REFERER'], Nw::$site_url . 'news-25-' . $_GET['id'] . '.html') === false) { $_SESSION['nw_referer_edit'] = $_SERVER['HTTP_REFERER']; } $link_redir = !empty($_SESSION['nw_referer_edit']) ? $_SESSION['nw_referer_edit'] : 'news-10-' . intval($_GET['id']) . '.html'; inc_lib('news/get_info_news'); inc_lib('news/manage_fav'); $donnees_news = get_info_news($_GET['id']); $response = manage_fav($_GET['id']); // Nouveau favoris if ($response == 1) { $text_redir = Nw::$lang['news']['news_favorite_ok']; } elseif ($response == 2) { $text_redir = Nw::$lang['news']['news_defavorite_ok']; } redir($text_redir, true, $link_redir); }
public function crear() { //Se hace uso de un helper llamadado "is_logged_in", si el usuario ya esta logeado, sera redireccionado a la pagina despues del if if (is_logged_in() == true) { redirect('lista/index'); } $data = array(); $data['contenido'] = "usuario/index"; //Antes que nada, verificar que los datos del usuario que se estan tratando de ingresar, no existen ya en la base de datos. $usuario_ya_existe = $this->Usuario_model->existe($this->input->post('usuario_nuevo')); if ($usuario_ya_existe) { $data['contenido'] = "usuario/existente"; $this->load->view("usuario/template", $data); } else { /* Se valida el formulario, si los campos cumplen lo configurado en "application/config/form_validation.php" */ if ($this->form_validation->run('usuario/crear') == TRUE) { // Se preparan los datos para hacer un insert en la base de datos usando el modelo crear. Regresara un 0, si no realiza el cambio en la base de datos, y 1, que son los renglones que cambiaran. $data = array("usuario" => $this->input->post('usuario_nuevo'), "password" => md5($this->input->post('password_nuevo'))); if ($this->Usuario_model->crear($data)) { // Se manda llamar los datos del usuario, ya que se necesitan los datos de este, junto con su ID, en caso de realizar un borrado de la cuenta. $info_usuario = $this->Usuario_model->existe($this->input->post('usuario_nuevo')); $data = array('usuario' => $info_usuario->usuario, 'id' => $info_usuario->id, 'is_logged_in' => true); // Agregando datos a la sesion. $this->session->set_userdata($data); redirect('lista/index'); } else { // Algo fallo en la base de datos. redirect('usuario/error'); } } else { $data['contenido'] = "usuario/index"; $this->load->view("usuario/template", $data); } } }
function login_do_http_auth() { global $LOGIN_PASSWORD, $LOGIN_USERNAME; global $_SERVER; if ($_SERVER['REMOTE_USER']) { is_logged_in(true); return; } if (!$_SERVER['PHP_AUTH_USER']) { is_logged_in(false); return; } $status = authenticate($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']); if (!succeeds($status)) { is_logged_in(false); if (!fatal($status)) { if ($_SERVER['PHP_AUTH_USER']) { http_401(); } } else { print "Error logging in: " . auth_error(); } } else { $LOGIN_USERNAME = $_SERVER['PHP_AUTH_USER']; $LOGIN_PASSWORD = $_SERVER['PHP_AUTH_PW']; is_logged_in(true); } }
/** * Activation du compte. * @author Cam * @return tpl */ protected function main() { if (empty($_GET['mid']) || empty($_GET['ca'])) { header('Location: ./'); } if (is_logged_in()) { redir(Nw::$lang['common']['already_connected'], false, './'); } $return_valid = false; inc_lib('users/mbr_act_exists'); if (mbr_act_exists($_GET['mid'], $_GET['ca'])) { inc_lib('users/get_info_mbr'); $donnees_compte = get_info_mbr($_GET['mid']); if ($donnees_compte['u_active'] == 0) { inc_lib('users/valid_account'); inc_lib('admin/gen_cachefile_nb_members'); valid_account($_GET['mid']); gen_cachefile_nb_members(); generate_members_sitemap(); redir(Nw::$lang['users']['compte_valide'], true, './'); $return_valid = true; } } if (!$return_valid) { redir(Nw::$lang['users']['compte_valid_error'], false, './'); } }
/** * Action to request class change form AND execute class change * * @todo split form request and execute into separate funcs * @return ViewSpec */ public function changeClass() { if (is_logged_in()) { $player = new Player(self_char_id()); $classes = $this->classesInfo(); $requestedIdentity = in('requested_identity'); $currentClass = $player->identity; $showMonks = false; $parts = []; if (isset($classes[$requestedIdentity])) { $error = $this->classChangeReqs($player, self::CLASS_CHANGE_COST); if ($currentClass != $requestedIdentity && !$error) { $error = $this->changePlayerClass($player, $requestedIdentity); } $currentClass = $player->identity; if (!$error) { $parts['pageParts'] = ['success-class-change']; $showMonks = true; } else { $parts['error'] = $error; } } else { $parts['pageParts'] = ['form-class-change']; } unset($classes[$currentClass]); $parts['classOptions'] = $classes; return $this->render($parts, $player, $showMonks); } else { return $this->accessDenied(); } }
public function __construct() { parent::__construct(); is_logged_in(); $this->load->model('mod_formpengajuanbeasiswa'); $this->load->model('mod_datamahasiswa'); }
/** * We check if this is an anonymous visitor and do not allow comments, if we're setup * to do so. */ function ItemCanComment(&$params) { if (!is_logged_in() && !$this->Settings->get('allow_anon_comments')) { return T_('Comments are not allowed from anonymous visitors.'); } // return NULL }
/** * Déconnexion de l'utilisateur * @author Cam * @return void */ protected function main() { // L'ID membre n'est pas renseigné, direction l'index if (empty($_GET['id'])) { header('Location: ./'); } // Pour rediriger le visiteur d'où il est venu if (!empty($_SERVER['HTTP_REFERER']) && strpos($_SERVER['HTTP_REFERER'], Nw::$site_url) !== false && strpos($_SERVER['HTTP_REFERER'], Nw::$site_url . 'membres-10.html') === false) { $_SESSION['nw_referer_deco'] = $_SERVER['HTTP_REFERER']; } $link_redir = !empty($_SESSION['nw_referer_deco']) ? $_SESSION['nw_referer_deco'] : './'; // Le membre est bien connecté if (is_logged_in() && $_GET['id'] == Nw::$dn_mbr['u_id']) { $_SESSION = array(); session_destroy(); // Si les cookies existent, on les supprime if (isset($_COOKIE['nw_ident']) && isset($_COOKIE['nw_pass'])) { setcookie('nw_ident', null, time() - 3600); setcookie('nw_pass', null, time() - 3600); } // On affiche le message de confirmation et le redirige redir(Nw::$lang['users']['disconnect_msg'], true, $link_redir); } else { header('Location: ./'); } }
public function init() { // $seg1 = $this->uri->segment(1,''); $seg1 = $this->config->item('layout_name'); $ltype = isset($seg1) ? $seg1 : ''; $this->load->config('layout'); switch ($ltype) { case 'admin': $layout = $this->config->item('default', 'layout'); if (!$layout) { die('Layout not found.'); } $this->layout->initialize($layout); if (!is_logged_in()) { $seg2 = $this->uri->segment(2, ''); if ($seg1 === 'admin' && $seg2 !== 'login') { redirect('admin/login'); } } elseif (is_logged_in() && get_user_role()) { die('www'); redirect('lession'); } break; default: $layout = $this->config->item('default', 'layout'); if (!$layout) { die('Layout not found.'); } $this->layout->initialize($layout); //$this->load_settings_data(); break; } }
function __construct() { parent::__construct(); is_logged_in(); $this->load->model('membership_model'); $this->load->model('person_model'); }
protected function main() { $this->set_title(Nw::$site_slogan); $this->set_tpl('mobile/users/login.html'); $this->load_lang_file('users'); // Si le membre est déjà connecté if (is_logged_in()) { redir(Nw::$lang['common']['already_connected'], false, 'mobile-2.html'); } //Si on a soumis le formulaire if (!multi_empty(trim($_POST['nw_nickname']), trim($_POST['nw_password']))) { $array_post = array('pseudo' => $_POST['nw_nickname'], 'remember' => isset($_POST['nw_remember'])); //On vérifie que la paire pseudo/mot de passe existe inc_lib('users/get_info_account'); if ($dn_info_account = get_info_account($_POST['nw_nickname'], $_POST['nw_password'])) { //Si le compte est actif if ($dn_info_account['u_active'] == 1) { $link_redir = 'mobile-2.html'; $connex_auto = 1; inc_lib('users/connect_auto_user'); connect_auto_user($dn_info_account['u_id'], $_POST['nw_password'], $connex_auto); // On redirige le membre redir(sprintf(Nw::$lang['users']['welcome_user'], $_POST['nw_nickname']), true, $link_redir); } else { display_form($array_post, Nw::$lang['users']['not_active']); } return; } else { display_form($array_post, Nw::$lang['users']['account_no_exist']); } return; } display_form(array('pseudo' => '', 'remember' => true)); Nw::$tpl->set('INC_HEAD', empty($_SERVER['HTTP_AJAX'])); }
protected function main() { // Si le paramètre ID manque if (empty($_GET['id']) || !is_numeric($_GET['id'])) { header('Location: news-70.html'); } inc_lib('news/news_exists'); if (news_exists($_GET['id']) == false) { redir(Nw::$lang['news']['news_not_exist'], false, 'news-70.html'); } inc_lib('news/get_info_news'); $donnees_news = get_info_news($_GET['id']); // Ce membre a le droit d'éditer la news ? if ($donnees_news['n_etat'] != 3 && !is_logged_in()) { redir(Nw::$lang['news']['not_view_news_perm'], false, './'); } $this->set_tpl('mobile/news/view_news.html'); $this->load_lang_file('news'); inc_lib('news/has_voted_news'); Nw::$tpl->set(array('ID' => $_GET['id'], 'ETAT' => $donnees_news['n_etat'], 'CAT_ID' => $donnees_news['c_id'], 'CAT_TITRE' => $donnees_news['c_nom'], 'AUTEUR' => $donnees_news['u_pseudo'], 'AUTEUR_ALIAS' => $donnees_news['u_alias'], 'AUTEUR_AVATAR' => $donnees_news['u_avatar'], 'DATE' => date_sql($donnees_news['date_news'], $donnees_news['heures_date_news'], $donnees_news['jours_date_news']), 'NBR_COMS' => sprintf(Nw::$lang['news']['nbr_comments_news'], $donnees_news['n_nbr_coms'], $donnees_news['n_nbr_coms'] > 1 ? Nw::$lang['news']['add_s_comments'] : ''), 'COMS' => $donnees_news['n_nbr_coms'], 'NB_VOT_VALID' => Nw::$pref['nb_votes_valid_news'], 'VOTES' => $donnees_news['n_nb_votes'], 'VOTES_NEG' => $donnees_news['n_nb_votes_neg'], 'IMAGE_ID' => $donnees_news['i_id'], 'IMAGE_NOM' => $donnees_news['i_nom'], 'SOURCE' => !empty($donnees_news['n_src_url']) ? $donnees_news['n_src_url'] : '', 'SOURCE_NOM' => !empty($donnees_news['n_src_nom']) ? $donnees_news['n_src_nom'] : '', 'TITRE' => $donnees_news['n_titre'], 'REWRITE' => rewrite($donnees_news['n_titre']), 'CONTENU' => $donnees_news['v_texte'], 'HAS_VOTED' => is_logged_in() ? $donnees_news['v_id_membre'] : 0)); // Màj du nombre de visualisations inc_lib('news/update_pg_vues'); update_pg_vues($_GET['id']); Nw::$tpl->set('INC_HEAD', empty($_SERVER['HTTP_AJAX'])); }
public function index() { if (is_logged_in()) { redirect('home'); } $this->load->view('shop/loginRegister'); }
function initialize_store() { if (!is_logged_in()) { Error('Invalid Access'); } $GLOBALS['items'] = GetItems(); }
protected function main() { // Si le paramètre ID manque if (empty($_GET['id']) || !is_numeric($_GET['id'])) { header('Location: news-70.html'); } inc_lib('news/news_exists'); if (news_exists($_GET['id']) == false) { redir(Nw::$lang['news']['news_not_exist'], false, 'news-70.html'); } inc_lib('news/get_info_news'); $info_news = get_info_news($_GET['id']); if (!is_logged_in()) { redir(Nw::$lang['news']['error_cant_alert'], false, './'); } //Si on a envoyé des erreurs if (!empty($_POST['contenu'])) { inc_lib('news/add_alert_news'); add_alert_news(Nw::$dn_mbr['u_id'], $_GET['id'], $_POST['contenu'], $_POST['motif']); redir(Nw::$lang['news']['confirm_alert'], true, $info_news['c_rewrite'] . '/' . rewrite($info_news['n_titre']) . '-' . $_GET['id'] . '/'); } $this->set_title($info_news['n_titre'] . ' | ' . $info_news['c_nom']); $this->set_tpl('news/alert.html'); $this->add_css('forms.css'); $this->add_css('code.css'); $this->add_js('write.js'); $this->add_js('forms.js'); $this->add_form('contenu'); Nw::$tpl->set('ID', $info_news['n_id']); inc_lib('bbcode/clearer'); Nw::$tpl->set(array('ID' => $_GET['id'], 'BAL_CHAMP' => 'contenu', 'NEWS' => $info_news['n_titre'], 'RESUME' => CoupeChar(clearer($info_news['v_texte'])), 'CAT_REWRITE' => $info_news['c_rewrite'], 'REWRITE' => rewrite($info_news['n_titre']))); // Fil ariane $this->set_filAriane(array(Nw::$lang['news']['news_section'] => array('news-70.html'), $info_news['c_nom'] => array($info_news['c_rewrite'] . '/'), $info_news['n_titre'] => array($info_news['c_rewrite'] . '/' . rewrite($info_news['n_titre']) . '-' . $_GET['id'] . '/'), Nw::$lang['news']['alert'] => array(''))); }
function verify_access() { if (!is_logged_in()) { toshout_error('Please login to use that property'); redirect('login'); } }
function get_logged_in_user_id() { if (is_logged_in()) { return $_SESSION['user_id']; } return 0; }
protected function main() { inc_lib('news/news_exists'); $count_news_existe = news_exists($_GET['id']); if ($count_news_existe == false && (is_logged_in() && !check_auth('view_histo_all_news'))) { redir(Nw::$lang['news']['news_not_exist'], false, './'); } inc_lib('news/get_info_news'); $donnees_news = get_info_news($_GET['id']); $this->set_title(Nw::$lang['news']['historique_news'] . ' | ' . $donnees_news['n_titre']); $this->set_tpl('news/log_news.html'); $this->add_css('code.css'); // Fil ariane if ($count_news_existe) { $this->set_filAriane(array(Nw::$lang['news']['news_section'] => array('news-70.html'), $donnees_news['c_nom'] => array($donnees_news['c_rewrite'] . '/'), $donnees_news['n_titre'] => array($donnees_news['c_rewrite'] . '/' . rewrite($donnees_news['n_titre']) . '-' . $_GET['id'] . '/'), Nw::$lang['news']['historique_news'] => array(''))); } else { $this->set_filAriane(array(Nw::$lang['news']['news_section'] => array('news-70.html'), Nw::$lang['news']['historique_news'] => array(''))); } /** * Affichage du logo **/ inc_lib('news/get_news_logs'); $donnees_logs = get_news_logs('l_id_news = ' . intval($_GET['id']), 'l_date DESC'); 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']), 'TITRE' => $donnees['l_titre'], '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'], 'IP' => long2ip($donnees['l_ip']))); } Nw::$tpl->set(array('ID' => $_GET['id'], 'TITRE' => $donnees_news['n_titre'])); }
protected function main() { $this->set_title(Nw::$lang['contact']['contact']); $this->add_css('forms.css'); $this->set_filAriane(array(Nw::$lang['contact']['contact'] => array(''))); $this->set_tpl('contact/contact.html'); $this->load_lang_file('users'); $this->add_form('contenu'); //Si on veut envoyer le mail if (isset($_POST['submit'])) { if (empty($_POST['pseudo'])) { $msg_error = sprintf(Nw::$lang['contact']['error_empty'], Nw::$lang['contact']['_pseudo']); } elseif (empty($_POST['mail'])) { $msg_error = sprintf(Nw::$lang['contact']['error_empty'], Nw::$lang['contact']['_mail']); } elseif (empty($_POST['sujet'])) { $msg_error = sprintf(Nw::$lang['contact']['error_empty'], Nw::$lang['contact']['_sujet']); } elseif (empty($_POST['contenu'])) { $msg_error = sprintf(Nw::$lang['contact']['error_empty'], Nw::$lang['contact']['_contenu']); } elseif ($_POST['code_cap'] != $_SESSION['cap_nw']) { $msg_error = Nw::$lang['users']['wrong_antispam']; } if (!empty($msg_error)) { display_form(array('pseudo' => $_POST['pseudo'], 'mail' => $_POST['mail'], 'sujet' => $_POST['sujet'], 'contenu' => $_POST['contenu'], 'captcha' => $_POST['captcha'], 'nom' => $_POST['nom'], 'code_cap' => ''), $msg_error); } else { inc_lib('mail/email_contact'); if (email_contact($_POST['mail'], $_POST['pseudo'], $_POST['nom'], '[Contact] ' . $_POST['sujet'], $_POST['contenu'], get_ip())) { redir(Nw::$lang['contact']['redir_ok'], true, 'contact.html'); } } } else { display_form(array('pseudo' => is_logged_in() ? Nw::$dn_mbr['u_pseudo'] : '', 'mail' => is_logged_in() ? Nw::$dn_mbr['u_email'] : '', 'sujet' => '', 'contenu' => '', 'captcha' => '', 'nom' => '', 'code_cap' => '')); } }
public function __construct() { parent::__construct(); is_logged_in(); $this->load->model('mod_datapribadi'); $this->load->model('mod_datamahasiswa'); }
function get_list_news($where = '', $ordre = 'n_date DESC', $page = '', $element_par_page = 0) { $where_clause = strlen($where) > 0 ? 'WHERE ' . $where . ' ' : ''; $add_champs_sql = ''; $add_jointure_sql = ''; $end_rqt_sql = ''; $list_news = array(); 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, vp.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 vp ON (n_id = vp.v_id_news AND vp.v_id_membre = ' . intval(Nw::$dn_mbr['u_id']) . ' AND vp.v_etat = n_etat)'; } // Rqt SQL $rqt_list_news = Nw::$DB->query('SELECT t_tag AS first_tag, c_id, c_rewrite, c_nom, n_resume, n_nb_votes, n_nb_votes_neg, 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 AND t_position = 1) ' . $where_clause . 'GROUP BY n_id ORDER BY ' . $ordre . $end_rqt_sql) or Nw::$DB->trigger(__LINE__, __FILE__); while ($donnees_news = $rqt_list_news->fetch_assoc()) { $list_news[] = $donnees_news; } return $list_news; }
public function __construct() { parent::__construct(); is_logged_in(); $this->load->model('mod_kriteria'); $this->load->model('mod_detailkriteria'); }
function __construct() { parent::Controller(); if ($this->router->fetch_method() != 'stream' && !is_logged_in()) { redirect('login/index'); } }
/** * Update the information of a viewing observer, or player. **/ function update_activity_info() { $sql = new DBAccess(); // ******************** Usage Information of the browser ********************* $remoteAddress = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : NULL; $userAgent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : NULL; $referer = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : NULL; // ************** Setting anonymous and player usage information if (!SESSION::is_set('online')) { // *** Completely new session, update latest activity log. if ($remoteAddress) { // *** Delete prior to trying to re-insert into the people online. $sql->query("DELETE FROM ppl_online WHERE ip_address='" . $_SERVER['REMOTE_ADDR'] . "'\n\t\t\t\t or session_id = '" . session_id() . "'"); } // Update viewer data. $sql->query("INSERT INTO ppl_online (session_id, activity, ip_address, refurl, user_agent) " . "VALUES ('" . session_id() . "', now(), '{$remoteAddress}', '{$referer}', '{$userAgent}')"); SESSION::set('online', true); } else { // An already existing session. if (is_logged_in()) { // A logged in player, update their activity time $sql->query("UPDATE ppl_online SET activity=now(), member='y' WHERE session_id='" . session_id() . "'"); } else { // Un-logged-in observer, as login has not yet occurred. $sql->query("UPDATE ppl_online SET activity=now() WHERE session_id='" . session_id() . "'"); } } }
function edit_user() { if (!is_logged_in() || !is_post_parameter_complete(array('salutation', 'gender', 'firstname', 'lastname', 'birthyear', 'birthmonth', 'birthday', 'password', 'aboutme'))) { Redirect('../edit_user.php'); } $userDetails['salutation'] = $_POST['salutation']; $userDetails['firstname'] = $_POST['firstname']; $userDetails['lastname'] = $_POST['lastname']; $userDetails['gender'] = $_POST['gender']; $userDetails['birthdate'] = "{$_POST['birthyear']}-{$_POST['birthmonth']}-{$_POST['birthday']}"; $userDetails['username'] = $_SESSION['user']['username']; $userDetails['password'] = $_POST['password']; $userDetails['aboutme'] = $_POST['aboutme']; if (is_admin()) { if (is_post_parameter_complete(array('accesslevel'))) { $userDetails['accesslevel'] = $_POST['accesslevel']; } else { Redirect('../edit_user.php'); } } else { $userDetails['accesslevel'] = 'User'; } if (EditUser($userDetails)) { if ($_SESSION['user']['accesslevel'] == $userDetails['accesslevel']) { $_SESSION['user'] = SelectUser($userDetails['username']); Redirect('../index.php'); } else { Redirect('../landing.php/logout'); } } else { Error('Edit Failed'); } }
public function register() { if (is_logged_in()) { redirect('users/login'); } $this->layout->render('users/register'); }