Specifications

FIGURE 24.3
The front page of the PHPBookmark system is produced by the HTML rendering functions in login.php.
As you can see, this file is just a container for the five other include files we will use in this
application. We have structured it like this because the functions fall into logical groups. Some
of these groups might be useful for other projects, so we put each function group into a differ-
ent file where we will know where to find them when we want them again. We constructed the
bookmark_fns.php file because we will use most of the five function files in most of our
scripts. It is easier to include this one file in each script rather than having five include state-
ments.
Note that the require_once() construct only exists in PHP from version 4.0.1pl2. If you are
using a prior version, you will need to use
require() or include() and ensure that the files do
not get loaded multiple times.
In this particular case, we are using functions from the file
output_fns.php. These are all
straightforward functions that output fairly plain HTML. This file includes the four functions
we have used in login.php, that is, do_html_header(), display_site_info(),
display_login_form(), and do_html_footer(), among others.
We will not go through all these functions in detail, but we will look at one as an example. The
code for do_html_header() is shown in Listing 24.4.
Building User Authentication and Personalization
C
HAPTER 24
24
AUTHENTICATION
AND
PERSONALIZATION
505
30 7842 ch24 3/6/01 3:34 PM Page 505