Browser MMO Video #3

Location of the Videos
Post Reply
User avatar
hallsofvallhalla
Site Admin
Posts: 12026
Joined: Wed Apr 22, 2009 11:29 pm

Browser MMO Video #3

Post by hallsofvallhalla »

Here is Video 3. Its actually in two parts and the second part is done but waiting on it to finish converting. Should be up tonight or tomorrow morning.

[vimeo]http://vimeo.com/4894135[/vimeo]

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: <input type="text" name="pass2" size="15"><br>
Type E-mail address: <input type="text" name="email" size="60"><br>
<input type="submit" value="submit">
</form>

User avatar
hallsofvallhalla
Site Admin
Posts: 12026
Joined: Wed Apr 22, 2009 11:29 pm

Re: Video#3

Post by hallsofvallhalla »

and video 3b..enjoy

[vimeo]http://www.vimeo.com/4899893[/vimeo]


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);

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";
	 echo " <A href='register.php'>Go back</a><br>";
	 exit;
  }
  else if($isplayer3 || strlen($player)>15 || 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<br>";
	  echo " <A href='register.php'>Go back</a>";
	 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<br>";
	   echo " <A href='register.php'>Go back</a>";
	 exit;
    }
    else
    {
   	  $password=md5($password);
        
 $SQL = "INSERT into players(name, password, email, level, exper) VALUES ('$player','$password','$email','1','0')"; 
      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<br>";
   echo " <A href='register.php'>Go back</a>";
	 exit;
}
echo "<br><A href='login.php'>Login Page</a>";
?>
 
User avatar
hallsofvallhalla
Site Admin
Posts: 12026
Joined: Wed Apr 22, 2009 11:29 pm

Re: Video#3

Post by hallsofvallhalla »

fixed a typo in the code, so if anyone had trouble try again, i left the r off of exper in insert into players query
Falken
Posts: 438
Joined: Fri May 08, 2009 8:03 pm

Re: Video#3

Post by Falken »

hallsofvallhalla wrote:fixed a typo in the code, so if anyone had trouble try again, i left the r off of exper in insert into players query
You also forgot to close the <form> tag in register.php
--- Game Database ---
For all your game information needs!
Visit us at: http://www.gamedatabase.eu today!
User avatar
hallsofvallhalla
Site Admin
Posts: 12026
Joined: Wed Apr 22, 2009 11:29 pm

Re: Video#3

Post by hallsofvallhalla »

ah thanks Falken.
jvhonk
Posts: 1
Joined: Sun May 31, 2009 11:16 pm

Re: Video#3

Post by jvhonk »

thanks for the great videos , im loving it !

a quick question , in the tutorial videos the "size" for the player name is a maximum of 21 , but in the provided code it is 15. was this changed for a reason or just a small error ?
User avatar
hallsofvallhalla
Site Admin
Posts: 12026
Joined: Wed Apr 22, 2009 11:29 pm

Re: Video#3

Post by hallsofvallhalla »

ah I had originally wrote it for 15. Thanks for showing this I will change it back to 21.

I will try to have video 4 up within the next day or two.
Falken
Posts: 438
Joined: Fri May 08, 2009 8:03 pm

Re: Video#3

Post by Falken »

jvhonk wrote:a quick question , in the tutorial videos the "size" for the player name is a maximum of 21 , but in the provided code it is 15. was this changed for a reason or just a small error ?
The "size" setting is just the length of the text field, you can set it to whatever fits your design :)
--- Game Database ---
For all your game information needs!
Visit us at: http://www.gamedatabase.eu today!
User avatar
Noctrine
Posts: 928
Joined: Thu Apr 23, 2009 9:57 pm

Re: Video#3

Post by Noctrine »

Clean your inputs!
Jesse Dorsey
ProjectANI - Lead Developer Person
http://about.me/jessedorsey
User avatar
hallsofvallhalla
Site Admin
Posts: 12026
Joined: Wed Apr 22, 2009 11:29 pm

Re: Video#3

Post by hallsofvallhalla »

explain
Post Reply

Return to “Older Browser MMO Videos”