Adding a Cauldron(max health& max spell points)
Posted: Thu Mar 04, 2010 3:56 am
this is the stuff you need to make a cauldron you can drink out of to fill your spell points and health
First open the file named heal.php in context replace everything in that with this
heal.php
Secondly go in you locations table and make names and greetings for all 3 locations with the Type healing(make sure its lowercase)
Thirdly go into index.php and add this line into the links
Replace The * below with the name you want
First open the file named heal.php in context replace everything in that with this
heal.php
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'];
$maxspoints=$playerinfo3['maxspoints'];
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 To use The Cauldron!";
echo "<center><a href='index.php'>Go Back</center>";
exit;
}
echo "<center>" . $exitgreet . "<br><br>";
echo "<A href='index.php'>Leave The Cauldron</a></center>";
$updateplayer="update players set spoints='$maxspoints', hpoints='$maxhp',gold=gold-'$price' where name='$player'";
mysql_query($updateplayer) or die("Could not update player");
exit;
}
else
{
$healinginfo="SELECT * from locations where location='$pllocation' AND type='healing'";
$healinginfo2=mysql_query($healinginfo) or die("could not get player stats!");
$healinginfo3=mysql_fetch_array($healinginfo2);
echo "<center>" . $healinginfo3['greeting'] . "<br>";
echo "The current price of this Cauldron is " . $healinginfo3['price'] . " Gold.<br><br>";
echo "Would you like a drink?<br></center>";
}
?>
<center>
<form method ="post" action="heal.php">
<input type="submit" value="Yes"><br /><br />
<input type="hidden" name="price" value="<?php echo $healinginfo3['price'];?>" />
<input type="hidden" name="exitgreet" value="<?php echo $healinginfo3['exitgreet'];?>" />
</form>
<form action="index.php">
<input type="submit" value="No">
</form></center>
</div>Thirdly go into index.php and add this line into the links
Replace The * below with the name you want
Code: Select all
echo "<a href='heal.php'>*</a><br>";