Yet another error

Location of the Videos
User avatar
Noctrine
Posts: 928
Joined: Thu Apr 23, 2009 9:57 pm

Re: Yet another error

Post by Noctrine »

Those passwords don't look like proper md5. The hash is far to short.
Jesse Dorsey
ProjectANI - Lead Developer Person
http://about.me/jessedorsey
Rob
Posts: 26
Joined: Thu Aug 06, 2009 10:40 pm

Re: Yet another error

Post by Rob »

I put in a short password, does that make a difference?
User avatar
Noctrine
Posts: 928
Joined: Thu Apr 23, 2009 9:57 pm

Re: Yet another error

Post by Noctrine »

No, it would still be the same length.

md5 for a: 0cc175b9c0f1b6a831c399e269772661
md5 for supercalifragilisticexpialidocious: 08206e04e240edb96b7b6066ee1087af



0cc175b9c0f1b6a831c399e269772661
08206e04e240edb96b7b6066ee1087af
=--------------------------------------------------------------------
Post your reguser.php file. Also when inputting a password the type of the field should be password. Makes people feel more secure.
Jesse Dorsey
ProjectANI - Lead Developer Person
http://about.me/jessedorsey
Rob
Posts: 26
Joined: Thu Aug 06, 2009 10:40 pm

Re: Yet another error

Post by Rob »

reguser anything wrong with 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);

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, attack, defense, hpoints) VALUES ('$player','$password','$email','1','0', '5', '5', '10')";
      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
Noctrine
Posts: 928
Joined: Thu Apr 23, 2009 9:57 pm

Re: Yet another error

Post by Noctrine »

Now post your login code.

Edit: wait I see it.


Alright, go into phpmyadmin. Edit one of your rows in the players table. (Its the pencil button) change the function to md5, and then type in test.

Then try and login with the account you changed using test as the password.
Jesse Dorsey
ProjectANI - Lead Developer Person
http://about.me/jessedorsey
Rob
Posts: 26
Joined: Thu Aug 06, 2009 10:40 pm

Re: Yet another error

Post by Rob »

there isnt a function for md5

Edit: Found out it was because there was a character limit of 15 on the password section so the md5 was cut off, now I log in and get a parse error on battle.php:

Code: Select all

Parse error: parse error in C:\wamp\www\mmorpg\battle.php on line 9

Code: Select all

<?php
include_once 'connect.php';
session_start();

if (isset ($_SESSION['player']));
{
	$player=$_SESSION['player'];
}
else
{
	echo "Not logged in<br><br><a href='login.php'>Login</a>";
	exit;
}

$playerinfo="SELECT * from players where name='$player'";
$playerinfo2=mysql_query($playerinfo) or die("could not get player stats!");
$playerinfo3=mysql_fetch_array($playerinfo2);

$playerhp = $playerinfo3['hpoints'];
$playerattack = $playerinfo3['attack'];
$playerdefense = $playerinfo3['defense'];

if (isset($_GET['creature']))
{
   $creature=$_GET['creature'];
   $creatureinfo="SELECT * from creatures where name = '$creature'";
$creatureinfo2=mysql_query($creatureinfo) or die("could not get the creature you were fighting!");
$creatureinfo3=mysql_fetch_array($creatureinfo2);

}
else
{
  $creatureinfo="SELECT * from creatures order by rand() limit 1";
$creatureinfo2=mysql_query($creatureinfo) or die("could get a creature!");
$creatureinfo3=mysql_fetch_array($creatureinfo2);
}

$creature = $creatureinfo3['name'];
$creaturehp = $creatureinfo3['hpoints'];
$creatureattack = $creatureinfo3['attack'];
$creaturedefense = $creatureinfo3['defense'];

/////player info
echo "<u> " . $playerinfo3['name'] . "</u><br>";
echo "Hit points = " . $playerhp . "<br>";
echo "Attack = " . $playerattack . "<br>";
echo "Defense = " . $playerdefense . "<br><br><br>";

///////creature info
echo "<u> " . $creatureinfo3['name'] . "</u><br>";
echo "Hit points = " . $creaturehp . "<br>";
echo "Attack = " . $creatureattack . "<br>";
echo "Defense = " . $creaturedefense . "<br><br><br>";

echo "<a href='attack.php?creature=$creature'>Attack!";

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

Re: Yet another error

Post by hallsofvallhalla »

ah yes got to make sure you have at least 32 characters for password

hmm not seeing the parse error.
User avatar
Noctrine
Posts: 928
Joined: Thu Apr 23, 2009 9:57 pm

Re: Yet another error

Post by Noctrine »

1. There is an MD5 function, going to need you to spend more time looking at things.

2. The parse error is because of
if (isset ($_SESSION['player']));
{
$player=$_SESSION['player'];
}
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: Yet another error

Post by hallsofvallhalla »

haha nice catch, i didn't even notice that.



your best bet is to watch through the first 8 or 9 videos then start working on the code.
Rob
Posts: 26
Joined: Thu Aug 06, 2009 10:40 pm

Re: Yet another error

Post by Rob »

Noctrine wrote:1. There is an MD5 function, going to need you to spend more time looking at things.

2. The parse error is because of
if (isset ($_SESSION['player']));
{
$player=$_SESSION['player'];
}
Ahh, thanks.
Post Reply

Return to “Older Browser MMO Videos”