function FixUpWid($input) { global $error_msg; if (empty($input)) { $error_msg = "Missing Input. Try again."; return false; } $wid = trim(strtoupper($input)); if (strlen($wid) <= 0) { $error_msg = "Missing Input. Try again."; return false; } if (substr($wid, 0, 1) == "W") { $wid = substr($wid, 1); } if (strlen($wid) <= 0) { $error_msg = "Missing Input. Try again."; return false; } if (!checkdigits($wid)) { $error_msg = "The input seems to be in the wrong format. Use only numeric digits."; return false; } if ($wid < 0 || $wid > 9999) { $error_msg = "Input out of range. Allowable range is from 0 to 9999."; return false; } $wo = GetWO(intval($wid)); if (!$wo) { $error_msg = "Work Order W" . intval($wid) . ' not found.'; return false; } return $wo; }
} if ($_SERVER["REQUEST_METHOD"] == "POST") { $wid = $_POST["WID"]; $wid = trim(strtoupper($wid)); if (strlen($wid) <= 0) { $error_msg = "Nothing Input. Try again."; goto GenerateHtml; } if (substr($wid, 0, 1) == "W") { $wid = substr($wid, 1); } if (strlen($wid) <= 0) { $error_msg = "Nothing Input. Try again."; goto GenerateHtml; } if (!checkdigits($wid)) { $error_msg = "The input seems to be in the wrong format. Use only numeric digits."; $d["WID"] = $wid; PopulateParamList($param_list, $d); goto GenerateHtml; } if ($wid < 0 || $wid > 9999) { $error_msg = "Input out of range. Allowable range is from 0 to 9999."; $d["WID"] = $wid; PopulateParamList($param_list, $d); goto GenerateHtml; } $wo = GetWO(intval($wid), true); if (!$wo) { $widstr = sprintf("W%04d", intval($wid)); $error_msg = "Work Order " . $widstr . ' not found.';