Пример #1
0
     print "    <p class=\"error\">" . get_vocab("passwords_not_eq") . "</p>\n";
     print "    <input type=\"submit\" value=\" " . get_vocab("ok") . " \">\n";
     print "  </fieldset>\n";
     print "</form>\n";
     // Print footer and exit
     print_footer(TRUE);
 }
 //
 // Verify email adresses
 $email_var = get_form_var('Field_email', 'string');
 // Truncate the email field to the maximum length as a precaution.
 $email_var = substr($email_var, 0, $maxlength['users.email']);
 if (!isset($email_var)) {
     $email_var = '';
 }
 if (!validate_email_list($email_var)) {
     // Now display this form again with an error message
     Header("Location: edit_users.php?Action=Edit&Id={$Id}&invalid_email=1");
     exit;
 }
 //
 // Check that the name is not empty
 $new_name = strtolower(get_form_var('Field_name', 'string'));
 if (empty($new_name)) {
     // Now display this form again with an error message
     // Build the query string
     $q_string = "Action=" . ($Id >= 0 ? 'Edit' : 'Add');
     $q_string .= "&Id={$Id}&name_empty=1";
     Header("Location: edit_users.php?{$q_string}");
     exit;
 }
                 $valid_data = FALSE;
                 $q_string .= "&pwd_not_match=1";
             }
             // check that the password conforms to the password policy
             // if it's a new user (Id < 0), or else it's an existing user
             // trying to change their password
             if ($Id < 0 || !empty($password0)) {
                 if (!validate_password($password0)) {
                     $valid_data = FALSE;
                     $q_string .= "&pwd_invalid=1";
                 }
             }
             break;
         case 'email':
             // check that the email address is valid
             if (!empty($value) && !validate_email_list($value)) {
                 $valid_data = FALSE;
                 $q_string .= "&invalid_email=1";
             }
             break;
     }
 }
 // if validation failed, go back to this page with the query
 // string, which by now has both the error codes and the original
 // form values
 if (!$valid_data) {
     Header("Location: edit_users.php?{$q_string}");
     exit;
 }
 // If we got here, then we've passed validation and we need to
 // enter the data into the database
             Header("Location: admin.php?day={$day}&month={$month}&year={$year}&area={$new_area}");
             exit;
         }
         // Release the mutex
         sql_mutex_unlock("{$tbl_area}");
     }
 }
 // PHASE 2 (AREA) - UPDATE THE DATABASE
 // ------------------------------------
 if (isset($change_area) && !empty($area)) {
     // clean up the address list replacing newlines by commas and removing duplicates
     $area_admin_email = clean_address_list($area_admin_email);
     // put a space after each comma so that the list displays better
     $area_admin_email = str_replace(',', ', ', $area_admin_email);
     // validate email addresses
     $valid_email = validate_email_list($area_admin_email);
     // Tidy up the input from the form
     if (isset($area_eveningends_t)) {
         // if we've been given a time in minutes rather than hours and minutes, convert it
         // (this will happen if JavaScript is enabled)
         $area_eveningends_minutes = $area_eveningends_t % 60;
         $area_eveningends = ($area_eveningends_t - $area_eveningends_minutes) / 60;
     }
     if (!empty($area_morning_ampm)) {
         if ($area_morning_ampm == "pm" && $area_morningstarts < 12) {
             $area_morningstarts += 12;
         }
         if ($area_morning_ampm == "am" && $area_morningstarts > 11) {
             $area_morningstarts -= 12;
         }
     }
Пример #4
0
                 $valid_data = FALSE;
                 $q_string .= "&pwd_not_match=1";
             }
             // check that the password conforms to the password policy
             // if it's a new user (Id < 0), or else it's an existing user
             // trying to change their password
             if ($Id < 0 || !empty($password0)) {
                 if (!validate_password($password0)) {
                     $valid_data = FALSE;
                     $q_string .= "&pwd_invalid=1";
                 }
             }
             break;
         case 'email':
             // check that the email address is valid
             if (isset($value) && $value !== '' && !validate_email_list($value)) {
                 $valid_data = FALSE;
                 $q_string .= "&invalid_email=1";
             }
             break;
     }
 }
 // if validation failed, go back to this page with the query
 // string, which by now has both the error codes and the original
 // form values
 if (!$valid_data) {
     Header("Location: edit_users.php?{$q_string}");
     exit;
 }
 // If we got here, then we've passed validation and we need to
 // enter the data into the database