次のコードは、当ウェブサイトのパスワードを忘れたセクションを処理するテンプレートです。 (私はそれが愚かであると私に嫌がらせをしないでください、私はそれを書いていません) $ _POST ['PIDの場合、あなたのPIDは数字でなければなりません'というメッセージで '/ inc/forgot_password_form' ']は数値でない文字を持ちます。 このコードを変更するにはどうすればよいですか?
私はjQueryバリデータを使用してクライアント側で行うことができますが、ここでは最小値をチェックして特別なメッセージを表示できるので、ここでやりたいと思います。新しいコードで
{if segment_2 == 'submit'}
<?
$embed_params = 'EmailAddress="' . $_POST['EmailAddress'] . '" PID="' . $_POST['PID'] . '" ';
?>
{embed='/inc/forgot_password_form' message='{exp:forgot_password:send_email code="{segment_3}" <?=$embed_params?>}' <?=$embed_params?>}
{if:elseif segment_2 == 'reset'}
{embed='/inc/forgot_password_reset' email='{exp:forgot_password:check_code code="{segment_3}" }' code="{segment_3}"}
{if:elseif segment_2 == 'reset_submit'}
{embed='/inc/forgot_password_reset' message='{exp:forgot_password:update_password code="<?=$_POST['code']?>" password="<?=$_POST['password']?>" }' }
{if:else}
{embed='/inc/forgot_password_form' }
{/if}
編集:
だから、あなたはこのようにそれを行うために言っていますか?
{if segment_2 == 'submit'}
<?
$embed_params = 'EmailAddress="' . $_POST['EmailAddress'] . '" PID="' . $_POST['PID'] . '" ';
if (!is_int($_POST['PID']) {
{embed='/inc/forgot_password_form' message='You submitted an invalid Member #.' <?=$embed_params?>}
} else {
{embed='/inc/forgot_password_form' message='{exp:forgot_password:send_email code="{segment_3}" <?=$embed_params?>}' <?=$embed_params?>}
}
?>
{if:elseif segment_2 == 'reset'}
{embed='/inc/forgot_password_reset' email='{exp:forgot_password:check_code code="{segment_3}" }' code="{segment_3}"}
{if:elseif segment_2 == 'reset_submit'}
{embed='/inc/forgot_password_reset' message='{exp:forgot_password:update_password code="<?=$_POST['code']?>" password="<?=$_POST['password']?>" }' }
{if:else}
{embed='/inc/forgot_password_form' }
{/if}
編集済みの記事を参照してください。 – MB34