Welcome! Log In Create A New Profile

Advanced

i have a module to parse serialized php sessions

February 13, 2010 09:18PM
hi

i recently wrote an nginx module that can extract certain values out
of a serialized php session. in my case i'm retrieving the php session
from a memcache. this thing isn't tested in prod, in fact i started it
yesterday. but it seems to work and i can't find any bigger problems
with it at the moment.

currently it works like this:

33 location / {
34 eval $session {
35 set $memcached_key
"d41d8cd98f00b204e9800998ecf8427e:5b9hm9rspbgajg22eqpqs6ang1";
37 memcached_pass 192.168.1.237:11210;
38 }
....
44 php_session_parse $admin_right $session
"symfony/user/sfUser/attributes|s:10:\"subscriber\";s:7:\"isAdmin\"";
....
53 if ($admin_right = "b:1")
54 {
55 # do something
56 }

i think the format how i am specifying the value that i want to
extract from the session might be a little confusing (and there are no
docs yet). in the example the value that i want to extract is
specified with the string:

"symfony/user/sfUser/attributes|s:10:\"subscriber\";s:7:\"isAdmin\"

which means on the toplevel array i want the element
"symfony/user/sfUser/attributes", second level i want the element
"s:10:\"subscriber\"", third level i want the element
"s:7:\"isAdmin\"". separators between the elements are ; and |. this
might seem confusing, but thats the way how its done in the php
session serialization...

i would be happy about some feedbacks. could a thing like this be
useful? i'm sure there are still bugs too...

thats the link:

http://github.com/replay/ngx_http_php_session


mauro

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx
Subject Author Posted

i have a module to parse serialized php sessions

replay February 13, 2010 09:18PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 169
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready