confirming password

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
pleigh
Forum Contributor
Posts: 445
Joined: Wed Jan 19, 2005 4:26 am

confirming password

Post 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]
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

around line 14 of the first code posted, set $pw to something..
Post Reply