. # # # #################################################################################### //form page 2... session_start(); require_once('inc/config.inc.php'); require_once('lang/' . $CONFIG['lang'] . '/index.php'); if ($CONFIG['auth_set'] != 'none') { if (!isset($_SESSION['username'])) { header('Location: index.php'); } } require_once('inc/header.inc.php'); echo '

' . $LANG['p2_head'] . '

' . "\n"; if ($CONFIG['auth_set'] == 'ldap') { echo '

' . $LANG['logged_in'] . ' ' . $_SESSION['user_fn'] . ' ' . $_SESSION['user_sn'] . '. ' . $LANG['logout'] . '.

' . "\n"; } if (isset($_POST['stage2_set'])) { //form submitted - validate //set all post values from stage one into the session... foreach ($_POST as $key => $value) { $_SESSION[$key] = $value; } $num_rows_valid = 1; $check_iteration = 1; do { //define our variables so they can increase depending on the number of rows in the form... $code = 'code_' . $num_rows_valid; $descrip = 'descrip_' . $num_rows_valid; $quant = 'quant_' . $num_rows_valid; $cost = 'cost_' . $num_rows_valid; //Now we validate the rows in the order form... if ($_POST[$code] == '') { echo '

' . $LANG['p2_code_error'] . $num_rows_valid . '!

' . "\n"; } elseif ($_POST[$descrip] == '') { echo '

' . $LANG['p2_descrip_error'] . $num_rows_valid . '!

' . "\n"; } elseif ($_POST[$quant] == '') { echo '

' . $LANG['p2_quant_error'] . $num_rows_valid . '!

' . "\n"; } elseif (!is_numeric($_POST[$quant])) { echo '

' . $LANG['p2_quant_num'] . $num_rows_valid . '!

' . "\n"; } elseif ($_POST[$cost] == '') { echo '

' . $LANG['p2_cost_error'] . $num_rows_valid . '!

' . "\n"; } elseif (!is_numeric($_POST[$cost])) { echo '

' . $LANG['p2_cost_num'] . $num_rows_valid . '!

' . "\n"; } elseif ($_POST['shipping'] == '') { echo '

' . $LANG['p2_shipping_error'] . '

'; } elseif (!is_numeric($_POST['shipping'])) { echo '

' . $LANG['ps_shipping_num'] . '

'; } else { $check_iteration ++; } $num_rows_valid ++; } while ($_SESSION['anum_items'] >= $num_rows_valid); if ((($num_rows_valid - 1) == $_SESSION['anum_items']) && ($check_iteration == $num_rows_valid)) { /*echo '

num rows and sess items equal

'; echo '

sess: ' . $_SESSION['anum_items'] . '

'; echo '

num valid: ' . $num_rows_valid . '

'; echo '

check iteration: ' . $check_iteration . '

';*/ echo '

' . $LANG['p2_proceed'] . '.

' . "\n"; $form2_comp = TRUE; } } if (!isset($form2_comp)) { echo '

' . $LANG['p2_complete'] . '

' . "\n"; } ?>

' . "\n\t\t" . '' . "\n\t\t" . '' . "\n\t\t" . '' . "\n\t\t" . '' . "\n\t\t" . '' . "\n\t" . '' . "\n\t"; $num_rows ++; } while ($num_rows <= $_SESSION['anum_items']); ?>
' . $num_rows . '
/>