manager
is a handy little class that lets you control the user’s login status. If they have a long period of no activity, you can automatically redirect them to a login page, etc. Likewise, if they try to get sneaky and change IP addresses you can reroute them as well.
Parent Class
None
Public Properties
manager
instanceData Type: array
Default Value: iPinga default settings
manager
believes the user should be redirected to. An empty string for no redirect.Data Type: string
Default Value: empty string
manager
checked?Data Type: boolean
Default Value: false
manager
checked his status?Data Type: string
Default Value: empty string
manager
checked the user’s statusData Type: array
Default Value: empty array
Public Methods
iPinga
configuration settingsParameters:
$overrideSettings
(array: optional) associative array (key=value pairs) that override the iPinga
configuration settings. Only the manager.* settings can be overridden by passing this array.Returns:
A
manager
instanceExample:
1 |
$myManager = new \ipinga\manager(array( 'manager.max_minutes' => 20 )); |
$loggedInDetails
array from the iPinga cookie. This function is normally not needed outside of some the class itself.Parameters:
None
Returns:
null
Example:
1 2 |
$myManager = new \ipinga\manager(array( 'manager.max_minutes' => 20 )); $myManager->loadFromCookie(); |
$loggedInDetails
array to the iPinga cookie. This function is normally not needed outside of some the class itself.Parameters:
None
Returns:
null
Example:
1 2 3 |
$myManager = new \ipinga\manager(array( 'manager.max_minutes' => 20 )); // ...do something here... $myManager->shutdown(); |
manager
that the user has now logged out. This function calls shutdown()
as well.Parameters:
None
Returns:
null
Example:
1 2 3 |
$myManager = new \ipinga\manager(array( 'manager.max_minutes' => 20 )); // ...do something here... $myManager->logout(); |
manager
that the user has now logged in. This function calls shutdown()
as well. You should call this method whenever the user logs in, and also whenever the logged in user interacts with your site. ie: this is how manager
knows the user has not expired/timed out.Parameters:
$userId
(mixed) is the user id you wish to store in the cookie
and in the manager
objectsReturns:
null
Example:
1 2 3 |
$myManager = new \ipinga\manager(array( 'manager.max_minutes' => 20 )); // ...do something here... $myManager->update(55); |
manager
if the user is logged in or not.Parameters:
$redirectIfNotLoggedIn
(boolean: optional) tells manager
to perform a hard redirect if the user is not logged in (has expired, changed ip addresses, etc). Note: this stops the execution cold and redirects the user to the new url defined in $settings
. Default: false;Returns:
True if the user is logged in, otherwise false. Note: if $redirectIfNotLoggedIn is set to true and the user is not logged in, this function will never return to your code. False if the user is not logged in. If false, then you should check the
$message
for reasons why.