Page 1 of 1

Problem with Reguser codes!

Posted: Mon Jul 30, 2012 1:21 pm
by Syppii
I am experiencing problems with my reguser.php codes! Whenever I submit my, name, password and email it just says 'you did not enter a password' even though I have. But it also comes up with this '

( ! ) Notice: Undefined index: password in C:\wamp\www\Tutorial\reguser.php on line 7
Call Stack
# Time Memory Function Location
1 0.0009 696032 {main}( ) ..\reguser.php:0

( ! ) Notice: Undefined index: pass2 in C:\wamp\www\Tutorial\reguser.php on line 8
Call Stack
# Time Memory Function Location
1 0.0009 696032 {main}( ) ..\reguser.php:0

( ! ) Notice: Undefined index: password in C:\wamp\www\Tutorial\reguser.php on line 25
Call Stack
# Time Memory Function Location
1 0.0009 696032 {main}( ) ..\reguser.php:0
You didn't enter a password!
Go back!'

I am really not sure what to do!I have entered my codes below!

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 == "")
{
print "You didn't enter a email address!<br>";
print " <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 player's table.");
$isplayer3=mysql_fetch_array($isplayer2);

if(!$_POST['password'] || !$_POST['pass2'])
{
print "You didn't enter a password!<br>";
print " <a href='register.php'>Go back</a>";
exit;
}
else if($isplayer3 || strlen($player)>21 || strlen($player)<1)
{
print "There is already a player with that name or the name you specified is over 21 leters or less that 1 letter<br>";
print " <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 email address.<br>";
print " <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>";
print " <a href='register.php'>Go back</a>";
exit;
}
print " <a href='login.php'>Login Page</a><br>";

?>



Re: Problem with Reguser codes!

Posted: Mon Jul 30, 2012 2:00 pm
by OldRod
Those error messages make me think you didn't name the form fields 'password' and 'pass2'.

Post the HTML from your form page please.

Re: Problem with Reguser codes!

Posted: Mon Jul 30, 2012 3:52 pm
by Syppii

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="passsword" size="15">
<br>
ReType Password Again: <input type="text" name="passs2" size="15">
<br>
Type Email Address: <input type="text" name="email" size="60">
<br>
<input type="submit" value="submit">

Re: Problem with Reguser codes!

Posted: Mon Jul 30, 2012 3:58 pm
by OldRod
Change passsword to password and passs2 to pass2

Re: Problem with Reguser codes!

Posted: Mon Jul 30, 2012 9:37 pm
by Jackolantern
Yep, 1 too many "s" in each of those :)