ZMObject
└─ZMSession
public class ZMSession
extends ZMObject
| Field Summary | |
|---|---|
| final str | The default session name. |
| final str | The default namespace prefix for session keys. |
| final str | A magic session key used to identify new sessions. |
| final str | A magic session key used to validate forms. |
| Fields inherited from org.zenmagick.core.ZMObject | |
|---|---|
| properties_ | |
| Constructor Summary | |
|---|---|
ZMSession(string name, boolean secure) Create new instance. |
|
| Method Summary | |
|---|---|
| void | close() Close session rather than wait for the end of request handling. |
| void | destroy() Destroy the current session. |
| void | getData() Get the current session data. |
| string | getId() Get the session id. |
| string | getName() Get the session name. |
| string | getToken(boolean renew) Get the session token. |
| mixed | getValue(string name, string namespace) Get a session value. |
| boolean | isNew() Check if this is a new session or resumed. |
| boolean | Check if we have a session yet. |
| static boolean | isValidSID(string sid) Check if the given sid is valid. |
| void | Regenerate session. |
| void | registerSessionHandler(mixed handler, mixed A) Register a session handler. |
| mixed | setValue(string name, mxied value, string namespace) Set a session value. |
| boolean | start() Start session. |
| Methods inherited from org.zenmagick.core.ZMObject | |
|---|---|
| attachMethod, get, getAttachedMethods, getPropertyNames, set, singleton | |
public final str DEFAULT_NAME = 'zmid'
The default session name.
public final str DEFAULT_NAMESPACE_PREFIX = '__ZM_NSP__'
The default namespace prefix for session keys.
public final str SESSION_TAG_KEY = '__ZM_TAG__'
A magic session key used to identify new sessions.
public final str SESSION_TOKEN_KEY = '__ZM_TOKEN__'
A magic session key used to validate forms.
public ZMSession(string name, boolean secure)
Create new instance.
ZMSession::DEFAULT_NAME.true.public void close()
Close session rather than wait for the end of request handling.
public void destroy()
Destroy the current session.
public void getData()
Get the current session data.
public string getId()
Get the session id.
null.public string getName()
Get the session name.
null.public string getToken(boolean renew)
Get the session token.
A new token will be created if none exists.
true a new token will be generated; default is false.public mixed getValue(string name, string namespace)
Get a session value.
null for none.null.public boolean isNew()
Check if this is a new session or resumed.
This will return true in the following cases:
true if this is a new session.public boolean isStarted()
Check if we have a session yet.
true if the session has been already started.public static boolean isValidSID(string sid)
Check if the given sid is valid.
true if the sid is valid.public void regenerate()
Regenerate session.
This will create a new session id while keeping existing session data.
public void registerSessionHandler(mixed handler, mixed A)
Register a session handler.
public mixed setValue(string name, mxied value, string namespace)
Set a session value.
null to clear all data.null to remove; default is null.null for none.null.public boolean start()
Start session.
true if a session was started, false if not.
A basic, cookies only, session class.