Tương tác giữa PHP và jQuery - part 21

CHAPTER 6 ■ PASSWORD PROTECTION SENSITIVE ACTIONS AND AREAS Please Log In Username Password " / or cancel Save this code and navigate to http://localhost/ in your browser to see the resulting login form (see Figure 6-2). Figure 6-2. The login form 201 CHAPTER 6 ■ PASSWORD PROTECTION SENSITIVE ACTIONS AND AREAS Creating the Admin Class With your table in place, you can | CHAPTER 6 PASSWORD PROTECTION SENSITIVE ACTIONS AND AREAS div id content form action assets inc method post fieldset legend Please Log In legend label for uname Username label input type text name uname id uname value label for pword Password label input type password name pword id pword value input type hidden name token value php echo _SESSION token input type hidden name action value user_login input type submit name login_submit value Log In or a href . cancel a fieldset form div -- end content -- php Output the footer include_once assets common Save this code and navigate to http localhost in your browser to see the resulting login form see Figure 6-2 . Figure 6-2. The login form 201 CHAPTER 6 PASSWORD PROTECTION SENSITIVE ACTIONS AND AREAS Creating the Admin Class With your table in place you can now start structuring the class that will interact with it. In the class folder create a new file called sys class . This class will contain methods to allow users to log in and log out. Defining the Class First you define the class which will extend DB_Connect in order to have database access. This class will have one private property _saltLength which you ll learn about a little later in this section. The constructor will call the parent constructor to ensure a database object exists and then it will check whether an integer was passed as the constructor s second argument. If so the integer is used as the value of _saltLength. Now insert the following code into to define the class the property and the constructor php Manages administrative actions PHP version 5 LICENSE This source file is subject to the MIT License available at http licenses @author Jason Lengstorf copyright 2010 Ennui Design @license http licenses class Admin extends DB Connect Determines the .

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
134    47    2    25-04-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.