本文整理汇总了PHP中Access::isLoggedIn方法的典型用法代码示例。如果您正苦于以下问题:PHP Access::isLoggedIn方法的具体用法?PHP Access::isLoggedIn怎么用?PHP Access::isLoggedIn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Access
的用法示例。
在下文中一共展示了Access::isLoggedIn方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
/**
* Loads default home page.
*/
public function index($lang = 'ch')
{
if (!file_exists('application/views/' . $lang . '/index.php')) {
// Whoops, we don't have a page for that!
show_404();
}
$this->load->model('video_model', 'video');
$data['video'] = $this->video->get_last_video(Access::isLoggedIn());
$this->load->library('javascript_plugins');
$plugins = $this->javascript_plugins;
$footer_data['js_plugins'] = $plugins->generate(array($plugins::FlowPlayer));
$this->loadHeader($lang);
$this->load->view($lang . '/index', $data);
$this->load->view('templates/footer', $footer_data);
}
示例2: audio
public function audio($id = NULL)
{
if (!file_exists('application/views/ch/worship/audio.php')) {
// Whoops, we don't have a page for that!
show_404();
}
$data['video'] = $this->video->get_video($id);
// check privilege to see Paster Hou's message
if ($data['video']['speaker'] == '侯君麗牧師' && !Access::isLoggedIn()) {
show_404();
}
$this->load->library('javascript_plugins');
$plugins = $this->javascript_plugins;
$footer_data['js_plugins'] = $plugins->generate(array($plugins::FlowPlayer));
$this->load->view('templates/header_ch');
$this->load->view('ch/worship/audio', $data);
$this->load->view('templates/footer', $footer_data);
}
示例3: base_url
echo base_url();
?>
assets/js/jquery.js"></script>
<script src="<?php
echo base_url();
?>
assets/js/bootstrap.min.js"></script>
</head>
<body>
<div class="top">
<div class="container">
<ul class="loginbar pull-right">
<?php
if (Access::isLoggedIn()) {
$user = $this->session->userdata('firstname');
$url = site_url() . '/auth/doLogout/ch';
printf("<li><a href=\"%s\">%s 注銷</a></li>", $url, $user);
} else {
$url = site_url() . '/auth/loginForm';
printf("<li><a href=\"%s\">登錄</a></li>", $url);
}
?>
<li class="devider"></li>
<li><a href="<?php
echo site_url();
?>
/pages/index/en">English</a>
</li>
</ul>
示例4: loginForm
public function loginForm($lang = 'ch')
{
$this->loadResouces($lang);
$data['lang'] = $lang;
// logout the old user first
if (Access::isLoggedIn()) {
$this->session->sess_destroy();
}
// setting validation rules
$this->load->library('form_validation');
$this->load->library('validation_rules');
$rules = $this->validation_rules;
$this->form_validation->set_rules($rules::$loginRules);
$dispatchUrl;
// form validation
$refer_url = $this->session->userdata('refer_url');
if ($this->form_validation->run() == FALSE) {
if (isset($_SERVER['HTTP_REFERER']) && empty($refer_url)) {
$this->session->set_userdata(array('refer_url' => $_SERVER['HTTP_REFERER']));
}
$dispatchUrl = 'auth/loginpage';
} else {
$username = $this->input->post('username');
$password = $this->input->post('password');
$rows = $this->user_model->get_user($username);
// no user
if (count($rows) == 0) {
$login_error = $this->lang->line('auth_no_user_error');
} else {
$row = $rows[0];
$hash = hash('sha256', $row['salt'] . hash('sha256', $password));
if ($hash != $row['password']) {
$login_error = $this->lang->line('auth_wrong_password_error');
}
}
if (empty($login_error)) {
// save session data
$newdata = array('logged_in' => TRUE, 'username' => $username, 'firstname' => $row['first_name'], 'role' => $row['role']);
$this->session->set_userdata($newdata);
// referer url cannot be loginForm itself
if (!empty($refer_url)) {
if (strpos($refer_url, site_url() . '/auth/loginForm') === 0) {
$dispatchUrl = site_url();
} else {
$dispatchUrl = $refer_url;
}
} else {
$dispatchUrl = site_url();
}
// redirect to previous page after login
redirect($dispatchUrl, 'refresh');
die;
} else {
$_REQUEST['login_error'] = $login_error;
$dispatchUrl = 'auth/loginpage';
}
}
$this->load->view('templates/header_' . $lang, $data);
$this->load->view($dispatchUrl, $data);
$this->load->view('templates/footer');
}