only for RuBoard - do not distribute or recompile Previous Section Next Section

Solution Overview

After some doodling on napkins, we came up with the system flowchart shown in Figure 24.1.

Figure 24.1. This diagram shows the possible paths through the PHPBookmark system.
graphics/24fig01.gif

We'll build a module for each box on this diagram—some will need one script and others, two. We'll also set up function libraries for

We'll also need to build a back-end database for the system.

We'll go through the solution in some detail, but all of the code for this application can be found on the CD-ROM in the chapter24 directory. A summary of included files is shown in Table 24.1.

Table 24.1. Files in the PHPBookmark Application
Filename Description
bookmarks.sql SQL statements to create the PHPBookmark database
login.php Front page with login form for system
register_form.php Form for users to register in the system
register_new.php Script to process new registrations
forgot_form.php Form for users to fill out if they've forgotten their passwords
forgot_passwd.php Script to reset forgotten passwords
member.php A user's main page, with a view of all his current bookmarks
add_bm_form.php Form for adding new bookmarks
add_bms.php Script to actually add new bookmarks to the database
delete_bms.php Script to delete selected bookmarks from the user's list
recommend.php Script to suggest recommendations to a user, based on users with similar interests
change_passwd_form.php Form for members to fill out if they want to change their passwords
change_passwd.php Script to change the user's password in the database
logout.php Script to log a user out of the application
bookmark_fns.php A collection of includes for the application
data_valid_fns.php Functions to validate user-input data
db_fns.php Functions to connect to the database
user_auth_fns.php Functions for user authentication
url_fns.php Functions for adding and deleting bookmarks and for making recommendations
output_fns.php Functions that format output as HTML
bookmark.gif Logo for PHPBookmark

We will begin by implementing the MySQL database for this application as it will be required for virtually all the other functionality to work.

Then we will work through the code in the order it was written, starting from the front page, going through the user authentication, to bookmark storage and retrieval, and finally to recommendations. This order is fairly logical—it's just a question of working out the dependencies and building first the things that will be required for later modules.

Note

For the code in this project to work as written, you will need to have switched on magic quotes. If you have not done this, then you will need to addslashes() to data being inserted to the MySQL database, and stripslashes() from data retrieved from the database. We have used this as a useful shortcut.



only for RuBoard - do not distribute or recompile Previous Section Next Section