File này là một tập tin nhỏ nhưng cần thiết tuy nhiên để cung cấp cho các dự án một trang chủ. Tất cả nó là hiển thị một thông điệp đơn giản chào đón. Trong một ứng dụng hoàn thành, đây sẽ là nơi bạn bán các ưu điểm của trang web của bạn để khuyến khích các lần đăng ký. | Example 20-3. php include_once echo h3 Setting up h3 createTable rnmembers user VARCHAR 16 pass VARCHAR 16 INDEX user 6 createTable rnmessages id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY auth VARCHAR 16 recip VARCHAR 16 pm CHAR 1 time INT UNSIGNED message VARCHAr 4096 INDEX auth 6 INDEX recip 6 createTable rnfriends user VARCHAR 16 friend VARCHAR 16 INDEX user 6 INDEX friend 6 createTable rnprofiles user VARCHAR 16 text VARCHAR 4O96 INDEX user 6 This file is a trivial file but necessary nonetheless to give the project a home page. All it does is display a simple welcome message. In a finished application this would be where you sell the virtues of your site to encourage signups. Incidentally seeing as all the MySQL tables have been created and the include files saved you can now load Example 20-4 into your browser to get your first peek at the new application. It should look like Figure 20-1. Figure 20-1. The main page of the site 411 Example 20-4. php include_once echo h3 Home page h3 Welcome please Sign up and or Log in to join in. Now we need a module to enable users to join the new network and that s Example 20-5 . This is a slightly longer program but you ve seen all its parts before. Let s start by looking at the end block of HTML. This is a simple form that allows a username and password to be entered. But note the use of the empty span given the id of info . This will be the destination of the Ajax call in this program that checks whether a desired username is available. See Chapter 18 for a complete description of how this works. Checking for Username Availability Now go back to the program start and you ll see a block of JavaScript that starts with the function checkuser. This is called by the JavaScript onBlur event when focus is removed from the username field of the form. First it sets the contents of the span I mentioned with