Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // Security measures.
- defined('BASEPATH') OR exit('No direct script access allowed');
- //
- // AccountController
- //
- // Each and every single page that requires us to be logged in, is based on this
- // class. It automatically ensures we can't make any mistakes by forgetting to
- // check for being logged in and/or redirecting anywhere.
- //
- // TODO: Possibly add additional functions here.
- //
- class AccountController extends CI_Controller {
- // Stores the user session data.
- var $session_user;
- function __construct() {
- // Call parent class constructor.
- parent::__construct();
- // Ensure no cache.
- Utils::no_cache();
- // In case we aren't logged in, redirect to the login page.
- if (!$this->session->userdata('logged_in')) {
- redirect(base_url('auth/login'));
- exit;
- }
- // Store user data fetched from our session.
- $this->session_user = $this->session->userdata('logged_in');
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement