Framework solution
Now let's develop some code that implements the ideas discussed in the first part of this chapter. It is built as two classes, one for the session itself and one for dealing with the storage of session data.
Building a session handler
Aliro deals with sessions using a singleton object to represent the current session. Another singleton object handles session data, and is described later. The session object is obtained from a very simple factory method that is located in aliroSession:
public static function getSession () { return _ALIRO_IS_ADMIN ? aliroAdminSession::getInstance() : aliroUserSession::getInstance(); }
Different code is run depending on whether the CMS is entered through the administrator or the general interface, and different definitions are set for a number of symbols, including _ALIRO_IS_ADMIN
. The fact that these settings are made in very early processing makes it difficult to subvert the information. The singleton session object is an instance of one...