JavaScript
1
Вклад в тег
function readSession (id,callback) {
var fs = require ("fs"),
PHPUnserialize = require('php-unserialize');
fs.readFile("/var/www/cookies/sess_" + id, function (err, boof) {
if (err) throw err;
console.log(PHPUnserialize.unserializeSession(boof.toString()));
callback( PHPUnserialize.unserializeSession(boof.toString()));
})
}
app.get('/balance.json', function (req, res) {
res.setHeader("content-type", "application/json; charset=UTF-8");
readSession(req.cookies.PHPSESSID,function(readSession) {
res.end(JSON.stringify(readSession));
});
})