The 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 |
---|---|
![]() |
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. |
![]() |
The Authorised User class This derived class just allows us a different way of defining a new user, when we know their authorisation code. |
Optional authorisation hash code
User e-mail address
True of user is active/enabled
Password encryption flag
Group membership details in full, as associative array
Array of group membership names (strings)
True if user has a group membership
Flag, true if user has auto-login IP addresses
List of IP addresses this user will be auto-logged-in from.
Limit of logins allowed (0=unlimited)
Full name
Text password (encrypted or plain)
Total logins so far
Login user id, string
Group membership count
Complete user record as an associative array
User type: arbitrary textual type
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.
Is user a member of a group Return true if the user is a member of the 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 $groups should be comma-delimited.
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