"Could not register" ? :S

Location of the Videos
Post Reply
ricliv
Posts: 21
Joined: Tue Jul 06, 2010 11:35 am

"Could not register" ? :S

Post by ricliv »

Hello, so I am at the 5-6 video and anytime I am trying to register it redirects to reguser.php and then it sais "could not register", I don't understand.. What's the problem? These are my register.php.,reguser.php and authenticate.php

register.php

Code: Select all

<?php
include 'connect.php';

?>

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

<input type="submit" value="submit">
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<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>";
?>
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='$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='battle.php'>Continue</a></big>";
  }
  else
  {
   echo "<big>Wrong username or password.<A href='login.php'>Try Again</a></big>";
  }
}
?>
-Thanks..
User avatar
hallsofvallhalla
Site Admin
Posts: 12026
Joined: Wed Apr 22, 2009 11:29 pm

Re: "Could not register" ? :S

Post by hallsofvallhalla »

i recommend watching the videos up to around 14 then downloading the source but to help with the problem

make sure all of these in the DB are spelled correctly.
name, password, email, level, exper, attack, defense, hpoints, maxhp
ricliv
Posts: 21
Joined: Tue Jul 06, 2010 11:35 am

Re: "Could not register" ? :S

Post by ricliv »

All of them is spelled correctly.. So you mean I shouldn't register till video 14?
User avatar
hallsofvallhalla
Site Admin
Posts: 12026
Joined: Wed Apr 22, 2009 11:29 pm

Re: "Could not register" ? :S

Post by hallsofvallhalla »

no i mean just watch them all the way to 14 then download the source.
ricliv
Posts: 21
Joined: Tue Jul 06, 2010 11:35 am

Re: "Could not register" ? :S

Post by ricliv »

I haven't downloaded the source :o..
User avatar
vitinho444
Posts: 2819
Joined: Mon Mar 21, 2011 4:54 pm

Re: "Could not register" ? :S

Post by vitinho444 »

hey halls u can call me whatever you want but i only watched vid 1 and then i download the first source you release and i fixed all the errors.. i think im a quick learner xD


Thanks a lot
My Company Website: http://www.oryzhon.com

Skype: vpegas1234
Post Reply

Return to “Older Browser MMO Videos”