diff options
Diffstat (limited to 'lib/session.php')
-rw-r--r-- | lib/session.php | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/lib/session.php b/lib/session.php new file mode 100644 index 00000000..c5a8271f --- /dev/null +++ b/lib/session.php @@ -0,0 +1,34 @@ +<?php + +class Session +{ + const SESSION_LIFETIME = 2678400; + + public function open($base_path = '/') + { + session_set_cookie_params( + self::SESSION_LIFETIME, + $base_path, + null, + isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on', + true + ); + + session_start(); + } + + public function close() + { + session_destroy(); + } + + public function flash($message) + { + $_SESSION['flash_message'] = $message; + } + + public function flashError($message) + { + $_SESSION['flash_error_message'] = $message; + } +} |