Example #1
0
<?php

include 'tiosafe_config.php';
$customer_id = "";
if (postNotEmpty('person_id')) {
    $customer_id = $_POST['person_id'];
    //Prepare update list
    $update_list = array('firstname', 'lastname', 'email');
    $db_list = array('customers_firstname', 'customers_lastname', 'customers_email_address');
    $set_update = create_update_list($update_list, $db_list);
    if (postNotEmpty('birthday')) {
        //$dob = tep_date_raw($_POST['birthday']);
        $dob = $_POST['birthday'];
        if (empty($set_update)) {
            $set_update .= 'customers_dob = "' . $dob . '"';
        } else {
            $set_update .= ', customers_dob = "' . $dob . '"';
        }
    }
    if (!empty($set_update)) {
        $query = "UPDATE " . TABLE_CUSTOMERS . " SET {$set_update} WHERE customers_id = " . (int) $customer_id;
        echo executeSQL($query, $db);
    }
} else {
    echo '\\nInvalid query: The parameter person_id is required!';
}
$db->close();
Example #2
0
$products_id = $_POST['id'];
if (postOK('category')) {
    $category = explode('/', $_POST['category']);
    $option = $category[0];
    $value = $category[1];
    $optionId = optionExists($option);
    $valueId = valueExists($value);
    if (!$optionId) {
        $optionId = createOption($option);
    }
    if (!$valueId) {
        $valueId = createValue($value);
    }
    if (!isOptionLinkedToValue($optionId, $valueId)) {
        createLink($optionId, $valueId);
    }
    if (!isProductLinked($optionId, $valueId, $products_id)) {
        createLinkToProduct($optionId, $valueId, $products_id);
    }
    die;
}
tep_db_connect() or die('Unable to connect to database');
$language_id = getDefaultLanguageID();
$update_array = array('title');
$db_array = array('products_name');
$set_update = create_update_list($update_array, $db_array);
if (!empty($set_update)) {
    $query = "update " . TABLE_PRODUCTS_DESCRIPTION . " set {$set_update} where products_id = " . $products_id . " and language_id = " . $language_id;
    tep_db_query($query);
}
tep_db_close();
Example #3
0
<?php

include 'tiosafe_config.php';
if (postNotEmpty('address_id')) {
    $address_id = $_POST['address_id'];
    $post_update_list = array('street', 'zip', 'city');
    $db_update_list = array('entry_street_address', 'entry_postcode', 'entry_city');
    $set_update = create_update_list($post_update_list, $db_update_list);
    //If the country is posted, get the id
    if (postNotEmpty('country')) {
        $countries_id = getCountryId($_POST['country'], $db);
        if (empty($set_update)) {
            $set_update = 'entry_country_id = ' . $countries_id;
        } else {
            $set_update .= ', entry_country_id = ' . $countries_id;
        }
    }
    if (!empty($set_update) && !empty($address_id)) {
        $query = "UPDATE " . TABLE_ADDRESS_BOOK . " SET {$set_update} WHERE address_book_id = " . $address_id;
        echo executeSQL($query, $db);
    }
} else {
    echo '\\nInvalid query: the parameter address_id is required!';
}
$db->close();
Example #4
0
<?php

include 'tiosafe_config.php';
//Product id is required
if (postNotEmpty('product_id')) {
    $products_id = $_POST['product_id'];
    $language_id = getDefaultLanguageID($db);
    $products_last_modified = date('Y/m/d h:i:s');
    $update_array_1 = array('sale_price');
    $db_array_1 = array('products_price');
    $set_update_1 = create_update_list($update_array_1, $db_array_1);
    if (!empty($set_update_1)) {
        $query_1 = "UPDATE " . TABLE_PRODUCTS . " SET {$set_update_1}, products_last_modified='" . $products_last_modified . "' WHERE products_id = " . $products_id;
        executeSQL($query_1, $db);
    }
    $update_array_2 = array('title');
    $db_array_2 = array('products_name');
    $set_update_2 = create_update_list($update_array_2, $db_array_2);
    if (!empty($set_update_2)) {
        $query_2 = "UPDATE " . TABLE_PRODUCTS_DESCRIPTION . " SET {$set_update_2} WHERE products_id = " . $products_id . " and language_id = " . $language_id;
        echo executeSQL($query_2, $db);
    }
} else {
    echo '\\nInvalid query: The parameter product_id is required!';
}