In this tutorial topic you will create the user registration page and enhance it with automatic login. Once the user submits its registration data, and it is found valid and inserted into the database, the automatic login will be performed and the user will be redirected to the index page.
To create the user registration form follow the next steps:
Open the register page in Dreamweaver.
Apply the User Registration Wizard from the MX Kollection tab of the Insert bar.
Skip over the first step which presents the login settings (similar to the Login Form Wizard).
In the second step of the wizard make sure the
password_usr field is set to use a Password field.

Leave the other options at their defaults (step 3 and 4) and click Finish to close the wizard and create the registration form.
Next you have to add the automatic login functionality. A user is considered logged-in (from the MX Kollection 3 point of view) when two session variables are set (three if using access levels): kt_login_id and kt_login_user. The first stores the user ID and the second stores the user name. So, in order to login the user, you just have to set the correct values for these session variables after the registration process completes. To execute an action after the registration takes place, you must add a Custom Trigger of the AFTER type.
To implement the automatic login, follow the next steps:
Open the register page in Dreamweaver if necessary.
Add a Custom trigger from the Server Behaviors tab > + > MX Kollection > Forms > Custom trigger.
In the Basic tab of the user interface that opens you must add the code that sets the session variable values. Copy and paste the section of code that matches your particular server model below:
For PHP:
$_SESSION['kt_login_id'] = $tNG->getPrimaryKeyValue();
$_SESSION['kt_login_user'] = $tNG->getColumnValue('name_usr');
For ASPVBScript:
Session("kt_login_id") = tNG.getPrimaryKey
Session("kt_login_user") = tNG.getColumnValue("name_usr")
SET Trigger_Custom =
Nothing
For ColdFusion:
SESSION.kt_login_id = tNG.getPrimaryKeyValue();
SESSION.kt_login_user = tNG.getColumnValue ("name_usr");

Next you have to edit the Insert
transaction added by the User Registration
Wizard, so that it will no longer redirect to the login
page. Double click the Insert Transaction
in the register page. Replace the value in the
After inserting, go to text field with the
index page - click the Browse
button to select it from the site root:

Save the page and upload it to the server.
The last step of the tutorial is to create the index page content. To do so, follow the steps below:
Open the index page in Dreamweaver.
Apply a Restrict access
to page server behavior from the Server
Behaviors tab > MX Kollection > User Login. Configure it
as shown in the image below:

On the page type the following text: Hello,
. Then drag and drop the kt_login_user session
variable from the Bindings tab. Now the
page should look like the following:

Save the page and upload it to the server. Now the site is completed and you can start trying it out in the browser.
To test the application, open the register page in Dreamweaver once more. Press F12 to preview the page in a browser.
Fill in the fields with some values, like shown below (you can enter
anything you want):

Once you have filled in all the fields correctly, click the Register
button. If any errors exist, they will be displayed (like an invalid e-mail
address, or an existing user name). If all values are correct, the index page will load, displaying the name you've just
entered:
![]()
Congratulations for completing this 'how to' tutorial! New users can start using the application right away, without having to go through the login process.