-
Notifications
You must be signed in to change notification settings - Fork 42
Expand file tree
/
Copy pathexample.php
More file actions
23 lines (17 loc) · 763 Bytes
/
example.php
File metadata and controls
23 lines (17 loc) · 763 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<?php
require_once('MySqlSessionHandler.php');
$session = new MySqlSessionHandler();
// add db data
$session->setDbDetails('localhost', 'username', 'password', 'database');
// OR alternatively send a MySQLi ressource
// $session->setDbConnection($mysqli);
$session->setDbTable('session_handler_table');
session_set_save_handler(array($session, 'open'),
array($session, 'close'),
array($session, 'read'),
array($session, 'write'),
array($session, 'destroy'),
array($session, 'gc'));
// The following prevents unexpected effects when using objects as save handlers.
register_shutdown_function('session_write_close');
session_start();