DX Auth User Guide Version 1.0


Tables anatomy

These are the table installed in DX Auth library and here is the explanation for each field.

users table

This is the main table, users are recorded in here.

Username field shoudn't contain space and other vulnerable character. Therefore when you validate username in registration, it's highly recommended you use alpha_dash in your form validation.

user_temp table

This table is for users who haven't activated their account.

If 'DX_email_activation' is TRUE, people who have registered is inserted into this table instead of users table. If they activate their account, the record will be moved into users table.

user_profile table

This table is for user profile.

user_autologin table

This table is to save autologin variable when user login, to verify it with autologin cookies.

Normally, you won't need to touch with this table.

roles table

This table is records of role name such as registered user, admin, moderator, etc.

You need to have minimum 2 records in here.

First, record which have id = 1 must be named 'registered user' or something similar, since users table will automatically set role_id = 1 when record is created.
And another one must have 'admin' (case insensitive) in name field while it's id is not important.

If you don't plan to use permissions feature, you don't need to care about parent_id just leave it as 0. But if you do, you can check function check_uri_permissions() in function guide to know what's the effect of having parent_id.

permissions table

check_uri_permission(), get_permission_value(), get_permissions_value() relying on this table. To set the data, you have to use function given in permissions model, or make your own. See the example on how to set the permission.

login_attempts table

This table log login attempted by people.

DX Auth will only use this table when 'DX_count_login_attempts' is set to TRUE in config file. And if login attempts for same IP is more than 'DX_max_login_attempts' in config file, it will not count that IP anymore.

role_uri table

Obsolete in 1.0.2 above. Use permissions table.