forked from sprain/PHP-MySQL-Session-Handler
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.php
More file actions
26 lines (24 loc) · 813 Bytes
/
example.php
File metadata and controls
26 lines (24 loc) · 813 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<?php
//The config file where you store your database password should be outside of
//your document root
require_once('dbconfig.php');
require_once('SessionHandler.php');
//This will create a session handler object and register it for all session operations.
new SessionHandler($dbhost, $dbuser, $dbpass, $dbname);
//Same but keeping a reference to it.
//$sh = new SessionHandler($dbhost, $dbuser, $dbpass, $dbname);
echo 'Creating Session...';
session_start();
echo 'sucess<br>';
echo 'Creating new session variable...';
$_SESSION['myvar'] = uniqid();
echo 'sucess<br>';
echo 'Retrieving new session variable value...';
echo $_SESSION['myvar']. '<br>';
echo 'Removing new session variable ...';
unset($_SESSION['myvar']);
echo 'sucess<br>';
echo 'Removing Session...';
session_destroy();
echo 'sucess<br>';
?>