Created
June 14, 2015 15:57
-
-
Save rightfold/850b1c6ea4c96c85a657 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function signin_required($login_page, $fn) { | |
return function($db) use ($fn, $login_page) { | |
if (array_key_exists('user_id', $_SESSION)) | |
$fn($db); | |
else engine\redirect($login_page); | |
}; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
engine\run([ | |
'get:' => $login_form, | |
'get:login' => $login_form, | |
'post:login' => $do_login, | |
'get:home' => $home, | |
]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment