Restrict user access and display statistics (requires PRO version)

In this topic you will use features available only in MX Kollection 3 Professional to enhance the user section of the job site. You will add the following functionality:

 

Note: You can follow the instructions below only if you have installed MX Kollection 3 Professional.

 

Restrict user accounts

 

In the first section of the tutorial you will add restrictions for the site users. In order to do so, you must modify the user's table structure:

Open your database management software and add the following fields to the user_usr table:

  1. registrationdate_usr - type: date/time - stores the date when the user registered on the site.

  2. ntries_usr - type: integer - stores the number of times the user has tried to login.

  3. disabledate_usr - type:date / time - stores the date until when the account is disabled.

  4. expiration_usr -  type: date / time - stores the date when the account will expire.

 

 Once you have done so, follow the next steps to add the account restrictions:

  1. Open the site in Dreamweaver.

  2. From the Insert bar > MX Kollection tab click the InterAKT Control Panel icon. Then select the Login Settings section.

  3. In the Login Settings switch to the Restrictions tab. Configure the options as follows:

  4. Click OK to apply the changes. All of the actions will be executed transparently, so you do not need to modify the login or registration page for these features to work.

 

Track user statistics

 

In this section you will add user statistics to the site. This way, the site admin can see registration dates, the last login and logout date, and more.

To add this functionality you will have to add a new database table to store the information. The table to use is named logger_log and has the following structure:

Before displaying any statistics, you need to create them. Once the logging table has been correctly configured in the Control Panel > Login Settings section, the login and logout pages automatically start saving information, without any need to modify anything. To define the table options, follow these steps:

  1. Open one of the site pages.

  2. Go to the MX Kollection tab of the Insert bar and open the InterAKT Control Panel.

  3. If you have updated the database tables after creating a section of the site you should clear the database cache. You can do so by going to the Database Caching and User Interface Persistence section of the Control Panel and clicking the Empty button.

  4. Now click the Login Settings icon in the Control Panel. When it loads, switch to the History tab.

  5. On this tab you can define which table to use and into which columns to store which information:

  6. When you are done configuring the options, click OK to apply the changes. You will also have to upload the tng/tng.config.inc.xxx file to the testing server, as this is where the options are stored.

 

To test the history feature, login and logout with a valid account for a few times. You should see the number of entries in the logger_log table increasing. To add the site administrator check out the statistics in a more easy manner you will create a page that displays the information:

  1. Create a new folder named admin in the site root. In this folder create a page named statistics.xxx.
    Note:
    Replace .xxx with the extension required by your particular server model.

  2. Open the page in Dreamweaver. To retrieve the information you will have to create an advanced recordset that joins information from the user and logger tables.

  3. On the Server Behavior tab > Bindings click the Plus (+) button and select the Recordset (Query) option.

  4. Click the Advanced button to manually enter a SQL query. Name the recordset rsStats and then paste the following query in the SQL text area:

    SELECT * FROM user_usr LEFT JOIN logger_log ON id_usr = idusr_log

     

  5. Click Test to preview the recordset results, and if everything is alright, click OK to create the recordset.

  6. On the Insert bar > Application tab click the Dynamic Table icon. Configure it to use the rsStats recordset and display all records. Click OK to apply the command and create the table.

  7. From the page remove all table columns except: email_usr, ip_log, datein_log and dateout_log. This will display a clean table with the action history for a specific user.

  8. Save the page and upload it to the testing server. Then press F12 in Dreamweaver to preview it:


     

Now you can further enhance the page buy computing the amount of time spent on the site or displaying other user details.