2013-02-18 03:48:21 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace PicoFarad\Session;
|
|
|
|
|
|
|
|
const SESSION_LIFETIME = 2678400;
|
|
|
|
|
|
|
|
|
2014-02-08 20:13:14 +01:00
|
|
|
function open($base_path = '/', $save_path = '')
|
2013-02-18 03:48:21 +01:00
|
|
|
{
|
2014-02-08 20:13:14 +01:00
|
|
|
if ($save_path !== '') session_save_path($save_path);
|
|
|
|
|
2013-03-26 02:29:30 +01:00
|
|
|
session_set_cookie_params(
|
|
|
|
SESSION_LIFETIME,
|
|
|
|
$base_path,
|
|
|
|
null,
|
|
|
|
isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on',
|
|
|
|
true
|
|
|
|
);
|
|
|
|
|
2013-02-18 03:48:21 +01:00
|
|
|
session_start();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function close()
|
|
|
|
{
|
|
|
|
session_destroy();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function flash($message)
|
|
|
|
{
|
|
|
|
$_SESSION['flash_message'] = $message;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function flash_error($message)
|
|
|
|
{
|
|
|
|
$_SESSION['flash_error_message'] = $message;
|
|
|
|
}
|