summaryrefslogtreecommitdiff
path: root/tests/code/session.php
diff options
context:
space:
mode:
authorGeorge Halkiadakis <gchalkiadakis@sklavenitis.co.gr>2023-04-27 03:47:30 +0300
committerGeorge Halkiadakis <gchalkiadakis@sklavenitis.co.gr>2023-04-27 03:47:30 +0300
commit059e0d95d0c28bc5060e87e146eaf7411f51bf90 (patch)
tree7c21ac432f16dde2329a0d5954d70711eceb48e6 /tests/code/session.php
parent26cd8ee99659ef1926c96a049c93645ffc9b169d (diff)
downloadgyraf1gov-059e0d95d0c28bc5060e87e146eaf7411f51bf90.tar.gz
gyraf1gov-059e0d95d0c28bc5060e87e146eaf7411f51bf90.tar.bz2
gyraf1gov-059e0d95d0c28bc5060e87e146eaf7411f51bf90.zip
skeleton commit; based on an anom project
Diffstat (limited to 'tests/code/session.php')
-rwxr-xr-xtests/code/session.php50
1 files changed, 50 insertions, 0 deletions
diff --git a/tests/code/session.php b/tests/code/session.php
new file mode 100755
index 0000000..478160a
--- /dev/null
+++ b/tests/code/session.php
@@ -0,0 +1,50 @@
+<?php
+echo '<pre>';
+echo "\n(in) ". session_id();
+
+echo "\nsesion path: ". session_save_path();
+
+if (isset($_SESSION['c'])) {
+ echo "\nexist:". print_r($_SESSION['c'], true);
+
+} else {
+ $number = [
+ rand(1,1000),
+ rand(1,1000),
+ rand(1,1000)
+ ];
+ echo "\ncreated random:". print_r($number, true);
+ $_SESSION['c'] = $number;
+}
+
+session_regenerate_id();
+echo "\n(out) ". session_id();
+
+echo '</pre>';
+### class SomeSessionHandler extends SessionHandler
+### {
+### private $key;
+###
+### public function __construct()
+### {
+### // nothing
+### }
+###
+### public function close()
+### {
+### return parent::close();
+###
+### }
+###
+### }
+###
+### // we'll intercept the native 'files' handler, but will equally work
+### // with other internal native handlers like 'sqlite', 'memcache' or 'memcached'
+### // which are provided by PHP extensions.
+### // ini_set('session.save_handler', 'files');
+###
+### $handler = new SomeSessionHandler();
+### session_set_save_handler($handler, true);
+### session_start();
+###
+### echo 'hm!';