Browser MMO Video#6a and 6b
- hallsofvallhalla
- Site Admin
- Posts: 12026
- Joined: Wed Apr 22, 2009 11:29 pm
Re: Browser MMO Video#6a and 6b
yep will do
Re: Browser MMO Video#6a and 6b
Need help. I have been following the tutorial videos and have had no problems until now. I cant register after adding the Exp into the reguser.php file.
Here is my code. Hopefully I can get a reply soon cause I am really enjoying this and can't wait to see whats next. Also,I couldn't figure out how to get it to work by typing it in so I went to Video 7 and copied and pasted. Idk if that could be the problem. Like I said I am only on episode 6.
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<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);
$SQL = "INSERT into players(name, password, email, level, exper, attack, defense, hpoints, maxhp) VALUES ('$player','$password','$email','1','0','5','5','30','30')";
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>";
?>
Here is my code. Hopefully I can get a reply soon cause I am really enjoying this and can't wait to see whats next. Also,I couldn't figure out how to get it to work by typing it in so I went to Video 7 and copied and pasted. Idk if that could be the problem. Like I said I am only on episode 6.
Re: Browser MMO Video#6a and 6b
I see you have it as exper in your SQL statement. Did you remember to add it in your database as well?
- hallsofvallhalla
- Site Admin
- Posts: 12026
- Joined: Wed Apr 22, 2009 11:29 pm
Re: Browser MMO Video#6a and 6b
and if it is not that then what error are you getting?
Re: Browser MMO Video#6a and 6b
I took a few screenshots to help you guys out better
Here is where it says I have the exper thing.

This is before I try to register. This is when I go right to the reguser.php. If I try to register it says "Could not register"

Hope this information helps you guys better
Here is where it says I have the exper thing.

This is before I try to register. This is when I go right to the reguser.php. If I try to register it says "Could not register"

Hope this information helps you guys better
- SpiritWebb
- Posts: 3107
- Joined: Sun Jul 12, 2009 11:25 pm
Re: Browser MMO Video#6a and 6b
Can you post your code so we can see what is going on there as well?
Re: Browser MMO Video#6a and 6b
I did post the code for the reguser.php
here is the register.php
here is the 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>
- SpiritWebb
- Posts: 3107
- Joined: Sun Jul 12, 2009 11:25 pm
Re: Browser MMO Video#6a and 6b
Your register page is what I meant, sorry I should have been more specific
Re: Browser MMO Video#6a and 6b
I posted it for you lol. Idk whats wrong with it. I looked over it from what he posted here and in the video.
- SpiritWebb
- Posts: 3107
- Joined: Sun Jul 12, 2009 11:25 pm
Re: Browser MMO Video#6a and 6b
Try changing to this part and let me know what happens:
Code: Select all
if (isset($_POST)) {
$player=$_POST['player'];
$password=$_POST['password'];
$pass2=$_POST['pass2'];
$player=strip_tags($player);
$email=$_POST['email'];
$email=strip_tags($email);
}