TAILIEUCHUNG - PHP and MySQL Web Development - P126

PHP and MySQL Web Development - P126: 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. | Logging In and Out 597 Logging In and Out When a user loads the page he will see the output shown in Figure . Figure The login screen for Warm Mail asks for your username and password. This is the default behavior for the no action chosen yet and no login details supplied we will execute the following parts of the code. In the preprocessing stage we first execute the following code include session_start These lines start the session that will be used to keep track of the auth_user and selected_account session variables which we ll come to later on. As in our other applications we create short variable have done this in every form related script since chapter one so it barely needs mention except for the variable action. Depending on where in the application this comes from it might be either a GET or POST test for the existence of HTTP_POST_VARS action and if it is not set we use the GET relevant code is these four lines if isset HTTP_POST_VARS action action HTTP_POST_VARS action else action HTTP_GET_VARS action 598 Chapter 27 Building a Web-Based Email Service We have to do the same thing with the account variable as it is usually accessed via GET but is accessed via POST when deleting an account. If you are using PHP or newer you can avoid these issues by accessing the form variables via the _REQUEST superglobal. We have not used it here for backward compatibility. To save work when customizing the user interface the buttons that appear on the toolbar are controlled by an array. We declare an empty array buttons array and set the buttons that we want on the page buttons 0 view-mailbox buttons 1 new-message buttons 2 account-setup For the header stage we print a plain vanilla header do_html_header HTTP_SESSION_VARS auth_user Warm Mail HTTP_SESSION_VARS selected_account display_toolbar buttons This code prints the title and header bar and then the toolbar of buttons you can see

TỪ KHÓA LIÊN QUAN
Đã 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.