Skip to content

Instantly share code, notes, and snippets.

@rightfold
Created June 14, 2015 15:57
Show Gist options
  • Save rightfold/850b1c6ea4c96c85a657 to your computer and use it in GitHub Desktop.
Save rightfold/850b1c6ea4c96c85a657 to your computer and use it in GitHub Desktop.
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);
};
}
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