Practical PHP and MySQLBuilding Eight Dynamic Web Applications phần 9

Hai thông số cuối cùng là cả hai tùy chọn. Thứ tư có thể được sử dụng để xác định thông tin quy tắc bổ sung (điều này là không cần thiết ở đây, để vô giá trị được quy định cụ thể), và thứ năm cho biết các khách hàng hoặc máy chủ nên xử lý hình thức. | CHAPTER 10 Building a Re-Usable Project 403 break case screenshots if _POST include_header menu_options require break Add the delete screenshots block break case deletescreenshot if isset _GET conf FALSE include_header menu_options require break If no legitimate setting was passed to the func GET variable the default block is entered. This code asks the user which project she would like to administer. When a user has selected a project the SESS_PROJECTID and SESS_PROJECTPATH session variables are created. These variables track the project in which the user is interested. First check to see if SESS_PROJECTID is already set and a project already chosen break default if _SESSION SESS_PROJECTID header Location . config_projectadminbasedir . basename SCRIPT_NAME . func main If the variable exists the page simply redirects to the main block. If the variable does not exist ask the user to choose a project header Location . config_projectadminbasedir . basename SCRIPT_NAME . func main else include_header echo h1 Choose a project h1 echo p Which project would you like to administer p 404 Practical PHP and MySQL projsql SELECT FROM homeproject_projects projresult mysql_query projsql projnumrows mysql_num_rows projresult Here you perform a query to gather the available projects. Check if any rows were returned projnumrows mysql_num_rows projresult if projnumrows 0 echo p No projects p If no rows are returned there are no projects on the system. If projects exist display them to the user echo p No projects p else echo ul while projrow mysql_fetch_assoc projresult echo li a href . SCRIPT_NaMe . func setproject id . projrow id . . projrow name . a li echo ul Each project links to the setproject block and passes the id of project as the id GET variable. If the user wants to create a new project add a link to do so echo ul echo a href . SCRIPT_NAME . func newproject Create a new project a break Add the setproject .

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
Đã 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.