Location: PHPKode > projects > Crown of Evanion > final/myegg.php
<?php
/*
*   This file is part of 'Crown of Evanion'.
*
*    'Crown of Evanion' is free software; you can redistribute it and/or modify
*    it under the terms of the GNU General Public License as published by
*    the Free Software Foundation; either version 2 of the License, or
*    (at your option) any later version.
*
*    'Crown of Evanion' is distributed in the hope that it will be useful,
*    but WITHOUT ANY WARRANTY; without even the implied warranty of
*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*    GNU General Public License for more details.
*
*    You should have received a copy of the GNU General Public License
*    along with 'Crown of Evanion'; if not, write to the Free Software
*    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/
$title = "My Egg";
include("include.php");

if($Username != "") {
	
	if($stage == 1) {
		echo "<div align=\"center\"><p class=\"drag\"><a href=$PHP_SELF>Overview</a> | <a href=$PHP_SELF?page=options>Play</a></p></div>";
		
		if(! $page) {
			echo "<div class=\"drag\">
			<div align=\"center\">
			<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0\" width=\"100\" height=\"100\" id=\"egg\" align=\"middle\">
			<param name=\"allowScriptAccess\" value=\"sameDomain\" />
			<param name=\"movie\" value=\"$DragImage\" />
			<param name=\"quality\" value=\"high\" />
			<param name=\"bgcolor\" value=\"#ffffff\" />
			<embed src=\"$DragImage\" quality=\"high\" bgcolor=\"#ffffff\" width=\"100\" height=\"100\" name=\"egg\" align=\"middle\" allowScriptAccess=\"sameDomain\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" />
			</object>
			</div>
			<p><strong>Name:</strong> $Dragon</p>
			<p><strong>Color:</strong> Unknown</p>
			<p><strong>Gender:</strong> $DragGen</p>
			<p><strong>Strength:</strong> $DragStren</p>
			<p><strong>Toughness:</strong> $DragTough</p>
			</div>";
		}
		
		if($page == "options") {
			echo "
			<UL id=\"ops\">
			While your Dragon, is still in its egg, you can do a few small things that might effect it once it hatches.
			<li><a href=$PHP_SELF?page=action&num=1>Shake Egg</a></li>
			<li><a href=$PHP_SELF?page=action&num=2>Rattle Egg</a></li>
			<li><a href=$PHP_SELF?page=action&num=3>Roll Egg</a></li>
			<li><a href=$PHP_SELF?page=action&num=4>Cuddle Egg</a></li>
			<li><a href=$PHP_SELF?page=action&num=5>Bash Egg</a></li>
			<li><a href=$PHP_SELF?page=action&num=6>Stroke Egg</a></li>
			</UL>
		";
		}
		
		if($page == "action" && $num <= 6) {
			$num = $_REQUEST['num'];
			
			$action = array(
			'1' => "UPDATE dragons SET tough = tough+1 WHERE name = '$Dragon'",
			'2' => "UPDATE dragons SET strength = strength+1 WHERE name = '$Dragon'",
			'3' => "UPDATE dragons SET hatch = hatch-320 WHERE name = '$Dragon'",
			'4' => "UPDATE dragons SET tough = tough+2 WHERE name = '$Dragon'",
			'5' => "UPDATE dragons SET strength = strength+2 WHERE name = '$Dragon'",
			'6' => "UPDATE dragons SET hatch = hatch-640 WHERE name = '$Dragon'",
			);
			
			$text = array(
			'1' => "You feel the egg shudder.",
			'2' => "The egg shines",
			'3' => "A strange breeze blows overhead.",
			'4' => "You feel the egg shake",
			'5' => "A wonderful glow emits from the egg.",
			'6' => "A small crack starts to appear.",
			);
			
			$yano = rand(1,150);
			if($yano == 47) {
				mysql_query("$action[$num]");
				echo "<p id=\"action\"><strong>$text[$num]</strong></p>";
			} else {
				echo "<p id=\"action\">Nothing happens.</p>";
			}
		}
	} else {
		echo "<div class=\"drag\"><h2>You have no egg!</h2></div>";
	}
} else {
	header("location: login.php");
}
include("footer.php");
?>
Return current item: Crown of Evanion