Đang chuẩn bị liên kết để tải về tài liệu:
PHP and MySQL Web Development - P107

Không đóng trình duyệt đến khi xuất hiện nút TẢI XUỐNG

PHP and MySQL Web Development - P107: PHP and MySQL Web Development teaches the reader to develop dynamic, secure, commercial Web sites. Using the same accessible, popular teaching style of the first edition, this best-selling book has been updated to reflect the rapidly changing landscape of MySQL and PHP. | 502 Chapter 24 Building User Authentication and Personalization Note that fopen will only be able to open files if your server has direct access to the Internet. If it needs to access other HTTP servers via a proxy server fopen will not work. This function and the others relating to bookmarks are all in the function library url_fns.php.You can see the code for the add_bm function in Listing 24.22. Listing 24.22 The add_bm function from url_fns.php This Function Adds New Bookmarks to the Database function add_bm new_url Add new bookmark to the database echo Attempting to add .htmlspecialchars new_url . br global HTTP_SESSION_VARS valid_user HTTP_SESSION_VARS valid_user if conn db_connect return false check not a repeat bookmark result mysql_query select from bookmark where username valid_user and bm_URL new_url if result mysql_num_rows result 0 return false insert the new bookmark if mysql_query insert into bookmark values valid_user new_url return false return true This function is fairly simple. It checks that a user does not already have this bookmark listed in the database. Although it is unlikely that users would enter a bookmark twice it is possible and even likely that they might refresh the page. If the bookmark is new then it is entered into the database. Looking back at add_bm.php you can see that the last thing it does is call get_user_urls and display_user_urls the same as member.php.We ll move on and look at these functions next. Displaying Bookmarks In the member.php script and the add_bm function we used the functions get_user_urls and display_user_urls .These functions get the user s bookmarks Implementing Bookmark Storage and Retrieval 503 from the database and display them respectively.The get_user_urls function is in the url_fns.php library and the display_user_urls function is in the output_fns.php library. The get_user_urls function is shown in Listing 24.23. Listing 24.23 The get_user_urls Function from url_fns.php This Function Retrieves a .

Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.