<?php

// phpinfo();

// die();

if (!$action) {

// logging in

display_screen_1("Room 1", "Welcome to Room 1!");

die();

}

else {

if ($action == "Go to room 1") {

display_screen_1("Room 1", "Welcome Back to Room 1!");

die();

}

if ($action == "Go to room 2") {

display_screen_2("Room 2", "Now in Room 2");

die();

}

if ($action == "Go to room 3") {

display_screen_3("Room 3", "Now in Room 3");

die();

}

if ($action == "Go to room 4") {

display_screen_4("Room 4", "Now in Room 4");

die();

}

if ($action == "Go to room 5") {

display_screen_5("Room 5", "Now in Room 5");

die();

}

die ();

}

echo "<html>\n";

echo "<head>\n";

echo "<title>Trouble!</title>\n";

echo "</head>\n";

echo "<body bgcolor=\"white\">\n";

echo "<font face=\"Arial\">\n";

echo "\$action = $action\n";

echo "</body>\n";

echo "</html>\n";

die();

function display_screen_1 ($title, $message) {

echo "<html>\n";

echo "<head>\n";

echo "<title>$title</title>\n";

echo "</head>\n";

echo "<body bgcolor=\"white\">\n";

echo "<font face=\"Arial\">\n";

echo "<p>\n";

echo "<center><h1>$message</h1></center>\n<p>&nbsp;</p>\n";

echo "\$fame =" . $_POST["fame"] . "<br>\n";

echo "\$wealth =" . $_POST["wealth"] . "<br>\n";

echo "\$happiness =" . $_POST["happiness"] . "<br>\n";

echo "<form method=\"POST\" ACTION=\"careers.php\">\n";

?>

<pre>

Pseudo code for room 1 goes here....

</pre>

<?php

if (!$action) {

echo "<input name=\"fame\" type=\"hidden\" value=\"10\">\n";

echo "<input name=\"wealth\" type=\"hidden\" value=\"20\">\n";

echo "<input name=\"happiness\" type=\"hidden\" value=\"30\">\n";

}

else {

if ($_POST["fame"]) {

echo

"<input name=\"fame\" type=\"hidden\" value=\"" . $_POST["fame"] . "\">\n";

}

if ($_POST["wealth"]) {

echo

"<input name=\"wealth\" type=\"hidden\" value=\"" . $_POST["wealth"] . "\">\n";

}

if ($_POST["happiness"]) {

echo

"<input name=\"happiness\" type=\"hidden\" value=\"" . $_POST["happiness"] . "\">\n";

}

}

echo "<p><input NAME=\"action\" TYPE=\"submit\" VALUE=\"Go to room 2\">\n";

echo "<p><input NAME=\"action\" TYPE=\"submit\" VALUE=\"Go to room 3\">\n";

echo "<p><input NAME=\"action\" TYPE=\"submit\" VALUE=\"Go to room 4\">\n";

echo "</form>\n";

echo "</body>\n";

echo "</html>\n";

}

function display_screen_2 ($title, $message) {

echo "<html>\n";

echo "<head>\n";

echo "<title>$title</title>\n";

echo "</head>\n";

echo "<body bgcolor=\"white\">\n";

echo "<font face=\"Arial\">\n";

echo "\$fame =" . $_POST["fame"] . "<br>\n";

echo "\$wealth =" . $_POST["wealth"] . "<br>\n";

echo "\$happiness =" . $_POST["happiness"] . "<br>\n";

echo "<p>\n";

echo "<center><h1>$message</h1></center>\n<p>&nbsp;</p>\n";

echo "<form method=\"POST\" ACTION=\"careers.php\">\n";

?>

<pre>

Pseudo code for room 2 goes here....

</pre>

<?php

if ($_POST["fame"]) { echo

"<input name=\"fame\" type=\"hidden\" value=\"" . $_POST["fame"] . "\">\n";

}

if ($_POST["wealth"]) { echo

"<input name=\"wealth\" type=\"hidden\" value=\"" . $_POST["wealth"] . "\">\n";

}

if ($_POST["happiness"]) { echo

"<input name=\"happiness\" type=\"hidden\" value=\"" . $_POST["happiness"] . "\">\n";

}

echo "<p><input NAME=\"action\" TYPE=\"submit\" VALUE=\"Go to room 1\">\n";

echo "<p><input NAME=\"action\" TYPE=\"submit\" VALUE=\"Go to room 3\">\n";

echo "<p><input NAME=\"action\" TYPE=\"submit\" VALUE=\"Go to room 5\">\n";

echo "</form>\n";

echo "</body>\n";

echo "</html>\n";

}

function display_screen_3 ($title, $message) {

echo "<html>\n";

echo "<head>\n";

echo "<title>$title</title>\n";

echo "</head>\n";

echo "<body bgcolor=\"white\">\n";

echo "<font face=\"Arial\">\n";

echo "\$fame =" . $_POST["fame"] . "<br>\n";

echo "\$wealth =" . $_POST["wealth"] . "<br>\n";

echo "\$happiness =" . $_POST["happiness"] . "<br>\n";

echo "<p>\n";

echo "<center><h1>$message</h1></center>\n<p>&nbsp;</p>\n";

echo "<form method=\"POST\" ACTION=\"careers.php\">\n";

?>

<pre>

Pseudo code for room 3 goes here....

</pre>

<?php

 

if ($_POST["fame"]) { echo

"<input name=\"fame\" type=\"hidden\" value=\"" . $_POST["fame"] . "\">\n";

}

if ($_POST["wealth"]) { echo

"<input name=\"wealth\" type=\"hidden\" value=\"" . $_POST["wealth"] . "\">\n";

}

if ($_POST["happiness"]) { echo

"<input name=\"happiness\" type=\"hidden\" value=\"" . $_POST["happiness"] . "\">\n";

}

echo "<p><input NAME=\"action\" TYPE=\"submit\" VALUE=\"Go to room 1\">\n";

echo "<p><input NAME=\"action\" TYPE=\"submit\" VALUE=\"Go to room 2\">\n";

echo "</form>\n";

echo "</body>\n";

echo "</html>\n";

}

function display_screen_4 ($title, $message) {

echo "<html>\n";

echo "<head>\n";

echo "<title>$title</title>\n";

echo "</head>\n";

echo "<body bgcolor=\"white\">\n";

echo "<font face=\"Arial\">\n";

echo "\$fame =" . $_POST["fame"] . "<br>\n";

echo "\$wealth =" . $_POST["wealth"] . "<br>\n";

echo "\$happiness =" . $_POST["happiness"] . "<br>\n";

echo "<p>\n";

echo "<center><h1>$message</h1></center>\n<p>&nbsp;</p>\n";

echo "<form method=\"POST\" ACTION=\"careers.php\">\n";

?>

<pre>

Pseudo code for room 4 goes here....

</pre>

<?php

if ($_POST["fame"]) { echo

"<input name=\"fame\" type=\"hidden\" value=\"" . $_POST["fame"] . "\">\n";

}

if ($_POST["wealth"]) { echo

"<input name=\"wealth\" type=\"hidden\" value=\"" . $_POST["wealth"] . "\">\n";

}

if ($_POST["happiness"]) { echo

"<input name=\"happiness\" type=\"hidden\" value=\"" . $_POST["happiness"] . "\">\n";

}

echo "<p><input NAME=\"action\" TYPE=\"submit\" VALUE=\"Go to room 1\">\n";

echo "</form>\n";

echo "</body>\n";

echo "</html>\n";

}

function display_screen_5 ($title, $message) {

echo "<html>\n";

echo "<head>\n";

echo "<title>$title</title>\n";

echo "</head>\n";

echo "<body bgcolor=\"white\">\n";

echo "<font face=\"Arial\">\n";

echo "\$fame =" . $_POST["fame"] . "<br>\n";

echo "\$wealth =" . $_POST["wealth"] . "<br>\n";

echo "\$happiness =" . $_POST["happiness"] . "<br>\n";

echo "<p>\n";

echo "<center><h1>$message</h1></center>\n<p>&nbsp;</p>\n";

echo "<form method=\"POST\" ACTION=\"careers.php\">\n";

?>

<pre>

Pseudo code for room 5 goes here....

</pre>

<?php

if ($_POST["fame"]) { echo

"<input name=\"fame\" type=\"hidden\" value=\"" . $_POST["fame"] . "\">\n";

}

if ($_POST["wealth"]) { echo

"<input name=\"wealth\" type=\"hidden\" value=\"" . $_POST["wealth"] . "\">\n";

}

if ($_POST["happiness"]) { echo

"<input name=\"happiness\" type=\"hidden\" value=\"" . $_POST["happiness"] . "\">\n";

}

echo "<p><input NAME=\"action\" TYPE=\"submit\" VALUE=\"Go to room 2\">\n";

echo "</form>\n";

echo "</body>\n";

echo "</html>\n";

}

 

?>