Session access data

7 views
Skip to first unread message

Sergio Ambel Santoyo

unread,
Jul 19, 2013, 2:39:44 PM7/19/13
to sifophp
Some time we want access to some kind of Session Data. For this purpose we launch a request like:

return \Sifo\Session::getInstance()->get( 'user_data' );


In this case we can work with two different options:

false -> the user is unlogged
some_data -> the user is logged and we have loadded the expected data.


This operation has a small problem. The Session getinstance op is responding a Session start and this operation sends a PHPSESSID cookie to the user.

Everybody know that cookie have a money cost (tranfer and time). But, if we use some kind of middle cache like Varnish or Akamay probably we are not caching the response because http head change :(.

I purpose use this option:

  $filter_cookie = FilterCookie::getInstance();

if( $filter_cookie->getString( 'PHPSESSID' ) )
{
return \Sifo\Session::getInstance()->get( 'user_data' );
}
return false;

It's easy and cheap :)


Have a nice weekend.


Sergio

Albert Lombarte

unread,
Jul 23, 2013, 8:21:28 AM7/23/13
to sif...@googlegroups.com
To be taken into account:

The use of cookies in session can be disabled in PHP.ini, and the name of PHPSESSID can be changed as well. I don't think this would be the solution.


2013/7/19 Sergio Ambel Santoyo <sergi...@gmail.com>

--
You received this message because you are subscribed to the Google Groups "SIFO, PHP framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sifophp+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Reply all
Reply to author
Forward
0 new messages