Esempio n. 1
1
 if (!preg_match("/^[0-9]{1}-[0-9]{2}-[0-9]{2}-[0-9a-zA-Z]{2}-[0-9]{3}\$/", $_POST["dr_no"])) {
     //DR NO. not like 1-15-09-MM-002
     $_SESSION["error_messages"][] = "Invalid DR-No.";
     $flag = 1;
 } else {
     if (check_drno($_POST["dr_no"]) === 0) {
         $_SESSION["error_messages"][] = "DR-No Not in database.";
         $flag = 1;
     } else {
         if (check_drno_approval($_POST["dr_no"]) === 0) {
             $_SESSION["error_messages"][] = "DR-No Already Approved.";
             $flag = 1;
         }
     }
 }
 if (!has_max_length($_POST["loc_mod"], 50) || !has_max_length($_POST["ref_drawing"], 50) || !has_max_length($_POST["reason_temp_chng"], 50) || !has_max_length($_POST["jumper_desc"], 50) || !has_max_length($_POST["remarks"], 50)) {
     //text fields with over 50 length data mustn't be allowed
     $_SESSION["error_messages"][] = "Text Fields Mustn't Have More Than 50 Characters.";
     $flag = 1;
 }
 if (!preg_match("/^[0-9]{1}\$/", $_POST["tag_unit"])) {
     $_SESSION["error_messages"][] = "Invalid Tag Unit.";
     $flag = 1;
 }
 if (!preg_match("/^[0-9]{1}\$/", $_POST["tag_subsys"])) {
     $_SESSION["error_messages"][] = "Invalid Tag Sub System.";
     $flag = 1;
 }
 if (!preg_match("/^[0-9a-zA-Z]{3}\$/", $_POST["tag_sys"])) {
     $_SESSION["error_messages"][] = "Invalid Tag System.";
     $flag = 1;
Esempio n. 2
0
function validate_max_length($field_with_max_length)
{
    foreach ($field_with_max_lngth as $field => $max) {
        $field = trim($_POST[$field]);
        if (!has_max_length($field, $max)) {
            $errors["{$field}"] = ucfirst($field) . " is too long";
        }
    }
}
Esempio n. 3
0
function validate_max_lengths($fields_with_max_lengths)
{
    global $errors;
    foreach ($fields_with_max_lengths as $field => $max) {
        $value = trim($_POST[$field]);
        if (!has_max_length($value, $max)) {
            $errors[$field] = fieldname_as_text($field) . " is to long";
        }
    }
}
Esempio n. 4
0
function validate_max_lengths($fields_max_length)
{
    global $errors;
    foreach ($fields_max_length as $field => $max) {
        $value = trim($_POST[$field]);
        if (!has_max_length($value, $max)) {
            $errors[$field] = ucfirst($field) . "is to long";
        }
    }
}
Esempio n. 5
0
 function validate_max_lengths($fields_with_max_lengths)
 {
     global $errors;
     // Using an assoc. array
     foreach ($fields_with_max_lengths as $field => $max) {
         $value = trim($_POST[$field]);
         if (!has_max_length($value, $max)) {
             $errors[$field] = ucfirst($field) . " is too long.<br />";
         }
     }
 }
function validate_max_lengths($fields_with_max_lengths)
{
    global $errors;
    // Expects an assoc. array
    foreach ($fields_with_max_lengths as $field => $max) {
        $value = trim($_POST[$field]);
        if (!has_max_length($value, $max)) {
            $errors[$field] = fieldname_as_text($field) . " is too long, must be less than {$max} characters";
        }
    }
}
Esempio n. 7
0
function validate_max_lengths($fields_with_max_length)
{
    global $errors;
    // Using an assoc array
    foreach ($fields_with_max_length as $field => $max) {
        $value = trim($_POST[$field]);
        if (!has_max_length($value, $max)) {
            $errors[$field] = fieldname_as_text($field) . " is too long.";
        }
    }
}
function validate_max_lengths($fields_with_max_length)
{
    // variable: is a assoc. array (dict, from python)
    global $errors;
    foreach ($fields_with_max_length as $field => $max) {
        $value = trim($_POST[$field]);
        if (!has_max_length($value, $max)) {
            $errors[$field] = fieldname_as_text($field) . " is too long";
        }
    }
}
Esempio n. 9
0
                 } else {
                     if ($image == 'card_6') {
                         $card_six = 'checked';
                         $pos = 5;
                     }
                 }
             }
         }
     }
 }
 // User input Errors
 $errors = array();
 if (!has_presence($greeting)) {
     $errors['greeting_blank'] = "Please provide a greeting for your E-Card.";
 }
 if (!has_max_length($greeting, 500)) {
     $errors['greeting'] = "Please limit your greeting to 500 characters.";
 }
 if (!has_presence($friendfirst)) {
     $errors['friendfirst_blank'] = "Please provide your friend's name.";
 }
 if (!has_presence($toemail)) {
     $errors['toemail_blank'] = "Please provide your friend's email address.";
 }
 if (!has_presence($firstname)) {
     $errors['firstname_blank'] = "Please provide your first name.";
 }
 if (!has_presence($fromemail)) {
     $errors['fromemail_blank'] = "Please provide your email address.";
 }
 if (!has_presence($image)) {
Esempio n. 10
0
function validate_max_lengths($fields_with_max_lengths, $warning_me = false)
{
    global $errors;
    global $warnings;
    // Expects an assoc. array
    foreach ($fields_with_max_lengths as $field => $max) {
        $value = trim($_POST[$field]);
        if (!has_max_length($value, $max)) {
            if ($warning_me) {
                $warnings[$field] = fieldname_as_text($field) . " is too long";
            } else {
                $errors[$field] = fieldname_as_text($field) . " is too long";
            }
        }
    }
}