2004-10-16 00:28:17 +00:00
< ? /*
Copyright ( C ) 2004 by Duane Groth < duane_at_CAcert_dot_org >
This file is part of CAcert .
CAcert has been released under the CAcert Source License
which can be found included with these source files or can
be downloaded from the internet from the following address :
http :// www . cacert . org / src - lic . php
CAcert is distributed WITHOUT ANY WARRANTY ; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE . See the License for more details .
*/ ?>
< form method = " post " action = " index.php " >
< table align = " center " valign = " middle " border = " 0 " cellspacing = " 0 " cellpadding = " 0 " class = " wrapper " width = " 350 " >
< tr >
< td colspan = " 2 " class = " title " >< ? = _ ( " Lost Pass Phrase - Step 2 " ) ?> </td>
</ tr >
< ?
srand (( double ) microtime () * 1000000 );
2005-07-01 13:12:14 +00:00
$num2 = $nums = array ();
for ( $i = 1 ; $i <= 5 ; $i ++ )
2004-10-16 00:28:17 +00:00
{
2005-07-01 13:12:14 +00:00
if ( $_SESSION [ 'lostpw' ][ 'user' ][ " Q $i " ] == " " )
continue ;
$nums [] = $i ;
}
for ( $i = 0 ; $i <= count ( $nums ); $i ++ )
{
if ( count ( $num2 ) == count ( $nums ))
break ;
2004-10-16 00:28:17 +00:00
$val = rand ( 0 , 6 );
2005-07-01 13:12:14 +00:00
if ( $_SESSION [ 'lostpw' ][ 'user' ][ " Q $val " ] == " " )
{
$i -- ;
continue ;
}
if ( $val < 1 || $val > 5 )
{
$i -- ;
continue ;
}
if ( ! in_array ( $val , $num2 ))
$num2 [] = $val ;
else
$i -- ;
if ( count ( $num2 ) >= 3 )
break ;
2004-10-16 00:28:17 +00:00
}
2005-07-01 13:12:14 +00:00
if ( $i > 1 )
{
$_SESSION [ 'lostpw' ][ 'total' ] = $i ;
foreach ( $num2 as $num )
2004-10-16 00:28:17 +00:00
{
$q = " Q $num " ; $a = " A $num " ;
2005-05-13 15:34:39 +00:00
if ( $_SESSION [ 'lostpw' ][ 'user' ][ $q ] == " " )
continue ;
2004-10-16 00:28:17 +00:00
?>
< tr >
2005-05-13 15:34:39 +00:00
< td class = " DataTD " >< ? = $_SESSION [ 'lostpw' ][ 'user' ][ $q ] ?> </td>
2004-10-16 00:28:17 +00:00
< td class = " DataTD " >< input type = " text " name = " <?= $a ?> " value = " <?= $_SESSION['lostpw'] [ $a ]?> " >
< input type = " hidden " name = " <?= $q ?> " value = " <?= $_SESSION['lostpw'] ['user'][ $q ]?> " ></ td >
</ tr >
< ? } ?>
< tr >
< td class = " DataTD " >< ? = _ ( " New Pass Phrase " ) ?> <font color="red">*</font>: </td>
< td class = " DataTD " >< input type = " password " name = " newpass1 " ></ td >
</ tr >
< tr >
< td class = " DataTD " >< ? = _ ( " Repeat " ) ?> <font color="red">*</font>: </td>
< td class = " DataTD " >< input type = " password " name = " newpass2 " ></ td >
</ tr >
< tr >
< td class = " DataTD " colspan = " 2 " >< font color = " red " >*</ font >< ? = _ ( " Please note, in the interests of good security, the pass phrase must be made up of an upper case letter, lower case letter, number and symbol. " ) ?> </td>
</ tr >
< tr >
< td class = " DataTD " colspan = " 2 " >< input type = " submit " name = " process " value = " <?=_( " Next " )?> " ></ td >
</ tr >
</ table >
< input type = " hidden " name = " oldid " value = " <?= $id ?> " >
</ form >
2005-07-01 13:12:14 +00:00
< ? } else { ?>
< p >< ? = _ ( " You do not have enough/any lost password questions set. You will not be able to continue to reset your password via this method. " ) ?> </p>
< ? } ?>