function isValidPhone($phone)
{
    $phone = stripPhone($phone);
    if ($phone > 1000000000 && $phone < 9999999999) {
        return true;
    } else {
        return false;
    }
}
示例#2
0
?>
<h1 class="cover-heading">Add New Item To Address Book</h1>

<br>


<?php 
$addressGroups = getAddressGroups();
$newAddressData = array();
if (isPostRequest()) {
    $newAddressData[0] = $_SESSION['currentUserID'];
    $newAddressData[1] = filter_input(INPUT_POST, 'selected_address_group');
    $newAddressData[2] = filter_input(INPUT_POST, 'fullname');
    $newAddressData[3] = filter_input(INPUT_POST, 'email');
    $newAddressData[4] = filter_input(INPUT_POST, 'address');
    $newAddressData[5] = formatPhone(stripPhone(filter_input(INPUT_POST, 'phone')));
    $newAddressData[6] = filter_input(INPUT_POST, 'website');
    $newAddressData[7] = filter_input(INPUT_POST, 'birthday');
    $errors = validation($newAddressData);
    if (count($errors) == 0) {
        $newAddressData[8] = uploadImage();
        if (empty($newAddressData[8])) {
            $errors[] = 'Image could not be uploaded';
            $results = 'Empty Image';
        }
        if (createContact($newAddressData)) {
            $results = 'New item added to address book';
        } else {
            $results = 'Item was not Added';
        }
    } else {