876Part VCase StudiesWe now take a tour of (Web hosting servers)
876Part VCase StudiesWe now take a tour of the code file listings. Rather than building from the ground up as wesometimes do, in this chapter we work from the top down: first the very first page that isactually loaded, then the code that page depends on, and so on until we bottom out in utilityfunctions and database calls. Finally, at the end of the chapter, we show how to construct thedatabase and populate it with questions. index.phpListing 46-1 shows index.php, which is the user s entry point. The primary job of this file isto determine where we are in the cycle of play, set up the appropriate PHP objects (either bycreating them or by retrieving them from the user s session), and echo out the display codethat the objects generate. Where we are in the course of a game is determined by a combination of session and POSTinformation; as users arrive for the first time, they find neither a current session nor anyPOST arguments. Successive pages, however, should have both an active session and usefulinformation submitted from the previous page. Listing 46-1:index.phphandleHighScore(); } } // CASE 2: Player is in middle of game that we are trackingelseif (get_session_value( game ) && !get_post_value( NEW )) { $lower = get_post_value( lower ); $upper = get_post_value( upper ); $game_display = new GameDisplay(get_session_value( game ));
We highly recommend you visit web and email hosting services if you need stable and cheap web hosting platform for your web applications.