249
seCure Forms And ACCount regIstrAtIon
so that certain identification and validation patterns stand out. If these repetitive
patterns are noticeable and new ideas for abstraction and elimination are formulated,
then the code has done its job of raising awareness.
<?php
require("../../mobileinc/globalCONST.php");
require(SOURCEPATH."required.php");
$formFields = array('username', 'passwordOrig',
'passwordConfirm', 'email');
$formErrors = array();
$allFields = true;
//first, test for presence of valid form key,
//on error will redirect
//to secure login page with new key and exit
$nonceTracker->processFormNonce();
//iterate $_POST and check
//that each required field is present and has value
foreach ($formFields as $index = > $field)
{
if(!array_key_exists ...