<option value="WI">Wisconsin (WI)</option> <option value="WY">Wyoming (WY)</option> </optgroup> </select><br /> <label>ZIP/Postal Code:</label> <input type="text" name="POSTAL" size="10" id="postalcode" placeholder="#####" class="validates" onkeyup="zipValid()" value="<?php if (isset($_POST['POSTAL'])) { echo $zip; } ?> " <?php if (!validateZip($zip)) { echo $styleInvalid; } ?> /> <span class="formcheck" id="spanZip" ></span><br /> <label>Phone:</label> <input type="text" name="PHONE" size="17" id="phone" class="validates" placeholder="###-###-####" onkeyup="phoneValid()" value="<?php if (isset($_POST['PHONE'])) { echo $phone; } ?> "
function validateNewBuyerProfile($form) { if (checkEmpty($form['firstname'])) { $msg = str_replace('field', _LBL_FIRST_NAME, _ALRT_REQUIRED_FIELD); return $msg; } if (!checkEmpty($form['firstname']) && !checkLength($form['firstname'], 255)) { $msg = str_replace('%field%', _LBL_FIRST_NAME, _ALRT_CHECK_LENGTH); return $msg; } if (checkEmpty($form['lastname'])) { $msg = str_replace('field', _LBL_LAST_NAME, _ALRT_REQUIRED_FIELD); return $msg; } if (!checkEmpty($form['lastname']) && !checkLength($form['lastname'], 255)) { $msg = str_replace('%field%', _LBL_LAST_NAME, _ALRT_CHECK_LENGTH); return $msg; } /*if(checkEmpty($form['companyname'])) { $msg = str_replace('field',_LBL_COMPANY_NAME,_ALRT_REQUIRED_FIELD); return $msg; }*/ if (!checkEmpty($form['companyname']) && !checkLength($form['companyname'], 100)) { $msg = str_replace('%field%', _LBL_COMPANY_NAME, _ALRT_CHECK_LENGTH); return $msg; } if (checkEmpty($form['type_entertainment'])) { $msg = str_replace('field', _LBL_TYPE_OF_ENT, _ALRT_REQUIRED_FIELD); return $msg; } /*if(checkEmpty($form['contactname'])) { $msg = str_replace('field',_LBL_CON_PERSON,_ALRT_REQUIRED_FIELD); return $msg; }*/ if (!checkEmpty($form['phone']) && !checkLength($form['phone'], 20)) { $msg = str_replace('%field%', _LBL_PH_NO, _ALRT_CHECK_LENGTH); return $msg; } if (!checkEmpty($form['phone']) && !validatePhone($form['phone'])) { $msg = str_replace('%field%', _LBL_PH_NO, _ALRT_CHECK_PHONE); return $msg; } if (!checkEmpty($form['jobtitle']) && !checkLength($form['jobtitle'], 100)) { $msg = str_replace('%field%', _LBL_JOB_TITLE, _ALRT_CHECK_LENGTH); return $msg; } /*if(checkEmpty($form['yearfound'])) { $msg = str_replace('field',_LBL_YR_FOUNDED,_ALRT_REQUIRED_FIELD); return $msg; }*/ if (!checkEmpty($form['yearfound']) && !checkLength($form['yearfound'], 4)) { $msg = str_replace('%field%', 'Year Started', _ALRT_CHECK_LENGTH); return $msg; } if (!checkEmpty($form['yearfound']) && !checkValidYear($form['yearfound'])) { $msg = str_replace('field', 'Year Started', _ALRT_VALID_FIELD); return $msg; } if (!checkEmpty($form['fax']) && !checkLength($form['fax'], 20)) { $msg = str_replace('%field%', _LBL_FAX_NO, _ALRT_CHECK_LENGTH); return $msg; } if (!checkEmpty($form['fax']) && !validateFax($form['fax'])) { $msg = str_replace('%field%', _LBL_FAX_NO, _ALRT_CHECK_VALID); return $msg; } if (!checkEmpty($form['web']) && !checkLength($form['web'], 200)) { $msg = str_replace('%field%', _LBL_COMP_URL, _ALRT_CHECK_LENGTH); return $msg; } if (!checkEmpty($form['web']) && !validateURL($form['web'])) { $msg = str_replace('%field%', _LBL_COMP_URL, _ALRT_CHECK_URL); $show_tab_type = 'COMPANY_INFO'; return $msg; } if (checkEmpty($form['city'])) { $msg = str_replace('field', _CITY, _ALRT_REQUIRED_FIELD); return $msg; } if (!checkEmpty($form['city']) && !checkLength($form['city'], 80)) { $msg = str_replace('%field%', _CITY, _ALRT_CHECK_LENGTH); return $msg; } if (checkEmpty($form['state'])) { $msg = str_replace('field', _LBL_STATE, _ALRT_REQUIRED_FIELD); $show_tab_type = 'CONTACT_INFO'; return $msg; } if (!checkEmpty($form['state']) && !checkLength($form['state'], 80)) { $msg = str_replace('%field%', _LBL_STATE, _ALRT_CHECK_LENGTH); return $msg; } if (checkEmpty($form['zip'])) { $msg = str_replace('field', _LBL_ZIP_POSTALCODE, _ALRT_REQUIRED_FIELD); return $msg; } if (!checkEmpty($form['zip']) && !checkLength($form['zip'], 15)) { $msg = str_replace('%field%', _LBL_ZIP_POSTALCODE, _ALRT_CHECK_LENGTH); return $msg; } if (!checkEmpty($form['zip']) && !validateZip($form['zip'])) { $msg = str_replace('%field%', _LBL_ZIP_POSTALCODE, _ALRT_CHECK_ZIP); return $msg; } return true; }
function ProcessItem($formid, $fvalue, $params, $output_type) { global $TOOL_SHORT; $PASS_VALUE = "ok"; $FAIL_VALUE = "error"; global $VALIDATE_TEXT; $failed = false; $VALIDATE_TEXT = ""; // clear before doing the validation if (!validateRequired($fvalue) && !array_key_exists("required", $params)) { // blank and not required return ""; } // do the validation foreach ($params as $value) { if ($failed) { break; } $type = $value; if (strpos($value, ";") !== false) { // get the special rule type $type = substr($value, 0, strpos($value, ";")); } writeLog($TOOL_SHORT, "ajax", "validate:" . $type . ":" . $fvalue); if ($type == "required" || $type == "notblank") { if (!validateRequired($fvalue)) { $failed = true; } } else { if ($type == "email") { if (!validateEmail($fvalue)) { $failed = true; } } else { if ($type == "phone") { if (!validatePhone($fvalue)) { $failed = true; } } else { if ($type == "date") { if (!validateDate($fvalue)) { $failed = true; } } else { if ($type == "time") { if (!validateTime($fvalue)) { $failed = true; } } else { if ($type == "zip" || $type == "zipcode") { if (!validateZip($fvalue)) { $failed = true; } } else { if ($type == "nospaces" || $type == "password") { if (!validateNoSpaces($fvalue)) { $failed = true; } } else { if ($type == "alpha") { if (!validateAlpha($fvalue)) { $failed = true; } } else { if ($type == "alphanum") { if (!validateAlphaNumeric($fvalue)) { $failed = true; } } else { if ($type == "number") { if (!validateNumeric($fvalue)) { $failed = true; } } else { if ($type == "name") { if (!validateAlphaName($fvalue)) { $failed = true; } } else { if ($type == "namespaces") { if (!validateAlphaNameSpaces($fvalue)) { $failed = true; } } else { if ($type == "uniquesql") { // should be uniquesql;(columnname);(tablename);(tableid);(userid) $parts = split(';', $value); if (!validateUniqueSQL($parts[1], $parts[2], $fvalue, $parts[3], $parts[4])) { $VALIDATE_TEXT = $formid . " already used"; $failed = true; } } else { if ($type == "uniqueinstp") { // should be uniqueinstp;(value);($field);(idval) $parts = split(';', $value); if (!validateUniqueInst($fvalue, $parts[1], $parts[2])) { $VALIDATE_TEXT = $formid . " already used"; $failed = true; } } else { if ($type == "uniqueuserp") { // should be uniqueuserp;(value);($field);(idval) $parts = split(';', $value); if (!validateUniqueUser($fvalue, $parts[1], $parts[2])) { $VALIDATE_TEXT = $formid . " already used"; $failed = true; } } } } } } } } } } } } } } } } } if ($output_type == "ajax") { $status = $PASS_VALUE; if ($failed) { $status = $FAIL_VALUE; } $ajaxReturn = "{$status}|{$formid}|{$VALIDATE_TEXT}"; echo $ajaxReturn; writeLog($TOOL_SHORT, "ajax", "return={$ajaxReturn}"); } else { if ($output_type == "print") { if ($failed) { print $VALIDATE_TEXT . "<br>"; } } else { if ($output_type == "array") { if ($failed) { return $VALIDATE_TEXT; } } } } // defaults to "return" if ($failed) { return $VALIDATE_TEXT . "<br>"; } return ""; }
} if (validateName($firstName)) { //$x = true; if (validateName($lastName)) { // $x = true; if (validateEmail($email)) { // $y = true; if ($dob != "") { // $x = true; if ($address != "") { // $x = true; if ($city != "") { // $x = true; if (validateState($state)) { // $x = true; if (validateZip($zip)) { // $y = true; if (validatePhone($phone)) { // $y = true; if ($username != "") { // $x = true; if (validateGender($gender)) { // $x = true; if (validatePassword($password1, $password2)) { $_SESSION["fname"] = $firstName; $_SESSION["lname"] = $lastName; $_SESSION["add"] = $address; $_SESSION["cty"] = $city; $_SESSION["state"] = $state; $_SESSION["zip"] = $zip; $_SESSION["email"] = $email;