Specifications

LISTING 24.21 add_bms.phpThis Script Adds New Bookmarks to a Users
Personal Page
<?
require_once(“bookmark_fns.php”);
session_start();
do_html_header(“Adding bookmarks”);
check_valid_user();
if (!filled_out($HTTP_POST_VARS))
{
echo “You have not filled out the form completely.
Please try again.”;
display_user_menu();
do_html_footer();
exit;
}
else
{
// check URL format
if (strstr($new_url, “http://”)===false)
$new_url = “http://”.$new_url;
// check URL is valid
if (@fopen($new_url, “r”))
{
// try to add bm
if (add_bm($new_url))
echo “Bookmark added.”;
else
echo “Could not add bookmark.”;
}
else
echo “Not a valid URL.”;
}
// get the bookmarks this user has saved
if ($url_array = get_user_urls($valid_user));
display_user_urls($url_array);
display_user_menu();
do_html_footer();
?>
Building User Authentication and Personalization
C
HAPTER 24
24
AUTHENTICATION
AND
PERSONALIZATION
527
30 7842 ch24 3/6/01 3:34 PM Page 527