function validation($newData) { $errors = array(); if (!isValidName($newData[2])) { $errors[] = 'Name is not valid, please try again.'; } if (filter_var($newData[3], FILTER_VALIDATE_EMAIL) === false) { $errors[] = 'Email address is not valid, please try again.'; } if (!isValidPhone($newData[5])) { $errors[] = "Phone number is not valid, please try again."; } if (filter_var($newData[6], FILTER_VALIDATE_URL) == false) { $errors[] = "Website is not valid, please try again."; } return $errors; }
$var = !$var; print '<tr ' . $bc[$var] . '><td colspan="2"> </td></tr>'; // Method $var = !$var; print '<tr ' . $bc[$var] . '><td>' . $langs->trans("MAIN_SMS_SENDMODE") . '</td><td>'; $text = $listofmethods[$conf->global->MAIN_SMS_SENDMODE]; if (empty($text)) { $text = $langs->trans("Undefined") . ' ' . img_warning(); } print $text; print '</td></tr>'; // From $var = !$var; print '<tr ' . $bc[$var] . '><td>' . $langs->trans("MAIN_MAIL_SMS_FROM", $langs->transnoentities("Undefined")) . '</td>'; print '<td>' . $conf->global->MAIN_MAIL_SMS_FROM; if (!empty($conf->global->MAIN_MAIL_SMS_FROM) && !isValidPhone($conf->global->MAIN_MAIL_SMS_FROM)) { print ' ' . img_warning($langs->trans("ErrorBadPhone")); } print '</td></tr>'; // Autocopy to /*$var=!$var; print '<tr '.$bc[$var].'><td>'.$langs->trans("MAIN_MAIL_AUTOCOPY_TO").'</td>'; print '<td>'.$conf->global->MAIN_MAIL_AUTOCOPY_TO; if (!empty($conf->global->MAIN_MAIL_AUTOCOPY_TO) && ! isValidEmail($conf->global->MAIN_MAIL_AUTOCOPY_TO)) print img_warning($langs->trans("ErrorBadEMail")); print '</td></tr>'; */ print '</table>'; // Boutons actions print '<div class="tabsAction">'; print '<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?action=edit">' . $langs->trans("Modify") . '</a>'; /*if ($conf->global->MAIN_SMS_SENDMODE != 'mail' || ! $linuxlike)
session_start(); include "includes/password.php"; include "includes/common.php"; include "includes/sendemail.php"; include "includes/register_include.php"; include "includes/config.php"; if (isset($_POST["Signup"])) { $error_message = ""; $mysqli = open_mysqli(); $username = transformPOST($_POST["email"]); $firstname = transformPOST($_POST["firstname"]); $lastname = transformPOST($_POST["lastname"]); $password = $_POST["password"]; $passwordConfirm = $_POST["password1"]; $phonenumber = transformPOST($_POST["phonenumber"]); $phonetest = isValidPhone($phonenumber); if (empty($username)) { $error_message .= 'You forgot your email. <br />'; } if (empty($password)) { $error_message .= 'You forgot your password. <br />'; } if (empty($passwordConfirm)) { $error_message .= 'You must confirm your password. <br />'; } if ($password != $passwordConfirm) { $error_message .= 'Passwords do not match. <br />'; } if (empty($firstname)) { $error_message .= 'You forgot your first name. <br />'; }
$website = filter_input(INPUT_POST, 'website'); $errors = array(); // Error Validation for each Input if (!isValidName($fullname)) { $errors[] = 'Name is not Valid'; } if (!isValidEmail($email)) { $errors[] = 'Email is not Valid'; } if (!isValidBirthday($birthday)) { $errors[] = 'birthday is not Valid'; } if (!isValidAddress($address)) { $errors[] = 'address is not Valid'; } if (!isValidPhone($phone)) { $errors[] = 'Phone Number is not Valid'; } if (!isValidWebsite($website)) { $errors[] = 'website is not Valid'; } // As long as no errors are trigger it will allow the the Funtion to Add the Information to the Database if (count($errors) == 0) { if (createContact($addressgroupid, $fullname, $email, $birthday, $address, $phone, $website)) { $results = 'Contact Added'; } else { $results = 'Contact was not Added'; } } } ?>
die('Connection error: (' . $connect->connect_errno . '): ' . $connect->connect_error); } ?> <body> <h1>Validation of Organization Addresses</h1> <?php $sql = "SELECT * FROM organization"; $result = $connect->query($sql) or die($connect->error); echo '<table border="1"><tr><th>Organization ID</th><th>Organization Name</th><th>Address</th><th>Phone</th></tr>'; while ($result2 = $result->fetch_array(MYSQLI_ASSOC)) { if (isValidOrgName($result2['org_name']) && isValidAddress($result2['org_street']) && isValidString($result2['org_state']) && isValidZIPCode($result2['org_zip']) && isValidPhone($result2['org_phone'])) { } else { echo '<tr><td>' . $result2['org_id'] . '</td><td>' . $result2['org_name'] . '<br>' . formatValid(isValidOrgName($result2['org_name'])) . '</td><td>' . $result2['org_street'] . ", " . $result2['org_city'] . ", " . $result2['org_state'] . " " . $result2['org_zip'] . '<br> Street:' . formatValid(isValidAddress($result2['org_street'])) . '<br>City: ' . formatValid(isValidString($result2['org_state'])) . '<br>ZIP:' . formatValid(isValidZIPCode($result2['org_zip'])) . '</td><td>' . $result2['org_phone'] . '<br>' . formatValid(isValidPhone($result2['org_phone'])) . '</td>'; echo '</tr>'; } } /* while ($result2 = $result->fetch_array(MYSQLI_ASSOC)) { echo '<tr><td>' . $result2['org_id'] . '</td><td>' . $result2['org_name'] . '<br>' . formatValid(isValidOrgName($result2['org_name'])) . '</td><td>' . $result2['org_street'] . ", " . $result2['org_city'] . ", " . $result2['org_state'] . " " . $result2['org_zip'] . '<br> Street:' . formatValid(isValidAddress($result2['org_street'])) . '<br>City: ' . formatValid(isValidString($result2['org_state'])) . '<br>ZIP:' . formatValid(isValidZIPCode($result2['org_zip'])) . '</td><td>' . $result2['org_phone'] . '<br>' . formatValid(isValidPhone($result2['org_phone'])) . '</td>'; echo '</tr>'; } */ echo '</table>'; ?> </body>
$var=!$var; print '<tr '.$bc[$var].'><td colspan="2"> </td></tr>'; // Method $var=!$var; print '<tr '.$bc[$var].'><td>'.$langs->trans("MAIN_SMS_SENDMODE").'</td><td>'; $text=$listofmethods[$conf->global->MAIN_SMS_SENDMODE]; if (empty($text)) $text=$langs->trans("Undefined").' '.img_warning(); print $text; print '</td></tr>'; // From $var=!$var; print '<tr '.$bc[$var].'><td>'.$langs->trans("MAIN_MAIL_SMS_FROM",$langs->transnoentities("Undefined")).'</td>'; print '<td>'.$conf->global->MAIN_MAIL_SMS_FROM; if (!empty($conf->global->MAIN_MAIL_SMS_FROM) && ! isValidPhone($conf->global->MAIN_MAIL_SMS_FROM)) print ' '.img_warning($langs->trans("ErrorBadPhone")); print '</td></tr>'; // Autocopy to /*$var=!$var; print '<tr '.$bc[$var].'><td>'.$langs->trans("MAIN_MAIL_AUTOCOPY_TO").'</td>'; print '<td>'.$conf->global->MAIN_MAIL_AUTOCOPY_TO; if (!empty($conf->global->MAIN_MAIL_AUTOCOPY_TO) && ! isValidEmail($conf->global->MAIN_MAIL_AUTOCOPY_TO)) print img_warning($langs->trans("ErrorBadEMail")); print '</td></tr>'; */ print '</table>'; // Boutons actions
{ $result = preg_replace("/\\D/", "", $phone); if (substr($result, 0, 1) == 1) { $result = substr($result, 1); } if (strlen($result) < 10) { return false; } else { return true; } } echo '<p><strong>Phone:</strong> '; if (trim($_POST['orgphone']) == "") { echo '<strong><font color="#ff0000">Please enter a contact phone number</font></strong>'; $errcount++; } elseif (isValidPhone($_POST['orgphone']) == false) { echo '<strong><font color="#ff0000">Please enter a valid phone number</font></strong>'; $errcount++; } else { echo stripslashes(htmlentities($_POST['orgphone'])); } echo '<p><strong>E-mail:</strong> '; if (trim($_POST['orgemail']) != trim($_POST['orgemailconf'])) { echo '<strong><font color="#ff0000">Please ensure that your e-mail address is correct in both fields</font></strong>'; $errcount++; } elseif (filter_var(trim($_POST['orgemail']), FILTER_VALIDATE_EMAIL) == FALSE) { echo '<strong><font color="#ff0000">Please enter a valid e-mail address</font></strong>'; $errcount++; } else { echo stripslashes(htmlentities($_POST['orgemail'])); }
function validateNewItem($newData) { $errors = array(); /* *0 user_id *1 address_group_id *2 fullname *3 email *4 address *5 phone *6 website *7 birthday - datetime *8 image - filename */ if (!isValidName($newData[2])) { $errors[] = 'Name is not valid, ensure name has no numbers or special characters.'; } if (filter_var($newData[3], FILTER_VALIDATE_EMAIL) === false) { $errors[] = 'Email address is not a valid email address'; } if (!isValidPhone($newData[5])) { $errors[] = "Phone number is not valid, please use format 999-999-9999"; } if (filter_var($newData[6], FILTER_VALIDATE_URL) == false) { $errors[] = "Website is not valid, please check the address and try again."; } return $errors; }