Page 3 of 5

Re: Video #12

Posted: Sat Aug 22, 2009 3:55 am
by darspire
im not downloading the vids im trying to download the php files

Re: Video #12

Posted: Sat Aug 22, 2009 4:21 pm
by Hutch
I just tried to download the zip of php and sqldump, with no problems.

What is happening when you try?

Re: Video #12

Posted: Mon Aug 24, 2009 10:59 pm
by darspire
well i have a game called diablo 2. when i do the file it comes up as diablo 2...

Re: Video #12

Posted: Tue Aug 25, 2009 11:05 am
by mrmajic
Hi halls,

when do you expect to have vid 13 up?? Cant wait...

just got back from our honeymoon .. went to queensland (gold coast) (australia) .. was great.. back to melbourne .. sooooooo cooollldddd....

Re: Video #12

Posted: Tue Aug 25, 2009 1:15 pm
by hallsofvallhalla
mrmajic wrote:Hi halls,

when do you expect to have vid 13 up?? Cant wait...

just got back from our honeymoon .. went to queensland (gold coast) (australia) .. was great.. back to melbourne .. sooooooo cooollldddd....
yeah i need to get on that don't I :) Will work on getting that done.


HoneyMoon sounds awesome...I hope you tapped that a$$ worthy of a Australian honeymoon :P

Re: Video #12

Posted: Fri Sep 04, 2009 3:15 am
by darspire
can you put the codes up like you did in the older videos cuz i guess i cant download them

Re: Video #12

Posted: Fri Sep 04, 2009 3:20 am
by hallsofvallhalla
yes, i will do that in the morning.

Re: Video #12

Posted: Tue Sep 08, 2009 7:41 pm
by darspire
will it be a new topic? or what?

Re: Video #12

Posted: Tue Sep 08, 2009 8:16 pm
by hallsofvallhalla
thats wierd i could of swore I already posted them, eh oh well here they are,

authenticate.php

Code: Select all

<?php
include_once 'connect.php';
session_start();

if (isset($_POST['submit']))
{
  $player=$_POST['player'];
  $password=$_POST['password'];
  $player=strip_tags($player);
  $password=strip_tags($password);
  $password=md5($password);

  $query = "select name,password from players where name='$player' and '$password'";
  $result = mysql_query($query) or die("Could not query players");
  $result2 = mysql_fetch_array($result);
  if ($result2)
  { 
    $_SESSION['player']=$player;
    
    echo "<big>Logged in successfully<br>";
    echo "<A href='index.php'>Continue</a></big>";
  }
  else
  {
   echo "<big>Wrong username or password.<A href='login.php'>Try Again</a></big>";
  }
}
?>
attack.php

Code: Select all

<?php
include_once 'connect.php';
  session_start();
  include_once 'logo.php';
?>
  
  <link href="style.css" rel="stylesheet" type="text/css" />
<div id="login2" div align="center">

<?php
if (isset($_SESSION['player']))
{
  $player=$_SESSION['player'];
}
else
{
  echo "Not Logged in <br><br> <A href='login.php'>Login</a>";
  exit;
}
?>
</div>
<?php
 $playerinfo="SELECT * from players where name='$player'";
$playerinfo2=mysql_query($playerinfo) or die("could not get player stats!");
$playerinfo3=mysql_fetch_array($playerinfo2);
 include_once 'statpanel.php';

 ?>
</div>
<div id="table">
<?php
 $creature = $playerinfo3['creature'];
 if ($creature != 0)
{
 $creatureinfo="SELECT * from creatures where id='$creature'";
$creatureinfo2=mysql_query($creatureinfo) or die("could not get the creature you were fighting!");
$creatureinfo3=mysql_fetch_array($creatureinfo2);

}
else
{
  echo "<a href='battle.php'>No Creature selected. Go Back!";
  exit;
}

$playerhp = $playerinfo3['hpoints'];
$playerattack = $playerinfo3['attack'];
$playerdefense = $playerinfo3['defense'];

$creature = $creatureinfo3['name'];
$creaturehp = $creatureinfo3['hpoints'];
$creatureattack = $creatureinfo3['attack'];
$creaturedefense = $creatureinfo3['defense'];

 ?>
 </div>
 <div id="player">
 <?php
///////////////////////players turn////////////////////

echo "<center><u> " . $playerinfo3['name'] . "'s Attack</u><br>";
$playerattack = rand(1,20) + $playerattack;
$creaturedefense = rand(1,20) + $creaturedefense;

echo $playerinfo3['name'] . "'s Attack roll is " . $playerattack . "<br>";
echo $creature . "'s defense roll is " . $creaturedefense. "<br>";

if ($playerattack  > $creaturedefense)
{
  echo $playerinfo3['name'] . " hits! <br>";
  $playerdamage = rand(1,6);
   $newcreaturehp = $creaturehp - $playerdamage;
  echo "For " . $playerdamage . " points of damage. <br>";
   if ($newcreaturehp < 1)
   {
     echo "The " . $creature . " has been killed";

        $updatecreature="DELETE from creatures where name='$creature' limit 1";
  mysql_query($updatecreature) or die("Could not update creature");



        if ($playerinfo3['level'] > $creatureinfo3['level'])
        {
         $firstmod = $playerinfo3['level'] - $creatureinfo3['level'];
         $secondmod = $firstmod * 10 ;
         if ($secondmod > 90){$secondmod = 90;}
         $thirdmod = ($secondmod / 100) * $creatureinfo3['exper'];
         $totalexper =$creatureinfo3['exper'] - $thirdmod;
        }
        else
        {
         $firstmod = $creatureinfo3['level'] - $playerinfo3['level'];
         $secondmod = $firstmod * 10 ;
         if ($secondmod > 90){$secondmod = 90;}
         $thirdmod = ($secondmod / 100) * $creatureinfo3['exper'];
         $totalexper =$creatureinfo3['exper'] + $thirdmod;
        }
          $totalexper = (int)$totalexper;

           echo "<br><b><big>You gain " . $totalexper . " experience.</b></big><br>";
      $updateplayer="update players set exper=exper+'$totalexper',creature=0 where name='$player'";
  mysql_query($updateplayer) or die("Could not update player");



      echo "<a href='battle.php'>Go Back";
      exit;
   }

  $updatecreature="update creatures set hpoints='$newcreaturehp' where name='$creature' limit 1";
  mysql_query($updatecreature) or die("Could not update creature");
}
else
{
   echo $playerinfo3['name'] . " misses!<br>";
}
?>
</div>
<div id="creature">
<?php
 //////////////////////creatures turn //////////////////

echo "<center><u> " . $creature . "'s Attack</u><br>";
$creatureattack = rand(1,20) + $creatureattack;
$playerdefense = rand(1,20) + $playerdefense;

echo $creature . "'s Attack roll is " . $creatureattack . "<br>";
echo $playerinfo3['name'] . "'s defense roll is " . $playerdefense . "<br>";

if ($creatureattack  > $playerdefense)
{
  echo $creature . " hits! <br>";
  $creaturedamage = rand(1,6);
   $newplayerhp = $playerhp - $creaturedamage;
   echo "For " . $creaturedamage . " points of damage. <br>";
   if ($newplayerhp < 1)
   {
     echo $playerinfo3['name'] . " has been killed<br>";
      echo "<a href='gameover.php>Continue'";
      exit;
   }
  $updateplayer="update players set hpoints='$newplayerhp' where name='$player'";
  mysql_query($updateplayer) or die("Could not update player");
}
else
{
  echo $creature . " misses!";
}
 echo "<br><br><a href='battle.php?creature=$creature'>Battle Again!";
 ?>
 </div>

battle.php

Code: Select all

<?php
include_once 'connect.php';
session_start();

include_once 'logo.php';
?>
 <link href="style.css" rel="stylesheet" type="text/css" />
<div id="login2" div align="center">


<?php

 


if (isset($_SESSION['player']))
{
  $player=$_SESSION['player'];
}
else
{
  echo "Not Logged in <br><br> <A href='login.php'>Login</a>";
  exit;
}
?>
</div>
<?php
$playerinfo="SELECT * from players where name='$player'";
$playerinfo2=mysql_query($playerinfo) or die("could not get player stats!");
$playerinfo3=mysql_fetch_array($playerinfo2);

include_once 'statpanel.php';

$name = $playerinfo3['name'];
$playerhp = $playerinfo3['hpoints'];
$playerattack = $playerinfo3['attack'];
$playerdefense = $playerinfo3['defense'];

?>
<div id="table">
<?php

 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 hpoints='$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>";
 }

}}
 ////////////////////////////////


$creature = $playerinfo3['creature'];
 if ($creature != 0)
{
 $creatureinfo="SELECT * from creatures where id='$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);
$cid = $creatureinfo3['id'];
$updateplayer="update players set creature='$cid' where name='$name'";
  mysql_query($updateplayer) or die("Could not update player");
}

$creature = $creatureinfo3['name'];
$creaturehp = $creatureinfo3['hpoints'];
$creatureattack = $creatureinfo3['attack'];
$creaturedefense = $creatureinfo3['defense'];



?>
</div>
<div id="player">
<?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">
<?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'>Attack</a>";
echo "<br><a href='usemagic.php'>Use Magic</a>";
echo "<br><a href='useitem.php'>Use Item</a>";
echo "<br><a href='index.php'>Exit Arena</a>";


?>
</div>

<div id="logout">
<?php
echo "<br><a href='logout.php'><img src='images/logout.gif'>";
?>
</div>
buyitem.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;
}


  $randid=$_GET['randid'];

$playerinfo="SELECT * from players where name='$player'";
$playerinfo2=mysql_query($playerinfo) or die("could not get player stats!");
$playerinfo3=mysql_fetch_array($playerinfo2);
include_once 'statpanel.php';
?>
<div id="table">
<?php

$playerid = $playerinfo3['id'];

$iteminfo="SELECT * from store where randid='$randid'";
$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;
}


$name = $iteminfo3['name'];
$stats = $iteminfo3['stats'];
$statadd = $iteminfo3['statadd'];
$type = $iteminfo3['type'];
$randid2 = rand(1000,999999999);

$itembought = "INSERT into inventory(id, name, stats, statadd, randid,type) VALUES ('$playerid','$name','$stats','$statadd','$randid2','$type')";
mysql_query($itembought) or die("could not insert item into backpack");

$updateplayer="update players set gold=gold-'$iteminfo3[price]' where name='$player'";
  mysql_query($updateplayer) or die("Could not update player");

echo $name . " Purchased";
 echo "<center><a href='index.php'>Go Back</center>";
  ////did not make a - counter for item////
  
  ?>
 </div>
index.php

Code: Select all

<?php
include_once 'connect.php';
session_start();

include_once 'logo.php';
?>
 <link href="style.css" rel="stylesheet" type="text/css" />
<div id="login2" div align="center">


<?php
if (isset($_SESSION['player']))
{
  $player=$_SESSION['player'];
}
else
{
  echo "Not Logged in <br><br> <A href='login.php'>Login</a>";
  exit;
}
?>
</div>

<?php
$playerinfo="SELECT * from players where name='$player'";
$playerinfo2=mysql_query($playerinfo) or die("could not get player stats!");
$playerinfo3=mysql_fetch_array($playerinfo2);
include_once 'statpanel.php';
 ?>
 <div id ="locations">
 <?php
$playerhp = $playerinfo3['hpoints'];
if ($playerhp < 1)
{
  echo "You are dead!" ;
  echo "<br><a href='useitem.php>Use an Item";
  exit;
}

echo "<b><big><u>Locations</u></big></b><br>";
echo "<a href='store.php'>Visit Store<br>";
echo "<a href='spelltrainer.php'>Visit Spell Trainer<br>";
echo "<a href='battle.php'>Battle in Arena<br>";
 ?>
 </div>
<div id="logout">
<?php
echo "<br><a href='logout.php'><img src='images/logout.gif'></a>";
?>
</div>

newitem.php

Code: Select all

<?php

include_once 'connect.php';
 session_start();

if (isset($_SESSION['player']))
{
  $player=$_SESSION['player'];
}
else
{
  echo "Not Logged in <br><br> <A href='login.php'>Login</a>";
  exit;
}

 $creature=$_GET['creature'];

$playerinfo="SELECT * from players where name='$player'";
$playerinfo2=mysql_query($playerinfo) or die("could not get player stats!");
$playerinfo3=mysql_fetch_array($playerinfo2);

$playerid = $playerinfo3['id'];

 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 backpack where id='$id'";
      $invinfo2=mysql_query($invinfo) or die("could not select backpack");
      print "<table border='1' bordercolor='white' bgcolor='#fff000'>";
      print "<tr><td><font color='ccc000'>________________</td><td>Name<font color='ccc000'>________________</td><td>Stat<font color='ccc000'>______</td></tr>";
      while($invinfo3=mysql_fetch_array($invinfo2))
      {
      if (!$invinfo)
      {
            echo "You have Nothing in your inventory!<br>";
            echo "<a href='battle.php?creature=$creature'>Go Back";
            exit;
      }

       print "<tr><td>$invinfo3[name]</td><td>$invinfo3[stats]</td><td>$invinfo3[statadd]</td><td><A href='useitem2.php?randid=$selectbackpack3[randid]</td></tr>"
      }

      print "</table>";
      print "</td></tr></table>";    
      print "</center>";
		 echo "</small>";



reguser.php

Code: Select all

<?php
include 'connect.php';
?>

<?php
$player=$_POST['player'];
$password=$_POST['password'];
$pass2=$_POST['pass2'];
$player=strip_tags($player);
$email=$_POST['email'];
$email=strip_tags($email);
$classchoice=$_POST['classchoice'];

if ($email == "")
{
echo "You didn't enter a email address!<br>";
echo " <A href='register.php'>Go back</a>";
exit;
}
if ($password==$pass2)
{

$isplayer="SELECT * from players where name='$player'";
$isplayer2=mysql_query($isplayer) or die("Could not query players table");
$isplayer3=mysql_fetch_array($isplayer2);

if(!$_POST['password'] || !$_POST['pass2'])
{
print "You did not enter a password<br>";
echo " <A href='register.php'>Go back</a>";
exit;
}
else if($isplayer3 || strlen($player)>21 || strlen($player)<1)
{
print "There is already a player of that name or the name you specified is over 16 letters or less than 1 letter";
echo " <A href='register.php'>Go back</a><br>";
exit;
}
else
{
$isaddress="SELECT * from players where email='$email'";
$isaddress2=mysql_query($isaddress) or die("not able to query for password");
$isaddress3=mysql_fetch_array($isaddress2);
if($isaddress3)
{
print "There is already a player with that e-mail address";
echo " <A href='register.php'>Go back</a><br>";
exit;
}
else
{
$password=md5($password);

 //////////////////////////////new for video 9//////////////
 $classquery="SELECT * from classes where name='$classchoice'";
  $classquery2=mysql_query($classquery) or die("Could not query classes");
  $classquery3=mysql_fetch_array($classquery2);

$SQL = "INSERT into players(name, password, email, level, exper, attack, defense, hpoints, maxhp, spoints, maxspoints,pclass) VALUES ('$player','$password','$email','1','0','$classquery3[attack]','$classquery3[defense]','$classquery3[hpoints]','$classquery3[hpoints]','$classquery3[spoints]','$classquery3[spoints]','$classquery3[name]')";
mysql_query($SQL) or die("could not register");

print "Thank you for registering!";

}
}
}

else
{
print "Your password didn't match or you did not enter a password";
echo " <A href='register.php'>Go back</a><br>";
exit;
}
 echo " <A href='login.php'>Login Page</a><br>";
?>
spelltrainer.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);
include_once 'statpanel.php';
?>
</div>
<div id="table">
 <?php
$counter = 0;




 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%'>";
      $spellinfo="SELECT * from spells where sclass = '$playerinfo3[pclass]' AND level <= '$playerinfo3[level]'";
      $spellinfo2=mysql_query($spellinfo) or die("No spells available");
      print "<table border='1' bordercolor='white' bgcolor='#ffffff'>";
      print "<tr><td>Name<font color='ffffff'>________________</td><td>Spell Level<font color='ffffff'>______</td><td>Type<font color='ffffff'>______</td><td>Price<font color='ffffff'>______</td><td><font color='ffffff'>________________</td></tr>";
      while($spellinfo3=mysql_fetch_array($spellinfo2))
      {
      $counter = 1;
      print "<tr><td>$spellinfo3[name]</td><td>$spellinfo3[level]</td><td>$spellinfo3[type]</td><td>$spellinfo3[price]</td><td><A href='trainspell.php?id=$spellinfo3[id]'>Train Spell</td></tr>";

      }

      print "</table>";
      print "</td></tr></table>";
      print "</center>";
      echo "</small>";

      if ($counter == 0)
      {
            echo "<center>There are no Spells for you to train in at this time.<br>";
            echo "<a href='index.php'>Go Back</center>";
            exit;
      }
  echo "<center><a href='index.php'>NeverMind</center></a>";
  
  ?>
  </div>

statpanel.php

Code: Select all

<div id="lpanel">
<?php
echo "<u><b> " . $playerinfo3['name'] . "</b></u><br>";
echo $playerinfo3['pclass'] . "<br>";



echo "Attack = " . $playerinfo3['attack'] . "<br>";
echo "Defense = " . $playerinfo3['defense'] . "<br>";
echo "Hit Points<br>";
echo "Spell Points<br><br>";
echo "<b><big><u>Gold</u></big></b><br>";
echo $playerinfo3['gold'];
?>
</div>

<div id= "hpointsback">
<?php
echo "<img src='images/barback.png'>";
?>
</div>

<div id= "hpoints">
<?php
$width = ($playerinfo3['hpoints'] / $playerinfo3['maxhp']) * 100;
echo "<img src='images/hpoints.png' width='$width' height='15' >";
?>
</div>

<div id= "spointsback">
<?php
echo "<img src='images/barback.png'>";
?>
</div>

<div id= "spoints">
<?php
$width = ($playerinfo3['spoints'] / $playerinfo3['maxspoints']) * 100;
echo "<img src='images/spoints.png' width='$width' height='15' >";
?>
</div>[code]

store.php
<?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);
include_once 'statpanel.php';
?>
</div>
<div id="table">
<?php
$counter = 0;




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 store where amount > 0";
$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>Stat<font color='ffffff'>______</td><td>Stat Add<font color='ffffff'>______</td><td>Type<font color='ffffff'>______</td><td>Price<font color='ffffff'>______</td><td><font color='ffffff'>____________</td></tr>";
while($invinfo3=mysql_fetch_array($invinfo2))
{
$counter = 1;
print "<tr><td>$invinfo3[name]</td><td>$invinfo3[stats]</td><td>$invinfo3[statadd]</td><td>$invinfo3[type]</td><td>$invinfo3[price]</td><td><A href='buyitem.php?randid=$invinfo3[randid]'>Buy Item</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]

style.css

Code: Select all

body {
	background-color: #ffffff;
}
#login {
	position:absolute;
	left:0px;
	top:0px;
	width:800px;
	height:150px;
	z-index:1;
}
#login2 {
	position:absolute;
	left:0px;
	top:200px;
	width:800px;
	height:150px;
	z-index:1;
}
#player {
	position:absolute;
	left:400px;
	top:200px;
	width:450px;
	height:450px;
	z-index:3;
}
#creature {
	position:absolute;
	left:400px;
	top:400px;
	width:450px;
	height:650px;
	z-index:3;
}
#logout {
	position:absolute;
	left:10px;
	top:10px;
	width:150px;
	height:150px;
	z-index:3;
}
#locations {
	position:absolute;
	left:400px;
	top:100px;
	width:450px;
	height:450px;
	z-index:3;
}
#gold {
	position:absolute;
	left:200px;
	top:200px;
	width:150px;
	height:100px;
	z-index:3;
}
#lpanel {
	position:absolute;
	left:10px;
	top:120px;
	width:100px;
	height:200px;
	z-index:3;
}
#hpointsback {
	position:absolute;
	left:10px;
	top:184px;
	width:100px;
	height:15px;
	z-index:1;
}
#hpoints {
	position:absolute;
	left:10px;
	top:184px;
	width:100px;
	height:15px;
	z-index:2;
	text-align:left;
}
#spointsback {
	position:absolute;
	left:10px;
	top:205px;
	width:100px;
	height:15px;
	z-index:1;
}
#spoints {
	position:absolute;
	left:10px;
	top:205px;
	width:100px;
	height:15px;
	z-index:2;
	text-align:left;
}
#table {
	position:absolute;
	left:200px;
	top:105px;
	width:500px;
	height:900px;
	z-index:2;
}
trainspell.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;
}


  $sid=$_GET['id'];

$playerinfo="SELECT * from players where name='$player'";
$playerinfo2=mysql_query($playerinfo) or die("could not get player stats!");
$playerinfo3=mysql_fetch_array($playerinfo2);
include_once 'statpanel.php';
?>
<div id="table">
<?php

$playerid = $playerinfo3['id'];
$pname = $playerinfo3['name'];

$spellinfo="SELECT * from spells where id='$sid'";
$spellinfo2=mysql_query($spellinfo) or die("could not get spells!");
$spellinfo3=mysql_fetch_array($spellinfo2);


if ($spellinfo3['level'] > $playerinfo3['level'])
{
 echo "You are not high enough level to train for this spell!";
  echo "<center><a href='index.php'>Go Back</center>";
  exit;
}

if ($playerinfo3['gold'] < $spellinfo3['price'])
{
 echo "You do not have enough Gold to train for this spell!";
  echo "<center><a href='index.php'>Go Back</center>";
  exit;
}
if ($playerinfo3['pclass'] != $spellinfo3['sclass'])
{
 echo "You are not the right class to train for this spell!";
  echo "<center><a href='index.php'>Go Back</center>";
  exit;
}
 $sid = $spellinfo3['id'];
 $sname = $spellinfo3['name'];
 $slevel = $spellinfo3['level'];
 $stype = $spellinfo3['type'];
 $svalue = $spellinfo3['svalue'];
 $scost = $spellinfo3['scost'];
 $sprice = $spellinfo3['price'];

$SQL = "INSERT into playermagic(pid, sid, name, level, type, svalue,scost) VALUES ('$playerid','$sid','$sname','$slevel','$stype','$svalue','$scost')";
 mysql_query($SQL) or die("could not register");

$updateplayer="update players set gold=gold-'$sprice' where name='$pname'";
  mysql_query($updateplayer) or die("Could not update player");

echo $sname . " learned sucessfully";
 echo "<center><a href='index.php'>Go Back</center>";

  
  ?>
 </div>
useitem.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);
include_once 'statpanel.php';
$playerid = $playerinfo3['id'];

$counter = 0;
 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 inventory where id='$playerid'";
      $invinfo2=mysql_query($invinfo) or die("could not select player inventory");
      print "<table border='1' bordercolor='white' bgcolor='#ffffff'>";
      print "<tr><td>Name<font color='ffffff'>________________</font></td><td>Stat<font color='ffffff'>______</td><td>Stat Add<font color='ffffff'>______</td><td>Type<font color='ffffff'>______</td><td><font color='ffffff'>________________</td></tr>";
      while($invinfo3=mysql_fetch_array($invinfo2))
      {
      print "<tr><td>$invinfo3[name]</td><td>$invinfo3[stats]</td><td>$invinfo3[statadd]</td><td>$invinfo3[type]</td><td><A href='battle.php?randid=$invinfo3[randid]'>Use Item</td></tr>";
       $counter = 1;

      }

      print "</table>";
      print "</td></tr></table>";
      print "</center>";
		 echo "</small>";

      if ($counter == 0)
      {
            echo "<center>You have Nothing in your inventory!<br>";
            echo "<a href='battle.php>Go Back</center>";
            exit;
      }

    echo "<center><a href='battle.php>NeverMind</center>";
    
    ?>
usemagic.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);
include_once 'statpanel.php';
$playerid = $playerinfo3['id'];
 ?>
 </div>
 <div id="table">
 <?php
$counter = 0;
 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 playermagic where pid='$playerid'";
      $invinfo2=mysql_query($invinfo) or die("could not select player magic");
      print "<table border='1' bordercolor='white' bgcolor='#ffffff'>";
      print "<tr><td>Name<font color='ffffff'>________________</font></td><td>Level<font color='ffffff'>______</td><td>Type<font color='ffffff'>______</td><td>Value<font color='ffffff'>______</td><td>Point Cost<font color='ffffff'>______</td><td><font color='ffffff'>________________</td></tr>";
      while($invinfo3=mysql_fetch_array($invinfo2))
      {
      print "<tr><td>$invinfo3[name]</td><td>$invinfo3[level]</td><td>$invinfo3[type]</td><td>$invinfo3[svalue]</td><td>$invinfo3[scost]</td><td><A href='attack.php?sid=$invinfo3[sid]'>Use Magic</td></tr>";
       $counter = 1;

      }

      print "</table>";
      print "</td></tr></table>";
      print "</center>";
		 echo "</small>";

      if ($counter == 0)
      {
            echo "<center>You have no Spells!<br>";
            echo "<a href='battle.php>Go Back</center>";
            exit;
      }

    echo "<center><a href='battle.php>NeverMind</center>";
    
    ?>
    </div>

Re: Video #12

Posted: Tue Sep 08, 2009 9:20 pm
by darspire
thats all of em?