| 123456789101112131415161718192021222324252627282930 |
- <?php
- class Session extends Model {
- protected static $table = "session";
- protected static $id_field = "id";
- protected static $fillable_fields = ["id", "data", "dts_last_access"];
- public static function start($name="", $timeout=3600) {
- $handler = new SiteSessionHandler();
- session_set_save_handler($handler, true);
- session_set_cookie_params($timeout, "/", "");
- // Set session name if passed
- if(!empty($name)) session_name($name);
- session_start();
- }
- public static function extend($timeout) {
- $id = session_id();
- $name = session_name();
- setcookie($name, $id, time()+$timeout, "/", "");
- }
- }
- ?>
|