Re: Video#16
Posted: Tue Dec 08, 2009 9:52 pm
you should add a thing for the arena in a tutorial to fix this random creature thing because I was level 3 and I went against my level 17 minotaur.....
Code: Select all
<?php
include_once 'connect.php';
session_start();
include_once 'logo.php';
?>
<link href="style.css" rel="stylesheet" type="text/css" />
<?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);
$pllocation=$playerinfo3['location'];
$maxhp = $playerinfo3['maxhp'];
include_once 'statpanel.php';
?>
</div>
<div id="table">
<?php
if (isset($_POST['price']))
{
$price = $_POST['price'];
$exitgreet = $_POST ['exitgreet'];
if ($playerinfo3['gold'] < $price)
{
echo "You do not have enough Gold to stay at this Inn!";
echo "<center><a href='index.php'>Go back</a></center>";
exit;
}
echo "<center>" . $exitgreet . "<br /><br />";
echo "<A href='index.php'>Leave Inn</a></center>";
$updateplayer="update players set hpoints='$maxhp',gold=gold-'$price' where name='$player'";
mysql_query($updateplayer) or die("Could not update player");
exit;
}
else
{
$inninfo="SELECT * from locations where name='$pllocation' AND type='inn'";
$inninfo2=mysql_query($inninfo) or die("Could not get player stats!");
$inninfo3=mysql_fetch_array($inninfo2);
echo "<center>" . $inninfo3['greeting'] . " <br /><br />";
echo "The current price of this Inn is" . $inninfo3['price'] . " Gold<br /><br />";
echo "Would you like to stay?<br /></center>";
}
?>
<center>
<form method="post" action="inn.php">
<input type="submit" value="Yes"><br /><br />
<input type="hidden" name="price" value="<?php echo $inninfo3['price'];?>" />
<input type="hidden" name="exitgreet" value="<?php echo $inninfo3['exitgreet'];?>" />
</form>
<form action="index.php">
<input type="submit" value="No">
</form></center>
</div>