Page 6 of 6

Re: Video #9

Posted: Thu Jul 29, 2010 4:38 pm
by alexander19
For instance..the warrior class inside your classes table has 15 hpoints.
And if someone registers a warrior character,the hpoints and maxhp from players table will take the value of 15,same thing for spoints and maxspoints.(they will take the value of spoints from classes table).
What I'm trying to tell you,is that you dont need two separate values for hpoints and spoints inside the classes table...just inside the players table.
Because ingame your health bar would look something like this:

(hpoints)/(maxhp)..which in the beggining for the warrior class would be: 15/15.
The hpoints will change its value most of the time you get damaged in a fight while maxhp will probably increase only when you advance a level.
Let me know if you got any more problems.

Alexander,

Re: Video #9

Posted: Thu Jul 29, 2010 5:27 pm
by scotsmokin
i got there m8

Re: Video #9

Posted: Sun Feb 06, 2011 12:46 pm
by NDest
xD i made my:

Not registered? Register

and on Register:

Already have an account? Login

With buttons after video 6 :D
So if you want buttons use this

Login:

Code: Select all

   <script type="text/javascript">
    function register(){
       window.location = "register.php";
    }
</script>
    <p>Not registered! <button onclick="register()">register</button> </p>
Login:

Code: Select all

<script type="text/javascript">
    function login(){
       window.location = "login.php";
    }
</script>
    <p>Already have an account? <button onclick="login()">Login</button> </p>
Works fine and its better with buttons ;D

Re: Video #9

Posted: Fri Jul 22, 2011 7:36 am
by dust1031
@fleaky make sure you spell everything right and on your players database make sure you have all the main entries. if u dont mind, send me your register.php and ill take a look. but before u do that make sure on your players database you have name, email, level, experience, hitpoints, attack, defense, and password. i messed up on it also because i forgot the password tab. but once i added it, it worked. and on your register.php make sure all the values and stuff is spelled correctly.

Re: Browser MMO Video #9

Posted: Sun Aug 19, 2012 11:00 am
by Aerithcal
Instead of class I change it to select the city, and i used this code because in db i have a city ID, and is a INT, so I used this and worked well:

<form action="">City:
<select name="city">
<option value="1">New York, USA</option>
<option value="2">Las Vegas, USA</option>
</select>

But I have to fill it whenever I add a city :p

Re: Browser MMO Video #9

Posted: Fri Apr 25, 2014 10:55 pm
by Axurr
Ok,I need help again :/ I've gotten the classes and stuff added but when i go to register,i type in all the information and pick my class from the drop down menu. it says "Could not register"

register.php

Code: Select all

<?php
include 'connect.php';

?>

<form method ="post" action="reguser.php">
Type Username Here: <input type="text" name="player" size="21"><br>
Type Password Here: <input type="text" name="password" size "15"><br>
ReType Password Again: <input type="text" name="pass2" size "15"><br>
Type Email Address: <input type="text" name="email" size "60"><br>

<input type="submit" value="submit">


 <?php
      print "<select name='classchoice' length='20'>";
      $classinfo="SELECT * from classes";
      $classinfo2=mysql_query($classinfo) or die("Could not select classes");
      while ($classinfo3=mysql_fetch_array($classinfo2))
      {
        print "<option>$classinfo3[name]</option>";
      }
      print "</select><br>";
?>
</form>
<?php

      print "<center><h3>Class Starting modifiers</h3></center>";
      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%'>";
      $selectclass="SELECT * from classes";
      $selectclass2=mysql_query($selectclass) or die("could not select Classes");
      print "<table border='1' bordercolor='black' bgcolor='#ffffff'>";
      print "<tr><td><font color='cc0033'>Class<font color='ffffff'>_____________</td><td><font color='cc0033'>Attack<font color='ffffff'>_</font><td><font color='cc0033'>Defense<font color='ffffff'>_</font></td><td><font color='cc0033'>Hit Points<font color='ffffff'>_</font></td><td><font color='cc0033'>Spell Points<font color='ffffff'>_</font></td></tr>";
      while($selectclass3=mysql_fetch_array($selectclass2))
      {
       print "<tr><td>$selectclass3[name]</td><td>$selectclass3[attack]</td><td>$selectclass3[defense]</td><td>$selectclass3[hpoints]</td><td>$selectclass3[spoints]</td></tr>";
          
      }
      print "</table>";
      print "</td></tr></table>";    
      print "</center>";
    
    
?>

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) VALUES ('$player','$password','$email','1','0','$classquery3[attack]','$classquery3[defense]','$classquery3[hpoints]','$classquery3[hpoints]','$classquery3[spoints]','$classquery3[spoints]')";
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>";
?>
Idk whats wrong with the code.


EDIT: Fixed it :D

Re: Browser MMO Video #9

Posted: Fri Apr 25, 2014 11:20 pm
by hallsofvallhalla
remember to change out

Code: Select all

mysql_query($SQL) or die("could not register");
for

Code: Select all

mysql_query($SQL) or die(mysql_error());
and it will help debug