Advertisement
Guest User

Untitled

a guest
Aug 19th, 2018
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. <?php
  2. // Security measures.
  3. defined('BASEPATH') OR exit('No direct script access allowed');
  4.  
  5. //
  6. // AccountController
  7. //
  8. // Each and every single page that requires us to be logged in, is based on this
  9. // class. It automatically ensures we can't make any mistakes by forgetting to
  10. // check for being logged in and/or redirecting anywhere.
  11. //
  12. // TODO: Possibly add additional functions here.
  13. //
  14. class AccountController extends CI_Controller {
  15. // Stores the user session data.
  16. var $session_user;
  17.  
  18. function __construct() {
  19. // Call parent class constructor.
  20. parent::__construct();
  21.  
  22. // Ensure no cache.
  23. Utils::no_cache();
  24.  
  25. // In case we aren't logged in, redirect to the login page.
  26. if (!$this->session->userdata('logged_in')) {
  27. redirect(base_url('auth/login'));
  28. exit;
  29. }
  30.  
  31. // Store user data fetched from our session.
  32. $this->session_user = $this->session->userdata('logged_in');
  33. }
  34. }
  35.  
  36. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement