Description
groan is a PHP session file parser written in JavaScript.
Requirements
- JavaScript (compatible with node.js)
Node.JS Examples
var fs = parser = ; /* ideally you should first ensure (session file's mtime + PHP's session.gc_maxlifetime) > Date.now() to ensure that the session has not expired yet*/ // if it is still valid, continue on ...fs;
var parser = ; var serialized = 'a:5:{i:0;s:3:"foo";s:1:"a";s:5:"apple";s:1:"b";b:0;s:1:"c";a:3:{i:0;i:17;i:1;d:1.5;i:2;s:1:"x";}s:1:"d";a:0:{}}';consoledir; // output:// { '0': 'foo', a: 'apple', b: false, c: [ 17, 1.5, 'x' ], d: [] }
Notes
-
References and recursion are not currently supported (currently returns
undefined
) -
The parser assumes the session file data is in the valid PHP session serialized format