/** * Before filter * * @return void, or false */ protected function before() { session_start(); if (!Authenticate::isLogin()) { URL::redirect('authenticate'); return false; } }
/** * Show the index page * * @return void */ public function indexAction() { if (!(isset($_POST['email']) && isset($_POST['password']))) { static::setLogin(3, 'please fill in this form'); URL::redirect(''); } if (!static::validate($_POST['email'], $_POST['password'])) { unset($_SESSION['email']); unset($_SESSION['password']); static::setLogin(2, 'Email or password is incorrect'); URL::redirect(''); } static::setLogin(1, 'log in success'); $_SESSION['email'] = $_POST['email']; $_SESSION['password'] = md5($_POST['password']); URL::redirect(''); }