Re: video#8
Posted: Sun Dec 11, 2011 3:57 am
show us the page in the browser, screenshot
Code: Select all
<?php
include_once 'Connect.php';
session_start();
?>
<div id="logo" div align="center">
<link rel="stylesheet" type="text/css" href="style1.css" />
<?php
include_once 'logo.php';
?>
</div>
<div id="style" div align="center">
<link rel="stylesheet" type="text/css" href="style1.css" />
</div>
<?php
if (isset($_SESSION['player']))
{
$player=$_SESSION['player'];
}
else
{
echo "Not Logged in <br><br> <A href='login.php'>Login</a>";
exit;
}
$playerinfo="SELECT * from players where name='$player'";
$playerinfo2=mysql_query($playerinfo) or die("could not get player stats!");
$playerinfo3=mysql_fetch_array($playerinfo2);
$playerhp = $playerinfo3['hitpoints'];
$playerattack = $playerinfo3['attack'];
$playerdefense = $playerinfo3['defense'];
////////////////new for video 7///////////////
if (isset($_GET['randid']))
{
$randid=$_GET['randid'];
$iteminfo="SELECT * from inventory where randid='$randid'";
$iteminfo2=mysql_query($iteminfo) or die("could not get item stats!");
$iteminfo3=mysql_fetch_array($iteminfo2);
if (!$iteminfo3['name'])
{
}
else
{
$name = $iteminfo3['name'];
$stats = $iteminfo3['stats'];
$statadd = $iteminfo3['statadd'];
$type = $iteminfo3['type'];
if ($type == "healing")
{
$newhp = $statadd + $playerhp;
if ($newhp > $playerinfo3['maxhp'])
{
$newhp = $playerinfo3['maxhp'];
}
$updateplayer="update players set hitpoints='$newhp' where name='$player'";
mysql_query($updateplayer) or die("Could not update player");
$updateitem="DELETE from inventory where name='$name' AND randid='$randid' limit 1";
mysql_query($updateitem) or die("Could not delete item");
$playerhp = $newhp;
echo "Used " . $name . " and recovered " . $statadd . ".<br>";
}
}}
////////////////////////////////
if (isset($_GET['creature']))
{
$creature=$_GET['creature'];
$creatureinfo="SELECT * from creatures where name = '$creature'";
$creatureinfo2=mysql_query($creatureinfo) or die("could not get the creature you were fighting!");
$creatureinfo3=mysql_fetch_array($creatureinfo2);
}
else
{
$creatureinfo="SELECT * from creatures order by rand() limit 1";
$creatureinfo2=mysql_query($creatureinfo) or die("could get a creature!");
$creatureinfo3=mysql_fetch_array($creatureinfo2);
}
$creature = $creatureinfo3['name'];
$creaturehp = $creatureinfo3['hitpoints'];
$creatureattack = $creatureinfo3['attack'];
$creaturedefense = $creatureinfo3['defense'];
?>
<div id="player" div align="center">
<link rel="stylesheet" type="text/css" href="style1.css" />
<?php
/////player info
echo "<u> " . $playerinfo3['name'] . "</u><br>";
echo "Hit points = " . $playerhp . "<br>";
echo "Attack = " . $playerattack . "<br>";
echo "Defense = " . $playerdefense . "<br><br><br>";
?>
</div>
<div id="creature" div align="center">
<link rel="stylesheet" type="text/css" href="style1.css" />
<?php
///////creature info
echo "<u> " . $creatureinfo3['name'] . "</u><br>";
echo "Hit points = " . $creaturehp . "<br>";
echo "Attack = " . $creatureattack . "<br>";
echo "Defense = " . $creaturedefense . "<br><br><br>";
echo "<a href='attack.php?creature=$creature'>Attack!";
?>
</div>
<div id="" div align="center">
<link rel="stylesheet" type="text/css" href="style1.css" />
<?php
echo "<br><a href='useitem.php?creature=$creature'>Use Item";
echo "<br><a href='store.php?creature=$creature'>Go to Store";
echo "<br><a href='playerprofile.php?creature=$creature'>Go to Profile";
?>
</div>
<div id="logout" div align="left">
<link rel="stylesheet" type="text/css" href="style1.css" />
<?php
echo "<br><a href='logout.php'><img src='logout.jpg'>";
?>
</div>
</div>
Code: Select all
<div id="login"><div align="center"><img src="Logo3.jpg" width="150" height="100" border="0"<div id="logo" div align="center">
<link rel="stylesheet" type="text/css" href="style1.css" />
</div>
<div id="player" div align="center">
<link rel="stylesheet" type="text/css" href="style1.css" />
<u> Urbanzkopf</u><br>Hit points = 19<br>Attack = 5<br>Defense = 5<br><br><br> </div>
<div id="creature" div align="center">
<link rel="stylesheet" type="text/css" href="style1.css" />
<u> orc</u><br>Hit points = 15<br>Attack = 6<br>Defense = 6<br><br><br><a href='attack.php?creature=orc'>Attack! </div>
<div id="name" div align="center">
<link rel="stylesheet" type="text/css" href="style1.css" />
</div>
<br><a href='useitem.php?creature=orc'>Use Item<br><a href='store.php?creature=orc'>Go to Store<br><a href='playerprofile.php?creature=orc'>Go to Profile
<div id="logout" div align="left">
<link rel="stylesheet" type="text/css" href="style1.css" />
<br><a href='logout.php'><img src='logout.jpg'>
Code: Select all
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>Sample HTML5 skeleton</title>
<link rel="stylesheet" type="text/css" media="screen" href="css/master.css" />
<script type="text/javascript" src="/libs/jquery/1.3.2/jquery.min.js"></script>
</head>
<body>
</body>
</html>
Code: Select all
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<meta name="author" content="some name" />
<title>Untitled 3</title>
</head>
<body>
</body>
</html>