How to display user details using session variables

In this 'how to' tutorial you will learn how to allow registered users view their private information upon login. By 'private information' we mean the data stored in the database corresponding to each user (full name, site username, e-mail address, billing address). These details are displayed from some session variables and can only be viewed by the currently logged-in user (this page will have a restricted access to it).

The registering process for new users of your site will not be covered in this 'how to' tutorial. If you want to add a registration page to your application, consult the instructions found here.

 

If you have the MX Kollection 3 bundle installed, then you have all the needed tools to build this application. Otherwise, the following separate products should be installed on your computer in order to complete the How to display user details using session variables tutorial:

The estimated completion time for this tutorial is 15 minutes. It also depends on your authoring knowledge with Dreamweaver and MX Kollection 3.

 

The database structure used is clear and simple. It only uses one table:

 

Note: The database diagram in the image above was built with MX Query Builder (also referred as QuB) to better illustrate the database structure. You do not need to build it in order to complete this 'how to' tutorial.

 

  1. The user_usr table stores data about your site users:

To quickly create the database structure, use the scripts provided in the zip package (either .sql or .mdb) corresponding to your database server. You can find the scripts in the \tutorials\_HOW_TO\Show user details\db\ folder.

There are two records already inserted in the table. In order to test your application, you can login with the username and password corresponding to these two records:

  1. Username: john. Password: root.

  2. Username: jane. Password: root.

 

In order to complete this tutorial, create two files in your Dreamweaver site:

  1. the index page that will contain the login form.

  2. the details page that will display the particular information of the user logged-in in the current session.

Before you start building the actual application, open the index page and define a Dreamweaver database connection: conn_details_session. Configure it to connect to your database server and make it point to the database containing the table described above.

Contents

Configure login settings

Display user details using session variables