Page 1 of 1

confirming password

Posted: Wed Mar 09, 2005 2:13 am
by pleigh
here's my verify passwordword code in my registration page

Code: Select all

if (empty($_POSTї'password1']))
	{
		$pw = FALSE;
		$message .= 'Enter your password!<br>';
	}
	else
	{
		if ($_POSTї'password1'] == $_POSTї'password2'])
		{
			$pw = $_POSTї'password1'];
		}
		else
		{
			$message .= 'Your password did not match the confirmed password!<br>';
		}
	}
and here's my mysql query

Code: Select all

if ($fn && $ln && $c && $s && $d && $l && $e && $un && $pw)
	{
		$query = "INSERT INTO users(firstname, lastname, company, status, description, location, email, username, password)
		VALUES('$fn','$ln','$c','$s','$d','$l','$e','$un', md5('$pw'))";
		$result = @mysql_query($query);
		
		if ($result)
		{
			echo '<b/>User has been registered<br>';
			exit();
		}
		else
		{
			$message .= '<b/>User cannot be registered due to system error!<br>'.mysql_error();
		}
it works well but there is one error i encounter....when the characters in the password textbox and confirm password textbox do not match, an error occur pointing to this line

Code: Select all

if ($fn && $ln && $c && $s && $d && $l && $e && $un && $pw)
saying
Notice: Undefined variable: pw in c:\inetpub\wwwroot\reports\registerbody.php on line 115
can anyone spot the problem??


feyd | hey look ma,

Code: Select all

is on. [/color]

Posted: Wed Mar 09, 2005 2:22 am
by feyd
around line 14 of the first code posted, set $pw to something..