function update_credit_card($id, $first_name, $middle_name, $last_name, $company, $address_line1, $address_line2, $city, $state, $zip, $country, $card_number, $card_exp_month, $card_exp_year, $card_type, $issue_number, $start_month, $start_year, $default)
{
    global $_TABLES;
    $error = check_data($first_name, $middle_name, $last_name, $company, $address_line1, $address_line2, $city, $state, $zip, $country, $card_number, $card_exp_month, $card_exp_year, $card_type, $issue_number, $start_month, $start_year, $default);
    if ($error == "") {
        //Clear all default credit cards if new default card.
        if ($default != "") {
            clear_default();
        }
        DB_query("UPDATE {$_TABLES['ecom_user_creditcard']} SET ecom_card_firstname = '" . $first_name . "', ecom_card_middlename = '" . $middle_name . "', ecom_card_lastname = '" . $last_name . "', ecom_card_company = '" . $company . "', ecom_card_street1 = '" . $address_line1 . "', ecom_card_street2 = '" . $address_line2 . "', ecom_card_city = '" . $city . "', ecom_card_state = '" . $state . "', ecom_card_postalcode = '" . $zip . "', ecom_card_country = '" . $country . "', ecom_card_accountnumber = '" . $card_number . "', ecom_card_experationmonth = '" . $card_exp_month . "', ecom_card_experationyear = '" . $card_exp_year . "', ecom_card_cardtype = '" . $card_type . "', ecom_card_issuenumber = '" . $issue_number . "', ecom_card_startmonth = '" . $start_month . "', ecom_card_startyear = '" . $start_year . "', ecom_card_default = '" . ($default != "" ? true : false) . "' WHERE ecom_cardid = " . $id . "");
    }
    return $error;
}
Ejemplo n.º 2
0
function update_address($id)
{
    global $_TABLES;
    $full_name = COM_applyFilter($_POST['full_name']);
    $company = COM_applyFilter($_POST['company']);
    $address_line1 = COM_applyFilter($_POST['address_line1']);
    $address_line2 = COM_applyFilter($_POST['address_line2']);
    $city = COM_applyFilter($_POST['city']);
    $state = COM_applyFilter($_POST['state']);
    $zip = COM_applyFilter($_POST['zip']);
    $country = COM_applyFilter($_POST['country']);
    $error = check_data();
    if ($error == "") {
        if (isset($_POST['default'])) {
            //Make sure only 1 address is the default address
            clear_default();
        }
        DB_query("UPDATE {$_TABLES['ecom_user_shipping']} SET ecom_ship_fullname = '{$full_name}', ecom_ship_company = '{$company}', ecom_ship_street1 = '{$address_line1}', ecom_ship_street2 = '{$address_line2}', ecom_ship_city = '{$city}', ecom_ship_state = '{$state}', ecom_ship_postalcode = '{$zip}', ecom_ship_country = '{$country}', ecom_ship_default = '" . (isset($_POST['default']) ? true : false) . "' WHERE ecom_shipid = " . $id . "");
    }
    return $error;
}