userThe user class This class managed users. It pre-supposes a particular database structure based on three tables: uuser, ugroup, and uuser_group.
Please see the example schemas for Phplib for further details.
Located in /user-defs.php (line 36)
| Class | Description |
|---|---|
session
|
THE SESSION CLASS A class to manage user sessions. A session is simply a thing which contains information about a user who has logged on to the system, so in fact the session is just an extension of a user. |
authorised_user
|
The Authorised User class This derived class just allows us a different way of defining a new user, when we know their authorisation code. |
mixed
$auth_code
= "" (line 42)
Optional authorisation hash code
mixed
$email
= "" (line 50)
User e-mail address
mixed
$enabled
= false (line 54)
True of user is active/enabled
mixed
$encrypted_passwords
= false (line 48)
Password encryption flag
mixed
$group_info
(line 64)
Group membership details in full, as associative array
mixed
$group_names
= array() (line 62)
Array of group membership names (strings)
mixed
$hasgroups
= false (line 60)
True if user has a group membership
mixed
$hasIPlist
= false (line 72)
Flag, true if user has auto-login IP addresses
mixed
$IP
(line 70)
List of IP addresses this user will be auto-logged-in from.
mixed
$limit_logins
= 0 (line 58)
Limit of logins allowed (0=unlimited)
mixed
$name
= "" (line 44)
Full name
mixed
$password
= "" (line 46)
Text password (encrypted or plain)
mixed
$total_logins
= 0 (line 56)
Total logins so far
mixed
$userid
= "" (line 38)
Login user id, string
mixed
$user_groups_cnt
= 0 (line 66)
Group membership count
mixed
$user_record
(line 68)
Complete user record as an associative array
mixed
$user_type
= "" (line 52)
User type: arbitrary textual type
mixed
$valid
= false (line 40)
True if user record is valid
Constructor Create a new user object.
Authenticate a user Tries all types of authentication we know about using the parameters passed to it.
Authenticate a user by authorisation ID
Authenticate a user by IP address
Authenticate a user by userid/password.
Get friendly name
Make a 'friendly' name from a full one. Good for "Dear... ,"
Get user Authorisation Code Return this user's unique authorisation code; generate one if it isn't there yet, from userid and current time.
Get user groups info
For this user, populate the group data for this object. We read the uuser_group and ugroup tables and populate the two variables @see $user_groups and @see $group_info
Get user by Authorisation Code Internal function to return the user record from auth_code. The authorisation code is usually a string containing a complex key generated by something like MD5 or better.
Get user by ID Internal function to return the user record from id.
Get user by IP Internal function to return the user record which has IP address(es) which coincide with the client IP address being used for this access.
Get group IDs list
Return a string with the comma-delimited list of group ids which this user belongs to in it. This is useful for using in an SQL statement like: WHERE group_id IN (group_ids_list()) for example. Note we only access the database to populate $this->group_info when we need to, not every session.
Get group names list
Return a string with the comma-delimited list of group names which this user belongs to in it. Eg. "Editor,Author,Admin"
Is user a member of a named group. The argument passed in must be a single group name string (ie. not a numeric group id) which is defined in the database.
Return true if the user is a member of the named group.
Is user a member of one group of many Check user against a list of groups, return true if member of at least one of them. The list in $groupnames can be either a comma-delimited string of group names, OR an array of group names.
Is user a member of a group with ID Return true if the user is a member of the group with given ID.
Return true if the current user is a valid one. This is false when the user has not been authorised, or the user ID wasn't found etc. It is an error condition for this to be false.
Set the password encryption flag. If passed in true, then we will be assuming that new passwords should be encrypted, and password checks will try encryption first, then fall back to basic.
Set the user login password. Store it according to the encryption mode. We assume a plain text password is being supplied.
NB: Axyl-encrypted passwords always have an 'axenc_' prefix.
Documentation generated by phpDocumentor 1.3.0RC3