|
SelfHelp WebApp
v2.0.6
A WebApp to Create WebApps for Studies in Human Sciences
|
Public Member Functions | |
| __construct ($db, $store_url=false, $redirect=false) | |
| check_credentials ($email, $password) | |
| change_password ($password) | |
| create_token () | |
| delete_user ($uid, $email) | |
| get_target_url ($default_url) | |
| is_logged_in () | |
| logout () | |
Private Member Functions | |
| init_session () | |
| update_last_url ($id, $url) | |
| update_timestamp ($id) | |
Private Attributes | |
| $db | |
| $store_url | |
| $redirect | |
This class allows to check wheter a login is valid.
| Login::__construct | ( | $db, | |
$store_url = false, |
|||
$redirect = false |
|||
| ) |
Start the session.
| object | $db | The db instance which grants access to the DB. |
| bool | $store_url | If true the current url is stored as last url in the db. |
| bool | $redirect | If true the user is redirected to the current url after login. |
| Login::change_password | ( | $password | ) |
Change the password of the active user.
| string | $password | The new password. |
| bool | True if the change was successful, false otherwise |
| Login::check_credentials | ( | $email, | |
| $password | |||
| ) |
Check login credentials with the db and set the session variable if successful. If the check fails, the session variable is destroyed.
| string | The email address of the user. | |
| string | $password | The password string entered by the user. |
| bool | true if the check was successful, false otherwise. |
| Login::create_token | ( | ) |
Create a random token string that can be used for verification.
| string | A random string. |
| Login::delete_user | ( | $uid, | |
| ) |
Delete the user if the given email address matches with the email address stored in the database.
| int | $uid | The user id. |
| string | The user email address. |
| bool | True if the deleting process was successful, false otherwise. |
| Login::get_target_url | ( | $default_url | ) |
Get the target URL to redirec after login. This is either
| string | The target URL. |
|
private |
Initialise the php session.
Referenced by __construct(), and logout().
| Login::is_logged_in | ( | ) |
Check whether the user is logged in by ckecking for a user id in the session variable.
| bool | true if the user is logged in, false otherwise. |
Referenced by get_target_url(), and init_session().
| Login::logout | ( | ) |
Logout the user by removing all session variables and destroying the session.
|
private |
Update the last visited url of the active user.
| $id | The user id |
| $url | The target url |
Referenced by init_session().
|
private |
Update the timestamp of the last login.
| int | $id | The user id |
| int | The number of affected rows or false on failure. |
Referenced by check_credentials().
|
private |
The db instance which grants access to the DB.
Referenced by __construct().
|
private |
If true the user is redirected to the current url after login.
Referenced by __construct().
|
private |
If true the current url is stored as last url in the db.
Referenced by __construct().