Something missing/wrong?

Location of the Videos
Post Reply
GanDuumar
Posts: 3
Joined: Sun Jul 18, 2010 9:49 am

Something missing/wrong?

Post by GanDuumar »

Okay, i have the code you gave me. I made some into comment, because it's too far. I had this:

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>";
?>
The problem is when making the user. When I input everything right, I end up with: "could not register"
Is the problem in my configuration or something? Could you help :3
alexander19
Posts: 180
Joined: Fri Apr 02, 2010 1:05 pm

Re: Something missing/wrong?

Post by alexander19 »

I think the problem is here:

Code: Select all

$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]')
You are not inserting any values inside the attack/defense/hpoints etc tabs.

If you dont want those it should look like this:

Code: Select all

SQL = "INSERT into players(name, password, email, level, exper) VALUES ('$player','$password','$email','1','0')"; 
GanDuumar
Posts: 3
Joined: Sun Jul 18, 2010 9:49 am

Re: Something missing/wrong?

Post by GanDuumar »

I totally missed that line. Well, that fixes the problem (Atleast for now ;) ).
Thank you alexander19.
r4t
Posts: 4
Joined: Fri Oct 01, 2010 1:26 pm

Re: Something missing/wrong?

Post by r4t »

I need help beacuse i write down da video 5:
  • <?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 where name='$players and $password'";
    $result = mysql_query ($query) or die ("Nem tudtam lekérni a játékost");
    $result2 = mysql_fetch_array($result);
    if ($result2)
    (
    $_SESSION('player'=$player;

    echo "<big>Sikeres bejelentkezés<br>";
    echo "<a href='battle.php'>Tovább</a></big>";
    )
    else
    (
    echo "<big>Rossz felhasználónév vagy jelszó!<a href='login.php'>Próbálja újra</a></big>";
    )
    )
    ?>
and when i log in it writes:
  • Parse error: syntax error, unexpected ';' in D:\Documents and Settings\BBalazs\Dokumentumok\xampp\xampp\htdocs\tutorial\authenticate.php on line 7
can you help me?
User avatar
hallsofvallhalla
Site Admin
Posts: 12026
Joined: Wed Apr 22, 2009 11:29 pm

Re: Something missing/wrong?

Post by hallsofvallhalla »

you ( should be a {

example

if ($this == $that)
{
do code here;
}
r4t
Posts: 4
Joined: Fri Oct 01, 2010 1:26 pm

Re: Something missing/wrong?

Post by r4t »

thx
r4t
Posts: 4
Joined: Fri Oct 01, 2010 1:26 pm

Re: Something missing/wrong?

Post by r4t »

i test it but it doesn't work can you send me the code of the authenticate.php? or just type into the forum or send me in an email ( bbcelicw aht gmail doht com) but pls help!!

Mod Edit: Good idea to not write your email address literally, lest you love spam ;) Those spiders are crawling 24/7/365 -Jackolantern
User avatar
hallsofvallhalla
Site Admin
Posts: 12026
Joined: Wed Apr 22, 2009 11:29 pm

Re: Something missing/wrong?

Post by hallsofvallhalla »

what error are you getting now.

i do not recommend doing any code until you watch to video 14. Then all the code is there.
Post Reply

Return to “Older Browser MMO Videos”