Constructor
If valid session cookie received: pull session from DB Otherwise, INSERT a session into DB
void assert_received_crumb(
string
$crumb_name
)
|
|
Assert that we received a valid crumb for the object we want to act on.
This will DIE if we have not received a valid crumb.
The received crumb must match a crumb we previously saved less than 2 hours ago.
Parameters:
|
string |
$crumb_name: |
crumb name |
string create_crumb(
string
$crumb_name
)
|
|
Create a crumb that will be saved into the Session and returned to the caller for inclusion in Form or action url.
For any action, a new crumb is generated every hour and the previous one is saved. (2 hours are valid)
Parameters:
|
string |
$crumb_name: |
crumb name |
API Tags:
Updates session data in database.
NOTE: Debuglog additions will may not be displayed since the debuglog may alreayd have been displayed (shutdown function)
void delete(
string
$param
)
|
|
Delete a value from the session data.
Parameters:
|
string |
$param: |
Name of the data's key. |
mixed get(
string
$param, [mixed
$default = NULL]
)
|
|
Get a data value for the session. This checks for the data to be expired and unsets it then.
Parameters:
|
string |
$param: |
Name of the data's key. |
|
mixed |
$default: |
Default value to use if key is not set or has expired. (since 1.10.0) |
API Tags:
| Return: | The value, if set; otherwise $default |
Check if session has a user attached.
Logout the user, by invalidating the session key and unsetting $user_ID.
We want to keep the user in the session log, but we're unsetting $user_ID, which refers to the current session.
Because the session key is invalid/broken, on the next request a new session will be started.
NOTE: we MIGHT want to link subsequent sessions together if we want to keep track...
Reload session data.
This is needed if the running process waits for a child process to write data into the Session, e.g. the captcha plugin in test mode waiting for the Debuglog output from the process that created the image (included through an IMG tag).
void session_needs_save(
$session_needs_save
)
|
|
Parameters:
void set(
string
$param, mixed
$value, [integer
$expire = 0]
)
|
|
Set a data value for the session.
Updated values get saved to the DB automatically on shutdown, in shutdown().
Parameters:
|
string |
$param: |
Name of the data's key. |
|
mixed |
$value: |
The value |
|
integer |
$expire: |
Time in seconds for data to expire (0 to disable). |
void set_User(
User
$User
)
|
|
Attach a User object to the session.
Parameters:
|
User |
$User: |
The user to attach |
void set_user_ID(
integer
$user_ID
)
|
|
Attach a user ID to the session.
NOTE: ID gets saved to DB on shutdown. This may be a "problem" when querying T_sessions for sess_user_ID.
Parameters:
|
integer |
$user_ID: |
The ID of the user to attach |