HTML and CSS Reference
The following listing contains the code that determines whether to show the login form or
Listing 4.3. Check to see if the user is logged on
Now that you've added a conditional statement before the code for the chat form, you have
to close the first block of the condition, then add the code for the login form inside an else
block after the chat page code. The code for the login form is shown in the next listing. It
should be placed immediately before the closing < /body > tag in index.php.
Listing 4.4. Display a login form
Try it out
You should now be able to see the login form by browsing to the index.php file on your
local server. It won't do anything yet, because you haven't created a PHP file to process the
logins. In order to get users logged in, you'll need a working add-session.php file.