PHP and MySQL Web Development - P105

PHP and MySQL Web Development - P105: 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. | 492 Chapter 24 Building User Authentication and Personalization Listing This Script Ends a User Session php include function files for this application require_once session_start old_user HTTP_SESSION_VARS valid_user store to test if they were logged in unset HTTP_SESSION_VARS result_dest session_destroy start output html do_html_header Logging Out if empty old_user if result_dest if they were logged in and are now logged out echo Logged out. br do_html_url Login else they were logged in and could not be logged out echo Could not log you out. br else if they weren t logged in but came to this page somehow echo You were not logged in and so have not been logged out. br do_html_url Login do_html_footer Again you might find that this code looks familiar. That s because it is based on the code we wrote in Chapter 20. Changing Passwords If a user follows the Change Password menu option he will be presented with the form shown in Figure . Implementing User Authentication 493 Figure The script supplies a form where users can change their passwords. This form is generated by the script is a simple script that just uses the functions from the output library so we have not included the source for it here. When this form is submitted it triggers the script which is shown in Listing . Listing change This Script Attempts to Change a User Password php require_once session_start do_html_header Changing password create short variable names old_passwd HTTP_POST_VARS old_passwd new_passwd HTTP_POST_VARS new_passwd new_passwd2 HTTP_POST_VARS new_passwd2 check_valid_user if filled_out HTTP_POST_VARS echo You have not filled out the form completely. Please try again. 494 Chapter 24 Building User Authentication and Personalization Listing Continued display_user_menu do_html_footer exit else if new_passwd .

Không thể tạo bản xem trước, hãy bấm tải xuống
TỪ KHÓA LIÊN QUAN
TÀI LIỆU MỚI ĐĂNG
155    86    2    03-06-2024
Đã 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.