SHARE
TWEET

Untitled

a guest May 23rd, 2019 49 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class Controller_Login extends Controller
  2. {
  3.     function __construct()
  4.     {
  5.         parent::__construct();
  6.         $this->model = new Model_Login();
  7.     }
  8.  
  9.     function action_index()
  10.     {
  11.         session_start();
  12.         $this->check_session();
  13.         $this->view->generate('login_view.php', 'template_view.php');
  14.     }
  15.  
  16.     public function action_login()
  17.     {
  18.         if (isset($_POST['login'])) {
  19.             if ($this->model->has_user()) {
  20.                 $_SESSION['session_email'] = $_POST['email'];
  21.                 $this->check_session();
  22.             } else {
  23.                 header("Location: /login");
  24.                 exit();
  25.             }
  26.         }
  27.     }
  28.  
  29.     private function check_session()
  30.     {
  31.  
  32.         if (isset($_SESSION['session_email'])) {
  33.             header("Location: /employee");
  34.             exit();
  35.         } else
  36.             $this->action_login();
  37.     }
  38.  
  39. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top