本文整理汇总了PHP中is_loggedin函数的典型用法代码示例。如果您正苦于以下问题:PHP is_loggedin函数的具体用法?PHP is_loggedin怎么用?PHP is_loggedin使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了is_loggedin函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
public function index()
{
if (is_loggedin() == TRUE) {
redirect('admin/members/view_all_main');
}
$this->form_validation->set_rules('username', 'Username', 'trim|required');
$this->form_validation->set_rules('password', 'Password', 'trim|required');
if ($this->form_validation->run() == FALSE) {
$this->load->view('admin/login');
} else {
$username = $this->input->post('username');
$password = $this->input->post('password');
$fetch_data = $this->admin_m->get(array('uname' => $username));
if (!empty($fetch_data)) {
$decode_password = $this->encrypt->decode($fetch_data['pass']);
if ($decode_password == $password) {
$array_session = array('id' => $fetch_data['id'], 'username' => $fetch_data['uname'], 'loggedin' => TRUE);
$this->session->set_userdata($array_session);
$this->session->set_flashdata('success', 'Successfull Login.');
redirect('admin/members/view_all_main');
} else {
$this->session->set_flashdata('error', 'Username or Password incorrect.Please try again.');
redirect('admin');
}
} else {
$this->session->set_flashdata('error', 'Username or Password incorrect.Please try again.');
redirect('admin');
}
}
}
示例2: __construct
public function __construct()
{
parent::__construct();
is_installed();
#defined in auth helper
$this->output->enable_profiler($this->config->item('debug_site'));
$this->PER_PAGE = get_per_page_value();
#defined in auth helper
$this->active_theme = get_active_theme();
if (!is_loggedin()) {
redirect(site_url(''));
}
//$this->load->model('show_model');
$this->load->model('profile_model');
$this->load->model('user/user_model');
$this->load->library('encrypt');
$this->load->helper('text');
if (isset($_POST['view_orderby'])) {
$this->session->set_userdata('view_orderby', $this->input->post('view_orderby'));
}
if (isset($_POST['view_ordertype'])) {
$this->session->set_userdata('view_ordertype', $this->input->post('view_ordertype'));
}
$system_currency_type = get_settings('site_settings', 'system_currency_type', 0);
if ($system_currency_type == 0) {
$system_currency = get_currency_icon(get_settings('site_settings', 'system_currency', 'USD'));
} else {
$system_currency = get_settings('site_settings', 'system_currency', 'USD');
}
$this->session->set_userdata('system_currency', $system_currency);
$this->form_validation->set_error_delimiters('<div class="alert alert-danger">', '</div>');
}
示例3: __construct
public function __construct()
{
parent::__construct();
$exceptional_url = array('admin', 'admin/logout', 'admin/forgot_password', 'admin/change', 'admin/reset_password');
if (in_array(uri_string(), $exceptional_url) == FALSE && is_loggedin() == FALSE) {
// redirect('admin');
}
}
示例4: member_id
function member_id()
{
$CI =& get_instance();
if (is_loggedin()) {
return (int) $CI->session->userdata('member_id');
}
// Failsafe, shouldn't happen.
error('ERROR! Requested member_id but no member is signed in.');
redirect();
}
示例5: index
public function index()
{
// Force login
if (!is_loggedin()) {
redirect('auth/login');
}
// Redirect to member overview for now...
redirect('members');
$head = array('title' => 'Internal');
$this->load->view('header', $head);
$this->load->view('internal/index');
$this->load->view('footer');
}
示例6: index
public function index()
{
$remember_me = get_cookie('Remember_me');
/* If Remember_key Cookie exists in browser then it wil fetch data using it's value and
set sessin data and force login User/Admin */
if (isset($remember_me)) {
$remember_me_decode = $this->encrypt->decode($remember_me);
$rem_data = select('admin', FALSE, array('where' => array('id' => $remember_me_decode)), array('single' => TRUE));
$array_session = array('id' => $rem_data['id'], 'username' => $rem_data['username'], 'loggedin' => TRUE);
$this->session->set_userdata($array_session);
}
/* is_logginin() in cms_helper.php It will Check Admin is loggen or not. */
if (is_loggedin() == TRUE) {
redirect('admin/dashboard');
}
$this->form_validation->set_rules('username', 'Username', 'trim|required');
$this->form_validation->set_rules('password', 'Password', 'trim|required');
if ($this->form_validation->run() == FALSE) {
$this->load->view('admin/login/index');
} else {
$username = $this->input->post('username');
$password = $this->input->post('password');
$data = array('username' => $username);
$fetch_data = select('admin', FALSE, array('where' => $data), array('single' => TRUE));
if (!empty($fetch_data)) {
$db_pass = $this->encrypt->decode($fetch_data['password']);
if ($db_pass == $password) {
/* If remember Me Checkbox is clicked */
/* Set Cookie IF Start */
if (isset($_POST['remember_me'])) {
$cookie = array('name' => 'Remember_me', 'value' => $this->encrypt->encode($fetch_data['id']), 'expire' => '172800');
$this->input->set_cookie($cookie);
}
/* Set Cookie IF END */
$array_session = array('id' => $fetch_data['id'], 'username' => $fetch_data['username'], 'loggedin' => TRUE);
$this->session->set_userdata($array_session);
$this->session->set_flashdata('success', 'Successfull Login.');
redirect(base_url() . 'admin/dashboard');
} else {
$this->session->set_flashdata('error', 'Invalid Username and Password.');
redirect('admin');
}
} else {
$this->session->set_flashdata('error', 'Invalid Username and Password.');
redirect('admin');
}
}
}
示例7: __construct
public function __construct()
{
parent::__construct();
is_installed();
#defined in auth helper
if (!is_loggedin()) {
if (count($_POST) <= 0) {
$this->session->set_userdata('req_url', current_url());
}
redirect(site_url('account/trylogin'));
}
$this->per_page = get_per_page_value();
$this->load->database();
$this->active_theme = get_active_theme();
$this->load->model('user/post_model');
$this->form_validation->set_error_delimiters('<div class="alert alert-danger form-error">', '</div>');
}
示例8: __construct
public function __construct()
{
parent::__construct();
is_installed();
#defined in auth helper
checksavedlogin();
#defined in auth helper
if (!is_loggedin()) {
if (count($_POST) <= 0) {
$this->session->set_userdata('req_url', current_url());
}
redirect(site_url('admin/auth'));
}
$this->load->model('media_model');
$this->load->library('form_validation');
$this->form_validation->set_error_delimiters('<div class="alert alert-error input-xxlarge"">', '</div>');
}
示例9: __construct
public function __construct()
{
parent::__construct();
is_installed();
#defined in auth helper
checksavedlogin();
#defined in auth helper
if (!is_loggedin()) {
if (count($_POST) <= 0) {
$this->session->set_userdata('req_url', current_url());
}
redirect(site_url('admin/auth'));
}
$this->per_page = get_per_page_value();
#defined in auth helper
$this->load->model('users_model');
$this->form_validation->set_error_delimiters('<div class="alert alert-danger">', '</div>');
}
示例10: login
public function login($data, $session = true)
{
// Check if e-mail exists.
$member = $this->get_member('email', $data['email']);
if (!$member) {
// Log unsuccessful logins for sessions.
if ($session) {
$this->db->insert('logins', array('ip_address' => ip_address(), 'timestamp' => time()));
}
// That's a negative
return false;
}
// If we're going to set a session, check that member is an admin or boardmember
if ($session && !$this->is_boardmember($member->id) && !$this->is_admin($member->id)) {
return false;
}
// Load password library
$this->load->library('Pass');
// Verify password
$result = $this->pass->verify($data['password'], $member->password);
if (!$result) {
// Log unsuccessful login to database
$this->db->insert('logins', array('member_id' => $member->id, 'ip_address' => ip_address(), 'timestamp' => time()));
return false;
}
// Check if wanna start a session or not
if ($session) {
// Set session
$userdata = array('member_id' => $member->id, 'email' => $data['email'], 'logged_in' => true);
if (!empty($data['remember'])) {
$userdata['remember_me'] = true;
}
$this->session->set_userdata($userdata);
// Log successful login in database
$this->db->insert('logins', array('member_id' => $member->id, 'ip_address' => ip_address(), 'timestamp' => time(), 'valid' => 1));
// Failsafe
return is_loggedin();
} else {
// No session, but return true
return true;
}
return false;
}
示例11: __construct
public function __construct()
{
parent::__construct();
is_installed();
#defined in auth helper
if (!is_loggedin()) {
if (count($_POST) <= 0) {
$this->session->set_userdata('req_url', current_url());
}
redirect(site_url('account/trylogin'));
}
//$this->per_page = get_per_page_value();
$this->load->database();
$this->active_theme = get_active_theme();
$this->load->model('user_model');
$this->load->model('show/post_model');
$this->load->helper('dbcvote');
$this->form_validation->set_error_delimiters('<label class="col-lg-2 control-label"> </label><div class="col-lg-8"><div class="alert alert-danger" style="margin-bottom:0;">', '</div></div>');
//$this->output->enable_profiler(TRUE);
}
示例12: plugin_load_config
<?php
/**
* Load Config
*
* Load the config early so we can
* use it below.
*/
$_ce_config = plugin_load_config('cms-editor');
/**
* Initiate the Editor
* This only happens if the current
* user is logged in.
*/
if (is_loggedin() && in_array($path, $_ce_config['pages'])) {
# Stylesheets
$_config['stylesheets'] = array_merge($_config['stylesheets'], $_ce_config['assets']['stylesheets']);
# Javascript
$_config['scripts'] = array_merge($_config['scripts'], $_ce_config['assets']['scripts']);
}
示例13: mysql_query
$i = 1;
$sql = 'SELECT songs.SongID, songs.SongName, artist.ArtistName, album.AlbumName, songs.Link, album.Cover
FROM songs
INNER JOIN album
ON album.AlbumID = songs.AlbumID
INNER JOIN artist
ON artist.ArtistID = songs.ArtistID
INNER JOIN mood
ON mood.MoodID = songs.MoodID
WHERE mood.Mood = "' . $moodinput . '"';
$result = mysql_query($sql);
if (mysql_num_rows($result) > 0) {
// output data of each row
while ($row = mysql_fetch_assoc($result)) {
echo "<div class='music' class='animated fadeIn'>";
echo "<div class='song-details'>";
echo "<div class='cover'><img src='" . $row["Cover"] . "' alt='cover'><span class='overlay'></span></div>";
echo "<h4>" . $row["ArtistName"] . "</h4> <h5> " . $row["AlbumName"] . " </h5> <h3> " . $row["SongName"] . "</h3>";
$song_id = $row["SongID"];
if (is_loggedin() && usersong_exists($user_id, $song_id) === false) {
echo "<a name='song' class='alink" . $i . "' onclick='add(" . $song_id . ", " . $i . ");'>Add this to your playlist</a>";
}
$like = like_percentage($song_id);
echo "<div id='" . $i . "link' class='link'>" . $row["Link"] . "</div>";
echo "<div class='like-bar'><div class='like' style='width:" . $like . "%'></div></div>";
echo "</div></div>";
$i++;
//use this variable to give each div a separate id
}
}
}
示例14: vars
{
# Get Variables Object
global $_variables;
# Get Variable
if (!is_null($name)) {
return $_variables->get($name);
}
# Get All Variables
return $_variables->get();
}
/**
* Get Variables
*
* @since 1.0.0
*/
function vars()
{
return get();
}
# Debug helpers
set('dev', array('localhost' => is_localhost()));
# Page variables
set('page', array('is_home' => is_home(), 'path' => $_path, 'slug' => get_page()), true);
# User variables
set('user', array('is_loggedin' => is_loggedin()));
# Various useful variables
set('this_year', this_year());
# Trigger: variables_init
if (extras_enabled()) {
do_trigger('variables_init');
}
示例15: switch
<?php
# Check user & validate data
switch (true) {
# Not logged in
case is_loggedin():
JSON::parse(100, 'negative', '<i class="fa fa-exclamation-triangle"></i> You\'re already logged in!', null, true);
break;
# No post data
# No post data
case !is_form_data():
JSON::parse(100, 'negative', '<i class="fa fa-exclamation-triangle"></i> There was a problem logging you in. (Error: No data received)', null, true);
break;
}
# Create User Object
$_ce_user = new CMSEditor\User($_ce_config);
# New GUMP Object
$form = new GUMP();
# Get Input
$data = form_data();
# Validate Input
$form->validate($data, array('username' => 'required', 'password' => 'required'));
# Run GUMP
$response = $form->run($data);
# Get Response
if ($response === false) {
JSON::parse(100, 'negative', $form->get_readable_errors(true));
} else {
# Attempt login
$_ce_user->login($data['username'], $data['password']);
}