Re: Video #20
Posted: Wed May 25, 2011 1:49 pm
That's fine but it still does what my original problem was.
http://www.otenba-files.com/images/error.jpg
http://www.otenba-files.com/images/error.jpg
Code: Select all
if(isset($_GET['map']))
{
$bypass=1;
echo "<a href='index.php?mapchange=1&mapname=Crocania'>Crocania</a><br>";
echo "<a href='index.php?mapchange=1&mapname=Fordale Woods'>Fordale Woods</a><br>";
echo "<a href='index.php?mapchange=1&mapname=Mintus Mountains'>Mintus Mountains</a><br>";
}
Code: Select all
if($bypass == 0)
{
echo "<b><big><u>" . $playerinfo3['location'] . "</u></big></b><br>";
echo "<a href='store.php'>Visit Store</a><br>";
echo "<a href='weaponshop.php'>Visit Weapon Shop</a><br>";
echo "<a href='armorshop.php'>Visit Armor Shop</a><br>";
echo "<a href='inn.php'>Visit Inn</a><br>";
echo "<a href='spelltrainer.php'>Visit Spell Trainer</a><br>";
echo "<a href='battle.php'>Battle in Arena</a><br>";
echo "<a href='index.php?map=1'>Go to Map</a><br>";
}
Code: Select all
<?php
$bypass=0;
$playerhp = $playerinfo3['hpoints'];
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);
$bypass = 0;
include_once 'statpanel.php';
?>
</div>
<div id="table">
<?php
$pllocation=$playerinfo3['location'];
$inninfo="SELECT * from locations where location='$pllocation' AND type='weaponshop'";
$inninfo2=mysql_query($inninfo) or die("could not get player stats!");
$inninfo3=mysql_fetch_array($inninfo2);
$shoplevel = $inninfo3['level'];
if (isset($_GET['bought']))
{
$bypass = 1;
$id=$_GET['id'];
$playerid = $playerinfo3['id'];
$class = $playerinfo3['pclass'];
$level = $playerinfo3['level'];
$iteminfo="SELECT * from weapons where id='$id'";
$iteminfo2=mysql_query($iteminfo) or die("could not get item stats!");
$iteminfo3=mysql_fetch_array($iteminfo2);
if ($playerinfo3['gold'] < $iteminfo3['price'])
{
echo "You do not have enough Gold for this purchase!";
echo "<center><a href='index.php'>Go Back</center>";
exit;
}
if ($playerinfo3['pclass'] != $iteminfo3['class'] && $iteminfo3['class'] != "any")
{
echo "You are not the right class for this item!";
echo "<center><a href='index.php'>Go Back</center>";
exit;
}
if ($playerinfo3['level'] < $iteminfo3['level'])
{
echo "You are not high enough level to use this item!";
echo "<center><a href='index.php'>Go Back</center>";
exit;
}
$name = $iteminfo3['name'];
$rating = $iteminfo3['rating'];
$wlevel = $iteminfo3['level'];
$hittext = $iteminfo3['hittext'];
$damage = $iteminfo3['damage'];
$randid = rand(1000,999999999);
$percentage = $iteminfo3['price'] / 100;
$price = $iteminfo3['price'] * $percentage;
$newprice = $price + $iteminfo3['price'];
$newprice = (int)$newprice;
$itembought = "INSERT into playerweapons(pid, name, rating, level, randid,price,class,hittext,damage) VALUES ('$playerid','$name','$rating','$wlevel','$randid','$newprice','$class','$hittext','$damage')";
mysql_query($itembought) or die("could not insert weapon into backpack");
$updateplayer="update players set gold=gold-'$newprice' where name='$player'";
mysql_query($updateplayer) or die("Could not update player");
echo $name . " Purchased<br>";
echo $inninfo3['exitgreet'] . "<br>";
echo "<a href='index.php'>Go Back</center>";
}
if ($bypass != 1)
{
$counter = 0;
$class = $playerinfo3['pclass'];
$level = $playerinfo3['level'];
echo "<center>" . $inninfo3['greeting'] . "<br>";
echo "<small>";
print "<center>";
print "<table border='0' width='70%' cellspacing='20'>";
print "<tr><td width='25%' valign='top'>";
print "</td>";
print "<td valign='top' width='75%'>";
$invinfo="SELECT * from weapons where class = '$class' AND level <= '$level' AND level <= '$shoplevel' || class='any'";
$invinfo2=mysql_query($invinfo) or die("could not select anything from the store.");
print "<table border='1' bordercolor='white' bgcolor='#ffffff'>";
print "<tr><td>Name<font color='ffffff'>________________</td><td>Rating<font color='ffffff'>______</td><td>Price<font color='ffffff'>______</td><td><font color='ffffff'>________________</td></tr>";
while($invinfo3=mysql_fetch_array($invinfo2))
{
$counter = 1;
$percentage = $inninfo3['price'] / 100;
$price = $invinfo3['price'] * $percentage;
$newprice = $price + $invinfo3['price'];
$newprice = (int)$newprice;
print "<tr><td>$invinfo3[name]</td><td>$invinfo3[rating]</td><td>$newprice</td><td><A href='weaponshop.php?id=$invinfo3[id]&bought=1'>Buy Weapon</td></tr>";
}
print "</table>";
print "</td></tr></table>";
print "</center>";
echo "</small>";
if ($counter == 0)
{
echo "<center>There is nothing in the store at this time.<br>";
echo "<a href='index.php'>Go Back</center>";
exit;
}
echo "<center><a href='index.php'>NeverMind</center></a>";
}
?>
</div>
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);
$bypass = 0;
include_once 'statpanel.php';
?>
</div>
<div id="table">
<?php
$counter = 0;
$class = $playerinfo3['pclass'];
$level = $playerinfo3['level'];
$pllocation=$playerinfo3['location'];
$inninfo="SELECT * from locations where location='$pllocation' AND type='armorshop'";
$inninfo2=mysql_query($inninfo) or die("could not get player stats!");
$inninfo3=mysql_fetch_array($inninfo2);
$shoplevel = $inninfo3['level'];
if (isset($_GET['bought']))
{
$bypass = 1;
$id=$_GET['id'];
$playerid = $playerinfo3['id'];
$class = $playerinfo3['pclass'];
$level = $playerinfo3['level'];
$iteminfo="SELECT * from armor where id='$id'";
$iteminfo2=mysql_query($iteminfo) or die("could not get item stats!");
$iteminfo3=mysql_fetch_array($iteminfo2);
if ($playerinfo3['gold'] < $iteminfo3['price'])
{
echo "You do not have enough Gold for this purchase!";
echo "<center><a href='index.php'>Go Back</center>";
exit;
}
if ($playerinfo3['pclass'] != $iteminfo3['class'] && $iteminfo3['class'] != "any")
{
echo "You are not the right class for this item!";
echo "<center><a href='index.php'>Go Back</center>";
exit;
}
if ($playerinfo3['level'] < $iteminfo3['level'])
{
echo "You are not high enough level to use this item!";
echo "<center><a href='index.php'>Go Back</center>";
exit;
}
$name = $iteminfo3['name'];
$rating = $iteminfo3['rating'];
$wlevel = $iteminfo3['level'];
$location = $iteminfo3['location'];
$randid = rand(1000,999999999);
$percentage = $iteminfo3['price'] / 100;
$price = $iteminfo3['price'] * $percentage;
$newprice = $price + $iteminfo3['price'];
$newprice = (int)$newprice;
$itembought = "INSERT into playerarmor(pid, name, rating, level, randid,price,class,location) VALUES ('$playerid','$name','$rating','$wlevel','$randid','$newprice','$class','$location')";
mysql_query($itembought) or die("could not insert weapon into backpack");
$updateplayer="update players set gold=gold-'$newprice' where name='$player'";
mysql_query($updateplayer) or die("Could not update player");
echo $name . " Purchased";
echo $inninfo3['exitgreet'] . "<br>";
echo "<a href='index.php'>Go Back</center>";
}
if ($bypass != 1)
{
echo "<center>" . $inninfo3['greeting'] . "<br>";
echo "<small>";
print "<center>";
print "<table border='0' width='70%' cellspacing='20'>";
print "<tr><td width='25%' valign='top'>";
print "</td>";
print "<td valign='top' width='75%'>";
$invinfo="SELECT * from armor where class = '$class' AND level <= '$level' AND level <= '$shoplevel' || class='any'";
$invinfo2=mysql_query($invinfo) or die("could not select anything from the store.");
print "<table border='1' bordercolor='white' bgcolor='#ffffff'>";
print "<tr><td>Name<font color='ffffff'>________________</td><td>Rating<font color='ffffff'>______</td><td>Location<font color='ffffff'>______</td><td>Price<font color='ffffff'>______</td><td><font color='ffffff'>________________</td></tr>";
while($invinfo3=mysql_fetch_array($invinfo2))
{
$counter = 1;
/////////////////////new for video 18//////////////////////
$percentage = $inninfo3['price'] / 100;
$price = $invinfo3['price'] * $percentage;
$newprice = $price + $invinfo3['price'];
$newprice = (int)$newprice;
print "<tr><td>$invinfo3[name]</td><td>$invinfo3[rating]</td><td>$invinfo3[location]</td><td>$newprice</td><td><A href='armorshop.php?id=$invinfo3[id]&bought=1'>Buy Armor</td></tr>";
}
print "</table>";
print "</td></tr></table>";
print "</center>";
echo "</small>";
if ($counter == 0)
{
echo "<center>There is nothing in the store at this time.<br>";
echo "<a href='index.php'>Go Back</center>";
exit;
}
echo "<center><a href='index.php'>NeverMind</center></a>";
}
?>
</div>
Code: Select all
$invinfo="SELECT * from weapons where class = '$class' AND level <= '$level' AND level <= '$shoplevel' || class='any'";
Code: Select all
$invinfo="SELECT * from weapons where level <= '$level' AND level <= '$shoplevel' AND (class = '$class' || class='any')";