if (empty($addressLine1) || !preg_match($nameRegex, $addressLine1)) { $errors[] = 'Your Address is Empty or in the wrong format'; } if (empty($city) || !preg_match($nameRegex, $city)) { $errors[] = 'City Must be Filled In and must be in the correct format'; } if (empty($state) || !preg_match($stateRegex, $state)) { $errors[] = 'State cannot be Empty and must be in the correct format'; } if (empty($zip) || !preg_match($zipRegex, $zip)) { $errors[] = 'Zip is Empty or Not in the Correct Format'; } if (empty($birthday)) { $errors[] = 'Birthday Cannot be Empty'; } if (count($errors) == 0 && addAddress($fullName, $email, $addressLine1, $city, $state, $zip, $birthday)) { $message = 'Address Added'; $fullName = ''; $email = ''; $addressLine1 = ''; $city = ''; $state = ''; $zip = ''; $birthday = ''; } } include '../views/messages.php'; include '../views/errors.php'; include '../views/add-address.php'; ?>
$stateRegex = '/^[A-Za-z0-9 ]{2}$/'; $message = array(); if (isPostRequest()) { if (!preg_match($nameRegex, $fullname)) { $message[] = 'Enter Name'; } if (filter_var($email, FILTER_VALIDATE_EMAIL) == false) { $message[] = 'Email NOT Valid'; } if (!preg_match($nameRegex, $addressline1)) { $message[] = 'Enter Address'; } if (!preg_match($nameRegex, $city)) { $message[] = 'Enter city'; } if (!preg_match($stateRegex, $state)) { $message[] = 'Enter State'; } if (!preg_match($zipRegex, $zip)) { $message[] = 'Zip Not Valid'; } if (count($message) === 0) { addAddress($fullname, $email, $addressline1, $city, $state, $zip, $birthday); $message[] = 'Address Added'; } } include '../templates/messages.html.php'; include '../templates/add-address.html.php'; ?> </body> </html>
updatePersonalInfo(); } if ($function == "change_password") { changePassword(); } if ($function == "get_all_addresses") { getAllAddresses(); } if ($function == "get_address") { getAddress(); } if ($function == "update_address") { updateAddress(); } if ($function == "add_address") { addAddress(); } if ($function == "get_all_cards") { getAllCards(); } if ($function == "get_card") { getCard(); } if ($function == "add_credit_card") { addCreditCard(); } if ($function == "add_credit_card_checkout") { addCreditCardCheckout(); } if ($function == "remove_credit_card") { removeCreditCard();
} if (empty($zip)) { $message = 'Sorry Zip is Empty'; $isValid = false; } else { if (!preg_match($zipRegex, $zip)) { $message = 'Zip invalid'; $isValid = false; } } if (empty($dob)) { $message = 'Sorry Birthday is Empty'; $isValid = false; } if ($isValid) { addAddress($fullname, $email, $address1, $city, $state, $zip, $dob); $message = 'Address Added'; $fullname = ''; $email = ''; $address1 = ''; $city = ''; $state = ''; $zip = ''; $dob = ''; } } include '../templates/message.php'; ?>
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301, USA. */ if (isset($_POST['form_submit']) && $_POST['form_submit'] == "11234") { $cid = $_POST['cityselect']; $sid = $_POST['streetselect']; $hn = $_POST['homenumber']; $fn = $_POST['floor']; $uid = logedUid(); if (is_numeric($cid) && is_numeric($sid) && is_numeric($hn) && is_numeric($fn) && is_numeric($uid)) { addAddress($uid, $cid, $sid, $hn, $fn); } else { $notice = __('You did something wrong'); } } get_top_nav(); //Call the navigation ?> <div id="wrap"> <div id="widecb"> <div id="additemnav"> <ul> <li><a href="" title=""><?php _e('Orders history');