Page 1 of 1

''Not able to query for password'' help!

Posted: Mon Jan 31, 2011 9:09 pm
by Huezzer
Hey, I've got some problems with my Register thing, 'cause every time I try to Register on my php thing, it says'' Not able to query for Password'', What's wrong? Anyone who knows anything about it?, Greetings Huezzer, Thanks ( I hope you know what I mean)

By the way: I've just Copied the codes from Hallsofvallhallas video's

Re: ''Not able to query for password'' help!

Posted: Mon Jan 31, 2011 9:52 pm
by Jackolantern
Even though you said you copied it directly, can you post your registration script? We need to make sure it is letter-for-letter, and it will also make it easier for people to have the script right here instead of having to hunt down the script elsewhere.

Re: ''Not able to query for password'' help!

Posted: Tue Feb 01, 2011 1:45 pm
by Huezzer
Aah Ye, sorry, Here it's

My code:

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>
Also, Reguser:

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)>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<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>";
?>
Thanks, Huezzer

Re: ''Not able to query for password'' help!

Posted: Tue Feb 01, 2011 2:22 pm
by hallsofvallhalla

Code: Select all

$isaddress="SELECT * from players where email='$Email'";

Code: Select all

$isaddress="SELECT * from players where email='$email'";
and change could not query for password to could not query for email...

Re: ''Not able to query for password'' help!

Posted: Tue Feb 01, 2011 2:32 pm
by Huezzer
Thanks, but still now ''could not query for Email'', ':(

I have changed the things that you wrote

Re: ''Not able to query for password'' help!

Posted: Tue Feb 01, 2011 6:26 pm
by Huezzer
Hey again, I've now gone through some more video's and everything else works just fine, Except the register-page, my codes are linked in my other post longer up on the page, if someone know anything about it pls tell me :) Thanks

//Huezzer :D

Re: ''Not able to query for password'' help!

Posted: Tue Feb 01, 2011 6:57 pm
by SpiritWebb
Did you create the user, password and email tables in your database? If so, did you set these up right?

Re: ''Not able to query for password'' help!

Posted: Tue Feb 01, 2011 7:41 pm
by hallsofvallhalla
check your players table for the email field. Make sure it is all correct

Re: ''Not able to query for password'' help!

Posted: Tue Feb 01, 2011 8:06 pm
by Huezzer
Guys, you are just soooooo @@@@@ Awesome! :D :D Thank you, now it works fine, ''Thank you for register'' :D

// Huezzer :D :!:

woot? :D

Posted: Tue Feb 01, 2011 9:07 pm
by Huezzer
Got one more problem when I try to log in (I do it the right way) it doesn't go forward when I try log in, it's just search for authenticate.php then it stop searching and the page it just white..., :(, I've tried for a very long time now to fix it but I've no clue :P(I can log in but then the page is white after a while searching for it), Thanks

//Huezzer :)