Building a Forum with Dreamweaver – Part 2: Creating the Logout Link
Creating the Logout Link
Although an automatic logout takes place when the session expires or the browser window is closed, you must add an explicit logout link which enables users to clear the session information safely. You must add this link to the following forum pages:
The following steps explain how to create the link on the forum home page. You will need to repeat the steps for the other pages as well:
- Open index.php in the Code view.
- Place the cursor after the Login link in the top-right
<div>container (the one with the white links inside).
- Apply the Logout User server behavior from the Server Behaviors tab by selecting Plus (+) > MX Kollection > User Login.
Configure the dialog box as shown in Figure 26:
- Select the first option button; the the logout operation will be triggered by a link. From the pop-up menu, select Create New Link: “Logout”.
After users log out, they will be redirected to the forum home page. Click the Browse button and select the index.php page.
- Click OK to apply the server behavior.
Notice that the Logout link is created (see Figure 27).
Repeat these steps for the reply_message.php, view_message.php, and post_message.php pages.
Not all links must be visible all the time. Logged-in users have no need to see the Login and Register links, just as the Logout link means nothing for the user who hasn’t logged in or doesn’t have an account. In the next section, you will use conditional regions to control which links are displayed and when.