if(empty($email)){ $errorMsg[]="Please enter your Email"; $emailERROR = true; } else { $valid = verifyEmail ($email); /* test for non-valid email */ if (!$valid){ $errorMsg[]="Email must be valid"; $emailERROR = true; } } if(empty($credit)){ $errorMsg[]="Please enter your credit card"; $creditERROR = true; } else { $valid = verifyAlphaNum ($credit); /* test for non-valid email */ if (!$valid){ $errorMsg[]="Credit card must be valid"; $creditERROR = true; } } //####################################################### // we are going to put our forms data into this array so we can save it // CHANGES NEEDED make sure the variable matches yours above $dataRecord[]=$firstName; $dataRecord[]=$lastName; $dataRecord[]=$email;
$addressERROR = true; } elseif (!verifyAlphaNum($address)) { $errorMsg[] = "Your address appears to be incorrect."; $addressERROR = true; } if ($netId == "") { $errorMsg[] = "Please enter your net ID"; $idERROR = true; } elseif (!verifyAlphaNum($netId)) { $errorMsg[] = "Your net ID appears to be incorrect."; $idERROR = true; } if ($phone == "") { $errorMsg[] = "Please enter your net ID"; $phoneERROR = true; } elseif (!verifyAlphaNum($phone)) { $errorMsg[] = "Your phone number appears to be incorrect."; $phoneERROR = true; } if (!$errorMsg) { if ($debug) { print "<p>Form is valid</p>"; } $query = "INSERT INTO tblCustomer " . "(pmkCustomerId, fldFirstName, fldLastName, fldEmail, fldAddress, fldPhone, fldType) VALUES " . "(?, ?, ?, ?, ?, ?, '" . $checkRecord . "')"; $results = $thisDatabaseWriter->insert($query, $dataRecord, 0, 0, 2, 0, false, false); $message = '<h2>Your Information:</h2>'; $message_admin = '<h2>Customer Information:</h2>'; foreach ($_POST as $key => $value) { if ($key != "btnSubmit") { $message .= "<p>"; $message_admin .= "<p>";
$lastNameERROR = true; } elseif (!verifyAlphaNum($lastName)) { $errorMsg[] = "Your last name appears to have extra character."; $firstNameERROR = true; } if ($email == "") { $errorMsg[] = "Please enter your email address"; $emailERROR = true; } elseif (!verifyEmail($email)) { $errorMsg[] = "The email address you entered appears to be incorrect."; $emailERROR = true; } if ($netID == "") { $errorMsg[] = "Please enter your address"; $netIDERROR = true; } elseif (!verifyAlphaNum($netID)) { $errorMsg[] = "Your netID appears to have extra character."; $netIDERROR = true; } //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // // SECTION: 2d Process Form - Passed Validation // // Process for when the form passes validation (the errorMsg array is empty) // if (!$errorMsg) { if ($debug) { print "<p>Form is valid</p>"; } //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ //
// SECTION: 2c Validation if ($activity == "(Choose One)") { $errorMsg[] = "Please select an activity"; $activityERROR = true; } if ($title == "") { $errorMsg[] = "Please enter a title."; $titleERROR = true; } elseif (!verifyAlphaNum($title)) { $errorMsg[] = "Title includes unknown values."; $titleERROR = true; } if ($maxParticipants == 0) { $errorMsg[] = "Please increase the number of participants."; $maxParticipantsERROR = true; } elseif (!verifyAlphaNum($maxParticipants)) { $errorMsg[] = "nice try..."; $maxParticipantsERROR = true; } if ($description == "") { $errorMsg[] = "Please enter add a description."; $descriptionERROR = true; } //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // SECTION: 2d Process Form - Passed Validation // Process for when the form passes validation (the errorMsg array is empty) if (!$errorMsg) { if ($debug) { print "<p>Form is valid</p>"; } //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
$data1[] = $chords; //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // // SECTION: 2c Validation // if ($songName == "") { $errorMsg[] = "Please enter your first name"; $songNameERROR = true; } elseif (!verifyAlphaNum($songName)) { $errorMsg[] = "Your Song name appears to have extra character(s)."; $songNameERROR = true; } if ($artistName == "") { $errorMsg[] = "Please enter the Artist's name"; $artistNameERROR = true; } elseif (!verifyAlphaNum($artistName)) { $errorMsg[] = "Artist name appears to have an extra character."; $artistNameERROR = true; } if ($tab == "") { $errorMsg[] = "Please enter the tab link"; $tabERROR = true; } if ($youTube == "") { $errorMsg[] = "Please enter the songs youtube link"; $youTubeERROR = true; } // should check to make sure its the correct date format if ($chords == "") { $errorMsg[] = "Please enter chords separated by ,"; $youTubeERROR = true;
<?php if ($firstName == "") { $errorMsg[] = "Please enter your first name"; $firstNameERROR = true; } elseif (!verifyAlphaNum($firstName)) { $errorMsg[] = "Your first name appears to have extra character."; $firstNameERROR = true; } if ($lastName == "") { $errorMsg[] = "Please enter your last name"; $lastNameERROR = true; } elseif (!verifyAlphaNum($lastName)) { $errorMsg[] = "Your last name appears to have an extra character."; $lastNameERROR = true; } if ($email == "") { $errorMsg[] = "Please enter your uvm affliated email address"; $emailERROR = true; } elseif (!verifyEmail($email)) { $errorMsg[] = "Your email address appears to be incorrect."; $emailERROR = true; } if ($height == "") { $errorMsg[] = "Please enter your height (in numeric inches)"; $heightERROR = true; } elseif (!verifyNumeric($height)) { $errorMsg[] = "Your height appears to be incorrect. Make sure it is in numeric inches"; $heightERROR = true; } ?>
} elseif (!verifyAlphaNum($StudentNetId)) { $errorMsg[] = "Your Net ID appears to have extra character."; $StudentNetIdERROR = true; } if ($ProjectName == "") { $errorMsg[] = "Please enter your project name"; $ProjectNameERROR = true; } elseif (!verifyAlphaNum($ProjectName)) { $errorMsg[] = "Your project name appears to have extra character."; $ProjectNameERROR = true; } //project due date not required--set default if ($CourseName == "") { $errorMsg[] = "Please enter your Course name"; $CourseNameERROR = true; } elseif (!verifyAlphaNum($CourseName)) { $errorMsg[] = "Your course name appears to have extra character."; $CourseNameERROR = true; } //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // // SECTION: 2d Process Form - Passed Validation // // Process for when the form passes validation (the errorMsg array is empty) // $dataEntered = false; try { $thisDatabase->db->beginTransaction(); if ($ProjectId != "") { $query = 'UPDATE tblProjects SET '; $query .= 'pmkProjectId = ? , ';
$stateERROR = true; } elseif (!verifyAlphaNum($state)) { $errorMsg[] = "Your state appears to have extra character."; $stateERROR = true; } if ($province == "") { $errorMsg[] = "Please enter your province"; $provinceERROR = true; } elseif (!verifyAlphaNum($lastName)) { $errorMsg[] = "Your province appears to have extra character."; $provinceERROR = true; } if ($country == "") { $errorMsg[] = "Please enter your country"; $countryERROR = true; } elseif (!verifyAlphaNum($country)) { $errorMsg[] = "Your country appears to have extra character."; $countryERROR = true; } if ($email == "") { $errorMsg[] = "Please enter your email address"; $emailERROR = true; } elseif (!verifyEmail($email)) { $errorMsg[] = "Your email address appears to be incorrect."; $emailERROR = true; } //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // // SECTION: 2e. // // // Process for when the form passes validation (the errorMsg array is empty)
if ($location != "" and !verifyAlphaNum($location)) { $errorMsg[] = "The location info appears to contain invalid characters."; $locationError = true; } // cost field can be blank if ($cost != "" and !verifyNumeric($cost)) { $errorMsg[] = "The cost must be a number."; $costError = true; } // URL field can be blank if ($url != "" and !filter_var($url, FILTER_VALIDATE_URL)) { $errorMsg[] = "The URL you've provided is invalid."; $urlError = true; } // Description field can be blank if ($comments != "" and !verifyAlphaNum($comments)) { $errorMsg[] = "Your comments contain invalid characters."; $commentsError = true; } // %^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^% // // SECTION 2d: Process form - passed validation (errorMsg is empty) if (!$errorMsg) { if ($debug) { print "<p>Form is valid.</p>"; } // %^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^% // // SECTION 2e: Save data: Insert data into database // Check if town is already in towns table $townSelectQuery = "SELECT pmkTownId";
// form. Note it is best to follow the same order as declared in section 1c. $pmkTopicId = (int) htmlentities($_POST["hidTopicId"], ENT_QUOTES, "UTF-8"); if ($pmkTopicId > 0) { $update = true; } // I am not putting the ID in the $data array at this time $Topic = htmlentities($_POST["txtTopic"], ENT_QUOTES, "UTF-8"); $data[] = $ForumName; //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // // SECTION: 2c Validation // if ($Topic == "") { $errorMsg[] = "Please enter your topic"; $firstNameERROR = true; } elseif (!verifyAlphaNum($Topic)) { $errorMsg[] = "Your first name appears to have extra character."; $TopicERROR = true; } //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // // SECTION: 2d Process Form - Passed Validation // // Process for when the form passes validation (the errorMsg array is empty) // if (!$errorMsg) { if ($debug) { print "<p>Form is valid</p>"; } //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ //
$email; $message; if (@$_POST['submitted']) { //create vars from user input $name = @$_POST['name']; $email = @$_POST['email']; $message = @$_POST['message']; // if magic quotes on, remove Magic Quotes effect if (get_magic_quotes_gpc()) { $name = stripslashes($name); $email = stripslashes($email); $message = stripslashes($message); } //Validate user input. Create error array to store errors $error_msg = array(); $valid = verifyAlphaNum($name, 'Write your name here.'); if (!$valid) { $error_msg[] = 'Please provide a valid name.'; $name_error = '<span class="error">Name must be letters, numbers, spaces, and dashes only.</span>'; } $valid = verifyEmail($email, 'Write your email address'); if (!$valid) { $error_msg[] = 'Please provide a valid email address.'; $email_error = '<span class="error">Email must be a valid format (e.g. john@yahoo.com).</span>'; } $message = cleanText($message); if ($message == 'Write your message here.') { $error_msg[] = 'Please provide a valid message.'; $message_error = "<span class=\"error\">Message can only contain letters, numbers and basic punctuation \" ' - ? ! </span>"; } // if no errors, send email
$emailERROR = true; } elseif (!verifyAlphaNum($state)) { $errorMsg[] = "Your state's name appears to be incorrect."; $emailERROR = true; } if ($zip == "") { $errorMsg[] = "Please enter your zip code"; $emailERROR = true; } elseif (!verifyAlphaNum($zip)) { $errorMsg[] = "Your zip code appears to be incorrect."; $emailERROR = true; } if ($budget == "") { $errorMsg[] = "Please enter your budget"; $emailERROR = true; } elseif (!verifyAlphaNum($budget)) { $errorMsg[] = "Your budget appears to be incorrect."; $emailERROR = true; } // // // //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // // SECTION: 2d Process Form - Passed Validation // if (!$errorMsg) { if ($debug) { print "<p>Form is valid</p>"; } //
$studentNetIdError = true; } elseif (!verifyAlphaNum($studentNetId)) { $errorMsg[] = "Your net ID appears to have extra character."; $studentNetIdError = true; } if ($studentEmail == "") { $errorMsg[] = "Please enter your email address"; $emailERROR = true; } elseif (!verifyEmail($studentEmail)) { $errorMsg[] = "Your email address appears to be incorrect."; $emailERROR = true; } if ($advisorNetId == "") { $errorMsg[] = "Please enter your advisor's net ID"; $advisorNetIdError = true; } elseif (!verifyAlphaNum($advisorNetId)) { $errorMsg[] = "Their net ID appears to have extra character."; $advisorNetIdError = true; } if ($catalogYear == "select") { $errorMsg[] = "Please choose the catalog year"; $catalogYearError = true; } if ($major == "select") { $errorMsg[] = "Please choose your major"; $majorError = true; } if ($minor == "select") { $errorMsg[] = "Please choose your minor"; $minorError = true; }
$fldCity = filter_var($_POST["txtFldCity"], FILTER_SANITIZE_EMAIL); $dataRecord[] = $fldCity; //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // // SECTION: 2c Validation // // Validation section. Check each value for possible errors, empty or // not what we expect. You will need an IF block for each element you will // check (see above section 1c and 1d). The if blocks should also be in the // order that the elements appear on your form so that the error messages // will be in the order they appear. errorMsg will be displayed on the form // see section 3b. The error flag ($emailERROR) will be used in section 3c. if ($userID == "") { $errorMsg[] = "Please enter a User ID"; $firstNameERROR = true; } elseif (!verifyAlphaNum($userID)) { $errorMsg[] = "Your User ID appears to contain a non-alphanumerical character."; $firstNameERROR = true; } if ($fldEmail == "") { $errorMsg[] = "Please enter your email"; $emailERROR = true; } elseif (!verifyEmail($fldEmail)) { $errorMsg[] = "Incorrect email address"; $emailERROR = true; } //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // // SECTION: 2d Process Form - Passed Validation // // Process for when the form passes validation (the errorMsg array is empty)
if (empty($Password)) { $errorMsg[] = "Please enter your Password"; $PasswordERROR = true; } else { $valid = verifyPass($Password); /* test for non-valid data */ if (!$valid) { $errorMsg[] = "I'm sorry, the username you entered is not valid."; $PasswordERROR = true; } } if (empty($AccessToken)) { $errorMsg[] = "Please enter your Access Token"; $AccessTokenERROR = true; } else { $valid = verifyAlphaNum($AccessToken); /* test for non-valid data */ if (!$valid) { $errorMsg[] = "I'm sorry, the Access token you entered is not valid."; $AccessTokenERROR = true; } } //############################################################################ // // Processing the Data of the form // if (!$errorMsg) { if ($debug) { print "<p>Form is valid</p>"; } //############################################################################
$minor = htmlentities($_POST['lstMinor'], ENT_QUOTES, "UTF-8"); $dataRecord[] = $minor; // %^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^% // // SECTION 2c: Validation: Check each value for possible errors or empty. if ($studentID == "") { $errorMsg[] = "Please enter the student's NetID."; $studentIDError = true; } elseif (!verifyAlphaNum($studentID)) { $errorMsg[] = "Student NetID appears to include invalid charaters."; $studentIDError = true; } if ($advisorID == "") { $errorMsg[] = "Please enter the advisor's NetID."; $advisorIDError = true; } elseif (!verifyAlphaNum($advisorID)) { $errorMsg[] = "Advisor NetID appears to include invalid charaters."; $advisorIDError = true; } // %^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^% // // SECTION 2d: Process form - passed validation (errorMsg is empty) if (!$errorMsg) { if ($debug) { print "<p>Form is valid.</p>"; } // %^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^% // // SECTION 2e: Save data: Insert data into database // Add insert method $query = "INSERT INTO tblFourYearPlans(fnkStudentNetId, fnkAdvisorNetId, fldCatalogYear, fldMajor, fldMinor) VALUES (?, ?, ?, ?, ?)";
$emailERROR = true; } elseif (!verifyEmail($email)) { $errorMsg[] = "Your email appears to have extra character."; $emailERROR = true; } if ($title == "") { $errorMsg[] = "Please enter the title"; $titleERROR = true; } elseif (!verifyAlphaNum($title)) { $errorMsg[] = "Title appears to have extra character."; $titleERROR = true; } if ($content == "") { $errorMsg[] = "Please enter Content"; $contentERROR = true; } elseif (!verifyAlphaNum($content)) { $errorMsg[] = "The content appears to have extra character."; $contentERROR = true; } //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // // SECTION: 2d Process Form - Passed Validation // // Process for when the form passes validation (the errorMsg array is empty) // if (!$errorMsg) { if ($debug) { print "<p>Form is valid</p>"; } //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ //
$emailERROR = true; } elseif (!verifyAlphaNum($city)) { $errorMsg[] = "Your city's name appears to be incorrect."; $emailERROR = true; } if ($state == "") { $errorMsg[] = "Please enter your state"; $emailERROR = true; } elseif (!verifyAlphaNum($state)) { $errorMsg[] = "Your state's name appears to be incorrect."; $emailERROR = true; } if ($zip == "") { $errorMsg[] = "Please enter your zip code"; $emailERROR = true; } elseif (!verifyAlphaNum($zip)) { $errorMsg[] = "Your zip code appears to be incorrect."; $emailERROR = true; } // // // //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // // SECTION: 2d Process Form - Passed Validation // if (!$errorMsg) { if ($debug) { print "<p>Form is valid</p>"; } //
$email = filter_var($_POST["txtEmail"], FILTER_SANITIZE_EMAIL); $dataRecord[] = $email; //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // // SECTION: 2c Validation // // Validation section. Check each value for possible errors, empty or // not what we expect. You will need an IF block for each element you will // check (see above section 1c and 1d). The if blocks should also be in the // order that the elements appear on your form so that the error messages // will be in the order they appear. errorMsg will be displayed on the form // see section 3b. The error flag ($emailERROR) will be used in section 3c. if ($firstName == "") { $errorMsg[] = "Please enter your first name"; $firstNameERROR = true; } elseif (!verifyAlphaNum($firstName)) { $errorMsg[] = "Your first name appears to have extra character."; $firstNameERROR = true; } if ($email == "") { $errorMsg[] = "Please enter your email address"; $emailERROR = true; } elseif (!verifyEmail($email)) { $errorMsg[] = "Your email address appears to be incorrect."; $emailERROR = true; } //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // // SECTION: 2d Process Form - Passed Validation // // Process for when the form passes validation (the errorMsg array is empty)
$lastNameERROR = true; } elseif (!verifyAlphaNum($lastName)) { $errorMsg[] = "Your last name appears to have extra character."; $lastNameERROR = true; } if ($email == "") { $errorMsg[] = "Please enter your email"; $emailERROR = true; } elseif (!verifyEmail($email)) { $errorMsg[] = "Your email appears to have extra character."; $emailERROR = true; } if ($username == "") { $errorMsg[] = "Please enter your username"; $usernameERROR = true; } elseif (!verifyAlphaNum($username)) { $errorMsg[] = "Your first name appears to have extra character."; $usernameERROR = true; } } // if ($title == "") { // $errorMsg[] = "Please enter the title"; // $titleERROR = true; // } elseif (!verifyAlphaNum($title)) { // $errorMsg[] = "Title appears to have extra character."; // $titleERROR = true; // } // // if ($desc == "") { // $errorMsg[] = "Please enter the description"; // $descERROR = true;
$Complete = htmlentities($_POST["lstComplete"], ENT_QUOTES, "UTF-8"); $dataRecord[] = $Complete; //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // // SECTION: 2c Validation // // Validation section. Check each value for possible errors, empty or // not what we expect. You will need an IF block for each element you will // check (see above section 1c and 1d). The if blocks should also be in the // order that the elements appear on your form so that the error messages // will be in the order they appear. errorMsg will be displayed on the form // see section 3b. The error flag ($emailERROR) will be used in section 3c. if ($TaskName == "") { $errorMsg[] = "Please enter your task name"; $TaskNameERROR = true; } elseif (!verifyAlphaNum($TaskName)) { $errorMsg[] = "Your task name appears to have extra character."; $TaskNameERROR = true; } //task due date not required--set default //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // // SECTION: 2d Process Form - Passed Validation // // Process for when the form passes validation (the errorMsg array is empty) // $dataEntered = false; try { $thisDatabase->db->beginTransaction(); $query = 'INSERT INTO tblTasks SET '; $query .= 'fnkStudentNetId = ? , ';
$fldLastNameERROR = true; } elseif (!verifyAlphaNum($fldLastName)) { $errorMsg[] = "Your last name appears to have extra character."; $fldLastNameERROR = true; } if ($fldTitle == "") { $errorMsg[] = "Please enter the title of the book"; $fldTitleERROR = true; } elseif (!verifyAlphaNum($fldTitle)) { $errorMsg[] = "Your title appears to have extra character."; $fldTitleERROR = true; } if ($fldAuthor == "") { $errorMsg[] = "Please enter the author"; $fldAuthorERROR = true; } elseif (!verifyAlphaNum($fldAuthor)) { $errorMsg[] = "Your author appears to have extra character."; $fldAuthorERROR = true; } if ($fldGenre == "") { $errorMsg[] = "Please enter the genre"; $fldGenreERROR = true; } if ($fldDescription == "") { $errorMsg[] = "Please enter your review of the book"; $fldDescriptionERROR = true; } $messageA = '<h2>Thank you for registering.</h2>'; // //// should check to make sure its the correct date format //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
} } else { if ($validationType == 2) { if (!in_array($ext, $imageExtensionsAllowed)) { $exts = implode(', ', $imageExtensionsAllowed); $errorMsg[] = "You must upload a file with one of the following extensions: " . $exts; $uploadError = true; } $extension = $ext; } } // %^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^% if ($photoCaption == "") { $errorMsg[] = "The photo caption can not be empty."; $captionError = true; } elseif (!verifyAlphaNum($photoCaption)) { $errorMsg[] = "The name you've provided for the activity contains invalid characters."; $captionError = true; } // SECTION 2d: Process form - passed validation (errorMsg is empty) if (!$errorMsg) { if ($debug) { print "<p>Form is valid.</p>"; } // %^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^% // // SECTION 2e: Save data: Insert data into database // and upload the file to the 'uploads' directory // %^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^%^% // Rename the fileName!!! Query to find a unique name: // activityId#_numphotos $activityID
$emailERROR = true; } elseif (!verifyEmail($email)) { $errorMsg[] = "Your email address appears to be incorrect."; $emailERROR = true; } if ($district == "") { $errorMsg[] = "Please enter your district"; $districtERROR = true; } elseif (!verifyAlphaNum($district)) { $errorMsg[] = "Your district appears to be incorrect."; $districtERROR = true; } if ($school == "") { $errorMsg[] = "Please enter your school"; $schoolERROR = true; } elseif (!verifyAlphaNum($school)) { $errorMsg[] = "Your school appears to be incorrect."; $schoolERROR = true; } //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // // SECTION: 2d Process Form - Passed Validation // // Process for when the form passes validation (the errorMsg array is empty) // if (!$errorMsg) { if ($debug) { print "<p>Form is valid</p>"; } //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ //