inn.php fixed error
Posted: Sun Mar 13, 2011 9:03 pm
				
				Hey there everybody,
Just a heads up, unless something went wrong with my script, halls only included healing hpoints in his inn.php (nothing against you halls, i wouldn't have figured this out without you)
so, if you want your inn.php to heal the player's spoints as well, here is the updated source code, a few very simple additions to the script:
inn.php
Please let me know if this helped!
			Just a heads up, unless something went wrong with my script, halls only included healing hpoints in his inn.php (nothing against you halls, i wouldn't have figured this out without you)
so, if you want your inn.php to heal the player's spoints as well, here is the updated source code, a few very simple additions to the script:
inn.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'];
$maxsp = $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 stay at this inn!";
  echo "<center><a href='index.php'>Go Back</center>";
  exit;
}
echo "<center>" . $exitgreet . "<br><br>";
echo "<A href='index.php'>Leave Inn</a></center>";
$updateplayerhp="update players set hpoints='$maxhp' where name='$player'";
 mysql_query($updateplayerhp) or die("Could not update player");
$updateplayersp="update players set spoints='$maxsp' where name='$player'";
 mysql_query($updateplayersp) or die("Could not update player again");
exit;
}
else
{
 $inninfo="SELECT * from locations where location='$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>";
 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>
