// Purpose: Check if there's a selected value for post data for the argument specified, return it if so // Expects: String (post argument name) // Returns: nothing, or HTML string function formCheckSelected($postName, $valueName) { if ($_POST[$postName]) { foreach ($_POST[$postName] as $value) { if ($value == $valueName) { return 'selected="selected"'; } } } } // data verification to reduce form misuse and cut down on spam foreach ($_POST as $key => $value) { formValidate(stripslashes($value)); } $errors = false; // check if we're missing required fields foreach ($formFields as $field => $data) { if ($data["required"]) { if (!$_POST[$field]) { $errors = "Required fields are missing."; } } } if (!$errors) { // set sender email address if ($_POST["email"]) { $fromemail = "From: " . $_POST["email"]; } else {
<?php /*--------------------------------sprocketr.php------------------------------------------------ the first of two "phases" of generating a sprocket, this page allows the user to input the desired characteristics of the sprocket, including "advanced settings" */ /* let's ignore that pedantic interpreter.... ini_set('display_errors',1); ini_set('display_startup_errors',1); error_reporting(E_ALL);*/ // include the files with form calls and blender calls include '/var/www-chapresearch/wp-content/themes/accesspress-lite/sprocketr-form.php'; include '/var/www-chapresearch/wp-content/themes/accesspress-lite/blenderCalls.php'; if (array_key_exists('sprocketrForm', $_GET)) { $params = $_GET; // makes sure we don't edit the $_GET array! $badFields = formValidate(&$params); // return names of all fields that are "bad" (and edits data) // execute python script for blender on server if no errors in field info if (count($badFields) == 0) { array_pop($params); // remove the hidden fields array_pop($params); $_SESSION["user_params"] = $params; echo '<h1 style="text-align:center"><br><br><br><br><br>Calculating...</h1>'; if ($_GET["page_id"] == PAGE_1) { // on original page 1 echo "<script>window.location = 'http://chapresearch.com/?page_id=" . PAGE_2 . "'</script>"; } else { if ($_GET["page_id"] == PAGE_1_ALT) { // on alternate page 1 echo "<script>window.location = 'http://chapresearch.com/?page_id=" . PAGE_2_ALT . "'</script>";