Page 1 of 1

Problem with Browser Based Game Building[resolved]

Posted: Tue Jan 22, 2013 7:56 am
by bultrayer
Okay , i'am trying to build register system , i did everything
heres the code :

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>
Password Again: <input type="text" name="pass2" size="15"><br>
Email: <input type="text" name="email" size="60"><br>

<input type="submit" value="submit">

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!";
echo " <A href ='register.php'>Go back</a><br>";
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 specifed is over 16 letters, or you didn't specific even 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 email address";
echo " <A href='register.php'>Go back</a><br>";	
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 didn't enter a password";
echo " <A href='register.php'>Go back</a><br>";
exit;
}
echo " <A href='login.php'>Login Page</a><br>";
?>

When i try to register it says to me "You didn't enter a email address!" even if every field is right , even if email is writed and no password still.
Help me??

Heres the a screenshot i took : http://prntscr.com/q06rl

Re: Problem with Browser Based Game Building

Posted: Tue Jan 22, 2013 8:13 am
by Elvar
Remember to always use $_POST in uppercase, variable names are case sensitive :).

So when you are trying to get $_post['email'] php will say, this variable have not being initialized, so i'll just return false. Try correcting it to $_POST and lemme know :).

Re: Problem with Browser Based Game Building

Posted: Tue Jan 22, 2013 8:34 am
by bultrayer
Elvar wrote:Remember to always use $_POST in uppercase, variable names are case sensitive :).

So when you are trying to get $_post['email'] php will say, this variable have not being initialized, so i'll just return false. Try correcting it to $_POST and lemme know :).
Alright now it stopped saying email error it begun with "Your password didn't match or you didn't enter a password"
and every field was right.

Now whats the problem O_o

Re: Problem with Browser Based Game Building

Posted: Tue Jan 22, 2013 8:45 am
by srachit
bultrayer wrote:
Elvar wrote:Remember to always use $_POST in uppercase, variable names are case sensitive :).

So when you are trying to get $_post['email'] php will say, this variable have not being initialized, so i'll just return false. Try correcting it to $_POST and lemme know :).
Alright now it stopped saying email error it begun with "Your password didn't match or you didn't enter a password"
and every field was right.

Now whats the problem O_o
Check your db if the information has been inputed, I do not see the purpose of the last else statement, then again I am using a phone right now so cant see properly.

See if the information has been inputed in your db and if it has then I think you can go ahead and remove the last else statement.

Re: Problem with Browser Based Game Building

Posted: Tue Jan 22, 2013 8:48 am
by bultrayer
srachit wrote:
bultrayer wrote:
Elvar wrote:Remember to always use $_POST in uppercase, variable names are case sensitive :).

So when you are trying to get $_post['email'] php will say, this variable have not being initialized, so i'll just return false. Try correcting it to $_POST and lemme know :).
Alright now it stopped saying email error it begun with "Your password didn't match or you didn't enter a password"
and every field was right.

Now whats the problem O_o
Check your db if the information has been inputed, I do not see the purpose of the last else statement, then again I am using a phone right now so cant see properly.

See if the information has been inputed in your db and if it has then I think you can go ahead and remove the last else statement.
No it didn't input anything into sql db.

Re: Problem with Browser Based Game Building

Posted: Tue Jan 22, 2013 1:16 pm
by bultrayer
I some how fixed it my way , thanks anyway!

//request lock