Page 1 of 1
matching passwords
Posted: Sun Jan 09, 2005 12:14 am
by Log2
Ok I want to know how i can make a duplicate of this:
Code: Select all
<tr>
<td>New Password:</td>
<td><input type="password" name="newpass" maxlength="30" value="
<? echo $form->value("newpass"); ?>"></td>
<td><? echo $form->error("newpass"); ?></td>
</tr>
so that it checks to see if the passwords are the same?
Posted: Sun Jan 09, 2005 12:18 am
by feyd
care to explain a bit? I don't understand..
a note: writing out the value to a password field ends up completely unencrypted on the client's side. Additionally, I'd highly suggest removing the carriage return between value=" and <? as this can easily create an extraneous space or other characters in the password sent back.
Posted: Sun Jan 09, 2005 12:27 am
by John Cartwright
You'll notice that nearly every registration script will avoid sending the password back to the client at all clients, unencrypted atleast, because of the fact of people lurking around.
Posted: Sun Jan 09, 2005 1:13 am
by Log2
removing the carriage return between value=" and <?
that's not actually there, i put that there to make it look neater. what i want is a similar form, or input whatever you want to call it, that confirms that both the passwords match, like if i put Joes in one of the password input boxes and Joey in the other it would return false and echo something
Posted: Sun Jan 09, 2005 1:18 am
by feyd
uh okay..
Code: Select all
<?php
if(!empty($_POST))
{
$pass1 = isset($_POSTї'pass1']) ? $_POSTї'pass1'] : '';
$pass2 = isset($_POSTї'pass2']) ? $_POSTї'pass2'] : '';
if( $pass1 == $pass2 )
// match
else
// mismatch
}
else
{
echo <<<STOP
<input type="password" name="pass1"><br />
<input type="password" name="pass2"><br />
STOP;
}
?>