Nedanstående filer finns i denna katalogen. Klicka på en fil för att visa dess innehåll.
hangman/
CHangmanSVG.php PHangman.php PHangmanTemplate.php PListDirectory.php common.php favicon.ico hangman.svg
<?php // =========================================================================================== // // Hangman.php // // Description: Play the classic game of hangman. // // Author: Mikael Roos // // ------------------------------------------------------------------------------------------- // // Error handling on/off // // ------------------------------------------------------------------------------------------- // // Take care of GET variables // // ------------------------------------------------------------------------------------------- // // Create a wordlist and pick the word. // // ------------------------------------------------------------------------------------------- // // Show the string and the chars that are correct, else _ // // ------------------------------------------------------------------------------------------- // // Check state of game: // count number of failed attempts // // ------------------------------------------------------------------------------------------- // // Check state of game: // if all chars are right, then success! // // ------------------------------------------------------------------------------------------- // // Check state of game: // if failed nine times, then hanged, game over. // // ------------------------------------------------------------------------------------------- // // Create a form for managing input. // // ------------------------------------------------------------------------------------------- // // Create html for drawing the hanging man. // // ------------------------------------------------------------------------------------------- // // Create and print out the html-page // require_once('common.php'); $charset = "iso-8859-1"; $language = "sv"; $title = "H�nga Gubben"; $debug = $debugEnable ? $debug : ""; $html = <<< EOD <?xml version="1.0" encoding="{$charset}" ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="{$language}" lang="{$language}"> <head> <meta http-equiv="Content-Type" content="text/html; charset={$charset};" /> <title>{$title}</title> </head> <body> {$header} <h1>Titel</h1> <p>N�gon inledande text kanske.</p> <fieldset> <div style='float: left'> {$form} </div> <div style='float: right'> {$svgCode} </div> </fieldset> <div style='font-size: small;'> {$debug} </div> {$footer} </body> </html> EOD; header("Content-Type: application/xhtml+xml; charset={$charset}"); echo $html; exit; ?>
. ..: © Mikael Roos, 2009