本文整理汇总了PHP中vam_db_insert_id函数的典型用法代码示例。如果您正苦于以下问题:PHP vam_db_insert_id函数的具体用法?PHP vam_db_insert_id怎么用?PHP vam_db_insert_id使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了vam_db_insert_id函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: affiliate_insert
function affiliate_insert($sql_data_array, $affiliate_parent = 0)
{
// LOCK TABLES
@mysql_query("LOCK TABLES " . TABLE_AFFILIATE . " WRITE");
if ($affiliate_parent > 0) {
$affiliate_root_query = vam_db_query("select affiliate_root, affiliate_rgt, affiliate_lft from " . TABLE_AFFILIATE . " where affiliate_id = '" . $affiliate_parent . "' ");
// Check if we have a parent affiliate
if ($affiliate_root_array = vam_db_fetch_array($affiliate_root_query)) {
vam_db_query("update " . TABLE_AFFILIATE . " SET affiliate_lft = affiliate_lft + 2 WHERE affiliate_root = '" . $affiliate_root_array['affiliate_root'] . "' and affiliate_lft > " . $affiliate_root_array['affiliate_rgt'] . " AND affiliate_rgt >= " . $affiliate_root_array['affiliate_rgt'] . " ");
vam_db_query("update " . TABLE_AFFILIATE . " SET affiliate_rgt = affiliate_rgt + 2 WHERE affiliate_root = '" . $affiliate_root_array['affiliate_root'] . "' and affiliate_rgt >= " . $affiliate_root_array['affiliate_rgt'] . " ");
$sql_data_array['affiliate_root'] = $affiliate_root_array['affiliate_root'];
$sql_data_array['affiliate_lft'] = $affiliate_root_array['affiliate_rgt'];
$sql_data_array['affiliate_rgt'] = $affiliate_root_array['affiliate_rgt'] + 1;
vam_db_perform(TABLE_AFFILIATE, $sql_data_array);
$affiliate_id = vam_db_insert_id();
}
// no parent -> new root
} else {
$sql_data_array['affiliate_lft'] = '1';
$sql_data_array['affiliate_rgt'] = '2';
vam_db_perform(TABLE_AFFILIATE, $sql_data_array);
$affiliate_id = vam_db_insert_id();
vam_db_query("update " . TABLE_AFFILIATE . " set affiliate_root = '" . $affiliate_id . "' where affiliate_id = '" . $affiliate_id . "' ");
}
// UNLOCK TABLES
@mysql_query("UNLOCK TABLES");
return $affiliate_id;
}
示例2: do_install
function do_install()
{
$query = "select configuration_group_id from " . TABLE_CONFIGURATION_GROUP . " where configuration_group_key='" . $this->data['key'] . "'";
$rs = vam_db_query($query);
if (!vam_db_fetch_array($rs)) {
$query = "insert into " . TABLE_CONFIGURATION_GROUP . " (configuration_group_id, configuration_group_title, configuration_group_key, configuration_group_description, sort_order, visible) " . " values ('','" . $this->data['title'] . "','" . $this->data['key'] . "','" . $this->data['descr'] . "'," . ($this->data['sort_order'] == NULL ? "NULL" : $this->data['sort_order']) . "," . ($this->data['visible'] == NULL ? "NULL" : $this->data['visible']) . ")";
vam_db_query($query);
if ($this->data['sort_order'] == NULL) {
$sid = vam_db_insert_id();
$query = "update " . TABLE_CONFIGURATION_GROUP . " set sort_order=" . $sid . " where configuration_group_id=" . $sid;
vam_db_query($query);
}
}
}
示例3: ItemAttributsSetUp
function ItemAttributsSetUp($current_product_id)
{
// I found the easiest way to do this is just delete the current attributes & start over =)
// download function start
$delete_sql = vam_db_query("SELECT products_attributes_id FROM " . TABLE_PRODUCTS_ATTRIBUTES . " WHERE products_id = '" . $current_product_id . "'");
while ($delete_res = vam_db_fetch_array($delete_sql)) {
$delete_download_sql = vam_db_query("SELECT products_attributes_filename FROM " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " WHERE products_attributes_id = '" . $delete_res['prducts_attributes_id'] . "'");
$delete_download_file = vam_db_fetch_array($delete_download_sql);
vam_db_query("DELETE FROM " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " WHERE products_attributes_id = '" . $delete_res['products_attributes_id'] . "'");
}
// download function end
vam_db_query("DELETE FROM " . TABLE_PRODUCTS_ATTRIBUTES . " WHERE products_id = '" . $current_product_id . "'");
// Simple, yet effective.. loop through the selected Option Values.. find the proper price & prefix.. insert.. yadda yadda yadda.
for ($i = 0; $i < sizeof($_POST['optionValues']); $i++) {
$query = "SELECT * FROM " . TABLE_PRODUCTS_OPTIONS_VALUES_TO_PRODUCTS_OPTIONS . " where products_options_values_id = '" . $_POST['optionValues'][$i] . "'";
$result = vam_db_query($query);
$matches = vam_db_num_rows($result);
while ($line = vam_db_fetch_array($result)) {
$optionsID = $line['products_options_id'];
}
$cv_id = $_POST['optionValues'][$i];
$value_price = $_POST[$cv_id . '_price'];
if (PRICE_IS_BRUTTO == 'true') {
$value_price = $value_price / (vam_get_tax_rate(vam_get_tax_class_id($current_product_id)) + 100) * 100;
}
$value_price = vam_round($value_price, PRICE_PRECISION);
$value_prefix = $_POST[$cv_id . '_prefix'];
$value_sortorder = $_POST[$cv_id . '_sortorder'];
$value_weight_prefix = $_POST[$cv_id . '_weight_prefix'];
$value_model = $_POST[$cv_id . '_model'];
$value_stock = $_POST[$cv_id . '_stock'];
$value_weight = $_POST[$cv_id . '_weight'];
vam_db_query("INSERT INTO " . TABLE_PRODUCTS_ATTRIBUTES . " (products_id, options_id, options_values_id, options_values_price, price_prefix ,attributes_model, attributes_stock, options_values_weight, weight_prefix,sortorder) VALUES ('" . $current_product_id . "', '" . $optionsID . "', '" . $_POST['optionValues'][$i] . "', '" . $value_price . "', '" . $value_prefix . "', '" . $value_model . "', '" . $value_stock . "', '" . $value_weight . "', '" . $value_weight_prefix . "','" . $value_sortorder . "')") or die(mysql_error());
$products_attributes_id = vam_db_insert_id();
if ($_POST[$cv_id . '_download_file'] != '') {
if (DOWNLOAD_ENABLED == 'true') {
$value_download_file = $_POST[$cv_id . '_download_file'];
$value_download_expire = $_POST[$cv_id . '_download_expire'];
$value_download_count = $_POST[$cv_id . '_download_count'];
$value_is_pin = $_POST[$cv_id . '_ispin'];
$products_attributes_is_pin = isset($value_is_pin) ? 1 : 0;
vam_db_query("INSERT INTO " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " (products_attributes_id, products_attributes_filename, products_attributes_maxdays, products_attributes_maxcount, products_attributes_is_pin) VALUES ('" . $products_attributes_id . "', '" . $value_download_file . "', '" . $value_download_expire . "', '" . $value_download_count . "', '" . $products_attributes_is_pin . "')") or die(mysql_error());
}
}
}
}
示例4: vam_not_null
$messageStack->add(ERROR_BANNER_GROUP_REQUIRED, 'error');
$banner_error = true;
}
if (empty($html_text)) {
if (!($banners_image =& vam_try_upload('banners_image', DIR_FS_CATALOG_IMAGES . 'banner/' . $banners_image_target)) && $_POST['banners_image_local'] == '') {
$banner_error = true;
}
}
if (!$banner_error) {
$db_image_location = vam_not_null($banners_image_local) ? $banners_image_local : $banners_image_target . $banners_image->filename;
$sql_data_array = array('banners_title' => $banners_title, 'banners_url' => $banners_url, 'banners_image' => $db_image_location, 'banners_group' => $banners_group, 'banners_html_text' => $html_text);
if ($_GET['action'] == 'insert') {
$insert_sql_data = array('date_added' => 'now()', 'status' => '1');
$sql_data_array = vam_array_merge($sql_data_array, $insert_sql_data);
vam_db_perform(TABLE_BANNERS, $sql_data_array);
$banners_id = vam_db_insert_id();
$messageStack->add_session(SUCCESS_BANNER_INSERTED, 'success');
} elseif ($_GET['action'] == 'update') {
vam_db_perform(TABLE_BANNERS, $sql_data_array, 'update', 'banners_id = \'' . $banners_id . '\'');
$messageStack->add_session(SUCCESS_BANNER_UPDATED, 'success');
}
if ($_POST['expires_date']) {
$expires_date = vam_db_prepare_input($_POST['expires_date']);
list($day, $month, $year) = explode('/', $expires_date);
$expires_date = $year . (strlen($month) == 1 ? '0' . $month : $month) . (strlen($day) == 1 ? '0' . $day : $day);
vam_db_query("update " . TABLE_BANNERS . " set expires_date = '" . vam_db_input($expires_date) . "', expires_impressions = null where banners_id = '" . $banners_id . "'");
} elseif ($_POST['impressions']) {
$impressions = vam_db_prepare_input($_POST['impressions']);
vam_db_query("update " . TABLE_BANNERS . " set expires_impressions = '" . vam_db_input($impressions) . "', expires_date = null where banners_id = '" . $banners_id . "'");
}
if ($_POST['date_scheduled']) {
示例5: switch
switch ($_GET['action']) {
case 'insert':
case 'save':
$currency_id = vam_db_prepare_input($_GET['cID']);
$title = vam_db_prepare_input($_POST['title']);
$code = vam_db_prepare_input($_POST['code']);
$symbol_left = vam_db_prepare_input($_POST['symbol_left']);
$symbol_right = vam_db_prepare_input($_POST['symbol_right']);
$decimal_point = vam_db_prepare_input($_POST['decimal_point']);
$thousands_point = vam_db_prepare_input($_POST['thousands_point']);
$decimal_places = vam_db_prepare_input($_POST['decimal_places']);
$value = vam_db_prepare_input($_POST['value']);
$sql_data_array = array('title' => $title, 'code' => $code, 'symbol_left' => $symbol_left, 'symbol_right' => $symbol_right, 'decimal_point' => $decimal_point, 'thousands_point' => $thousands_point, 'decimal_places' => $decimal_places, 'value' => $value);
if ($_GET['action'] == 'insert') {
vam_db_perform(TABLE_CURRENCIES, $sql_data_array);
$currency_id = vam_db_insert_id();
} elseif ($_GET['action'] == 'save') {
vam_db_perform(TABLE_CURRENCIES, $sql_data_array, 'update', "currencies_id = '" . vam_db_input($currency_id) . "'");
}
if ($_POST['default'] == 'on') {
vam_db_query("update " . TABLE_CONFIGURATION . " set configuration_value = '" . vam_db_input($code) . "' where configuration_key = 'DEFAULT_CURRENCY'");
}
vam_redirect(vam_href_link(FILENAME_CURRENCIES, 'page=' . $_GET['page'] . '&cID=' . $currency_id));
break;
case 'deleteconfirm':
$currencies_id = vam_db_prepare_input($_GET['cID']);
$currency_query = vam_db_query("select currencies_id from " . TABLE_CURRENCIES . " where code = '" . DEFAULT_CURRENCY . "'");
$currency = vam_db_fetch_array($currency_query);
if ($currency['currencies_id'] == $currencies_id) {
vam_db_query("update " . TABLE_CONFIGURATION . " set configuration_value = '' where configuration_key = 'DEFAULT_CURRENCY'");
}
示例6: vam_db_query
$price_result = vam_db_query('SELECT customers_group_price
FROM products_groups
WHERE products_id="' . $add_product_products_id . '"
AND customers_group_id="' . $cust_group_id . '"');
$price_array = vam_db_fetch_array($price_result);
if ($price_array) {
// set the price of the new product to the group specific price.
$product['products_price'] = $price_array['customers_group_price'];
}
}
}
}
//end sppc patch
$sql_data_array = array('orders_id' => vam_db_prepare_input($oID), 'products_id' => vam_db_prepare_input($add_product_products_id), 'products_model' => vam_db_prepare_input($product['products_model']), 'products_name' => vam_db_prepare_input($product['products_name']), 'products_price' => vam_db_prepare_input($product['products_price']) + $AddedOptionsPrice, 'final_price' => $product['products_price'] * $_POST['add_product_quantity'], 'products_tax' => vam_db_prepare_input($products_tax), 'products_quantity' => vam_db_prepare_input($_POST['add_product_quantity']), 'allow_tax' => '0');
vam_db_perform(TABLE_ORDERS_PRODUCTS, $sql_data_array);
$new_product_id = vam_db_insert_id();
if (isset($_POST['add_product_options'])) {
foreach ($_POST['add_product_options'] as $option_id => $option_value_id) {
$sql_data_array = array('orders_id' => vam_db_prepare_input($oID), 'orders_products_id' => vam_db_prepare_input($new_product_id), 'products_options' => vam_db_prepare_input($option_names[$option_id]), 'products_options_values' => vam_db_prepare_input($option_values_names[$option_value_id]), 'options_values_price' => vam_db_prepare_input($option_value_details[$option_id][$option_value_id]['options_values_price']), 'price_prefix' => vam_db_prepare_input($option_value_details[$option_id][$option_value_id]['price_prefix']));
vam_db_perform(TABLE_ORDERS_PRODUCTS_ATTRIBUTES, $sql_data_array);
//add on for downloads
if (DOWNLOAD_ENABLED == 'true' && isset($filename[$option_id])) {
$Query = "INSERT INTO " . TABLE_ORDERS_PRODUCTS_DOWNLOAD . " SET\n\t\t\t\torders_id = '" . vam_db_prepare_input($oID) . "',\n\t\t\t\torders_products_id = '" . vam_db_prepare_input($new_product_id) . "',\n\t\t\t\torders_products_filename = '" . vam_db_prepare_input($filename[$option_id]) . "',\n\t\t\t\tdownload_maxdays = '" . vam_db_prepare_input($maxdays[$option_id]) . "',\n\t download_count = '" . vam_db_prepare_input($maxcount[$option_id]) . "'";
vam_db_query($Query);
}
//end if (DOWNLOAD_ENABLED == 'true') {
//end downloads
}
}
// Update inventory Quantity
// This is only done if store is set up to use stock
示例7: isset
require 'includes/application_top.php';
$action = isset($_GET['action']) ? $_GET['action'] : '';
if (vam_not_null($action)) {
switch ($action) {
case 'insert':
case 'save':
if (isset($_GET['auID'])) {
$authors_id = vam_db_prepare_input($_GET['auID']);
}
$authors_name = vam_db_prepare_input($_POST['authors_name']);
$sql_data_array = array('authors_name' => $authors_name);
if ($action == 'insert') {
$insert_sql_data = array('date_added' => 'now()');
$sql_data_array = array_merge($sql_data_array, $insert_sql_data);
vam_db_perform(TABLE_AUTHORS, $sql_data_array);
$authors_id = vam_db_insert_id();
} elseif ($action == 'save') {
$update_sql_data = array('last_modified' => 'now()');
$sql_data_array = array_merge($sql_data_array, $update_sql_data);
vam_db_perform(TABLE_AUTHORS, $sql_data_array, 'update', "authors_id = '" . (int) $authors_id . "'");
}
$languages = vam_get_languages();
for ($i = 0, $n = sizeof($languages); $i < $n; $i++) {
$authors_desc_array = $_POST['authors_description'];
$authors_url_array = $_POST['authors_url'];
$language_id = $languages[$i]['id'];
$sql_data_array = array('authors_description' => vam_db_prepare_input($authors_desc_array[$language_id]), 'authors_url' => vam_db_prepare_input($authors_url_array[$language_id]));
if ($action == 'insert') {
$insert_sql_data = array('authors_id' => $authors_id, 'languages_id' => $language_id);
$sql_data_array = array_merge($sql_data_array, $insert_sql_data);
vam_db_perform(TABLE_AUTHORS_INFO, $sql_data_array);
示例8: make_alias
//insert a new news article.
if ($_POST['headline']) {
if ($_POST['news_page_url'] == '' && file_exists(DIR_FS_CATALOG . '.htaccess') && AUTOMATIC_SEO_URL == 'true') {
$alias = $_POST['headline'];
$alias = make_alias($alias);
$news_page_url = $alias;
} else {
$news_page_url = $_POST['news_page_url'];
}
$sql_data_array = array('headline' => vam_db_prepare_input($_POST['headline']), 'news_page_url' => vam_db_prepare_input($news_page_url), 'content' => vam_db_prepare_input($_POST['content']), 'date_added' => 'now()', 'language' => vam_db_prepare_input($_POST['item_language']), 'status' => '1');
if ($_FILES['articles_image']['error'] == 0) {
$articles_image = upload_file($_FILES, $_SERVER['DOCUMENT_ROOT'] . '/images/news/', 'articles_image');
$sql_data_array['articles_image'] = vam_db_prepare_input($articles_image);
}
vam_db_perform(TABLE_LATEST_NEWS, $sql_data_array);
$news_id = vam_db_insert_id();
//not actually used ATM -- just there in case
}
// vam_redirect(vam_href_link(FILENAME_LATEST_NEWS));
break;
case 'update_latest_news':
//user wants to modify a news article.
if ($_GET['news_id']) {
$sql_data_array = array('headline' => vam_db_prepare_input($_POST['headline']), 'news_page_url' => vam_db_prepare_input($_POST['news_page_url']), 'content' => vam_db_prepare_input($_POST['content']), 'date_added' => vam_db_prepare_input($_POST['date_added']), 'language' => vam_db_prepare_input($_POST['item_language']));
if ($_FILES['articles_image']['error'] == 0) {
$articles_image = upload_file($_FILES, $_SERVER['DOCUMENT_ROOT'] . '/images/news/', 'articles_image');
$sql_data_array['articles_image'] = vam_db_prepare_input($articles_image);
}
vam_db_perform(TABLE_LATEST_NEWS, $sql_data_array, 'update', "news_id = '" . vam_db_prepare_input($_GET['news_id']) . "'");
}
// vam_redirect(vam_href_link(FILENAME_LATEST_NEWS));
示例9: switch
http://www.mainframes.co.uk
Released under the GNU General Public License
------------------------------------------------------------------------------*/
require 'includes/application_top.php';
switch ($_GET['action']) {
case 'insert':
case 'save':
$blacklist_id = vam_db_prepare_input($_GET['bID']);
$blacklist_card_number = vam_db_prepare_input($_POST['blacklist_card_number']);
$sql_data_array = array('blacklist_card_number' => $blacklist_card_number);
if ($_GET['action'] == 'insert') {
$insert_sql_data = array('date_added' => 'now()');
$sql_data_array = vam_array_merge($sql_data_array, $insert_sql_data);
vam_db_perform(TABLE_BLACKLIST, $sql_data_array);
$blacklist_id = vam_db_insert_id();
} elseif ($_GET['action'] == 'save') {
$update_sql_data = array('last_modified' => 'now()');
$sql_data_array = vam_array_merge($sql_data_array, $update_sql_data);
vam_db_perform(TABLE_BLACKLIST, $sql_data_array, 'update', "blacklist_id = '" . vam_db_input($blacklist_id) . "'");
}
if (USE_CACHE == 'true') {
vam_reset_cache_block('blacklist');
}
vam_redirect(vam_href_link(FILENAME_BLACKLIST, 'page=' . $_GET['page'] . '&bID=' . $blacklist_id));
break;
case 'deleteconfirm':
$blacklist_id = vam_db_prepare_input($_GET['bID']);
vam_db_query("delete from " . TABLE_BLACKLIST . " where blacklist_id = '" . vam_db_input($blacklist_id) . "'");
if (USE_CACHE == 'true') {
vam_reset_cache_block('manufacturers');
示例10: switch
$page_info = 'option_page=' . $_GET['option_page'] . '&value_page=' . $_GET['value_page'] . '&attribute_page=' . $_GET['attribute_page'];
switch ($_GET['action']) {
case 'add_product_options':
for ($i = 0, $n = sizeof($languages); $i < $n; $i++) {
$option_name = $_POST['option_name'];
$option_rows = (int) $_POST['option_rows'];
$option_size = (int) $_POST['option_size'];
$option_length = (int) $_POST['option_length'];
$option_type = (int) $_POST['options_type'];
vam_db_query("insert into " . TABLE_PRODUCTS_OPTIONS . " (products_options_id,products_options_name, language_id,products_options_type,products_options_length,products_options_rows,products_options_size) values ('" . $_POST['products_options_id'] . "', '" . $option_name[$languages[$i]['id']] . "', '" . $languages[$i]['id'] . "','" . $option_type . "','" . $option_length . "','" . $option_rows . "','" . $option_size . "')");
}
vam_redirect(vam_href_link(FILENAME_PRODUCTS_OPTIONS, $page_info));
break;
case 'add_product_attributes':
vam_db_query("insert into " . TABLE_PRODUCTS_ATTRIBUTES . " values ('', '" . $_POST['products_id'] . "', '" . $_POST['options_id'] . "', '" . $_POST['values_id'] . "', '" . $_POST['value_price'] . "', '" . $_POST['price_prefix'] . "')");
$products_attributes_id = vam_db_insert_id();
if (DOWNLOAD_ENABLED == 'true' && $_POST['products_attributes_filename'] != '') {
vam_db_query("insert into " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " values (" . $products_attributes_id . ", '" . $_POST['products_attributes_filename'] . "', '" . $_POST['products_attributes_maxdays'] . "', '" . $_POST['products_attributes_maxcount'] . "')");
}
vam_redirect(vam_href_link(FILENAME_PRODUCTS_OPTIONS, $page_info));
break;
case 'update_option_name':
for ($i = 0, $n = sizeof($languages); $i < $n; $i++) {
$option_name = $_POST['option_name'];
$id = (int) $_POST['option_id'];
$option_rows = (int) $_POST['option_rows'];
$option_size = (int) $_POST['option_size'];
$option_length = (int) $_POST['option_length'];
$option_type = (int) $_POST['options_type'];
vam_db_query("update " . TABLE_PRODUCTS_OPTIONS . " set products_options_name = '" . $option_name[$languages[$i]['id']] . "' where products_options_id = '" . $id . "' and language_id = '" . $languages[$i]['id'] . "'");
// update fields
示例11: switch
switch ($action) {
case 'insert':
case 'save':
if (isset($_GET['fID'])) {
$fields_id = vam_db_prepare_input($_GET['fID']);
}
//$fields_name = vam_db_prepare_input($_POST['fields_name']);
$fields_input_type = vam_db_prepare_input($_POST['fields_input_type']);
$fields_input_value = vam_db_prepare_input($_POST['fields_input_value']);
$fields_required_status = vam_db_prepare_input($_POST['fields_required_status']);
$fields_size = vam_db_prepare_input($_POST['fields_size']);
$fields_required_email = vam_db_prepare_input($_POST['fields_required_email']);
$sql_data_array = array('fields_status' => 1, 'fields_input_type' => $fields_input_type, 'fields_input_value' => $fields_input_value, 'fields_required_status' => $fields_required_status, 'fields_size' => $fields_size, 'fields_required_email' => $fields_required_email);
if ($action == 'insert') {
vam_db_perform(TABLE_EXTRA_FIELDS, $sql_data_array);
$fields_id = vam_db_insert_id();
} elseif ($action == 'save') {
vam_db_perform(TABLE_EXTRA_FIELDS, $sql_data_array, 'update', "fields_id = '" . (int) $fields_id . "'");
}
$languages = vam_get_languages();
for ($i = 0, $n = sizeof($languages); $i < $n; $i++) {
$fields_name_array = $_POST['fields_name'];
$language_id = $languages[$i]['id'];
$sql_data_array = array('fields_name' => vam_db_prepare_input($fields_name_array[$language_id]));
if ($action == 'insert') {
$insert_sql_data = array('fields_id' => $fields_id, 'languages_id' => $language_id);
$sql_data_array = array_merge($sql_data_array, $insert_sql_data);
vam_db_perform(TABLE_EXTRA_FIELDS_INFO, $sql_data_array);
} elseif ($action == 'save') {
vam_db_perform(TABLE_EXTRA_FIELDS_INFO, $sql_data_array, 'update', "fields_id = '" . (int) $fields_id . "' and languages_id = '" . (int) $language_id . "'");
}
示例12: vam_db_prepare_input
$topics_id = vam_db_prepare_input($_POST['topics_id']);
if ($_POST['copy_as'] == 'link') {
if ($topics_id != $current_topic_id) {
$check_query = vam_db_query("select count(*) as total from " . TABLE_ARTICLES_TO_TOPICS . " where articles_id = '" . (int) $articles_id . "' and topics_id = '" . (int) $topics_id . "'");
$check = vam_db_fetch_array($check_query);
if ($check['total'] < '1') {
vam_db_query("insert into " . TABLE_ARTICLES_TO_TOPICS . " (articles_id, topics_id) values ('" . (int) $articles_id . "', '" . (int) $topics_id . "')");
}
} else {
$messageStack->add_session(ERROR_CANNOT_LINK_TO_SAME_TOPIC, 'error');
}
} elseif ($_POST['copy_as'] == 'duplicate') {
$article_query = vam_db_query("select articles_date_available, authors_id, articles_page_url, sort_order, articles_image from " . TABLE_ARTICLES . " where articles_id = '" . (int) $articles_id . "'");
$article = vam_db_fetch_array($article_query);
vam_db_query("insert into " . TABLE_ARTICLES . " (articles_date_added, articles_date_available, articles_status, authors_id, articles_page_url, sort_order) values (now(), '" . vam_db_input($article['articles_date_available']) . "', '0', '" . (int) $article['authors_id'] . "', '" . (int) $article['articles_page_url'] . "', '" . (int) $article['sort_order'] . "')");
$dup_articles_id = vam_db_insert_id();
$description_query = vam_db_query("select language_id, articles_name, articles_description, articles_url, articles_head_title_tag, articles_head_desc_tag, articles_head_keywords_tag from " . TABLE_ARTICLES_DESCRIPTION . " where articles_id = '" . (int) $articles_id . "'");
while ($description = vam_db_fetch_array($description_query)) {
vam_db_query("insert into " . TABLE_ARTICLES_DESCRIPTION . " (articles_id, language_id, articles_name, articles_description, articles_url, articles_head_title_tag, articles_head_desc_tag, articles_head_keywords_tag, articles_viewed) values ('" . (int) $dup_articles_id . "', '" . (int) $description['language_id'] . "', '" . vam_db_input($description['articles_name']) . "', '" . vam_db_input($description['articles_description']) . "', '" . vam_db_input($description['articles_url']) . "', '" . vam_db_input($description['articles_head_title_tag']) . "', '" . vam_db_input($description['articles_head_desc_tag']) . "', '" . vam_db_input($description['articles_head_keywords_tag']) . "', '0')");
}
vam_db_query("insert into " . TABLE_ARTICLES_TO_TOPICS . " (articles_id, topics_id) values ('" . (int) $dup_articles_id . "', '" . (int) $topics_id . "')");
$articles_id = $dup_articles_id;
}
if (USE_CACHE == 'true') {
vam_reset_cache_block('topics');
}
}
vam_redirect(vam_href_link(FILENAME_ARTICLES, 'tPath=' . $topics_id . '&aID=' . $articles_id));
break;
}
}
示例13: vam_db_query
vam_db_query("update " . TABLE_SPECIFICATIONS_VALUES . " \n set specifications_id = '" . $move_to_value_id . "'\n where specification_values_id = '" . $specification_values_id . "'\n ");
}
vam_redirect(vam_href_link(FILENAME_PRODUCTS_SPECIFICATIONS, 'sgpath=' . $specs_group_path . '&spath=' . $move_to_value_id . '&value=1&vid=' . $specification_values_id));
break;
// Copy a Specification Value
// Copy a Specification Value
case 'copy_value_confirm':
if (isset($_POST['specification_values_id']) && $_POST['specification_values_id'] != 0 && $_POST['copy_to_value_id'] != 0) {
$specification_values_id = (int) $_POST['specification_values_id'];
$copy_to_value_id = (int) $_POST['copy_to_value_id'];
$filter_query_raw = "select value_sort_order\n from " . TABLE_SPECIFICATIONS_VALUES . " \n where specification_values_id = '" . $specification_values_id . "'\n ";
$filter_query = vam_db_query($filter_query_raw);
$filter_array = vam_db_fetch_array($filter_query);
$sql_data_array = array('specifications_id' => $copy_to_value_id, 'value_sort_order' => $filter_array['value_sort_order']);
vam_db_perform(TABLE_SPECIFICATIONS_VALUES, $sql_data_array);
$new_specification_values_id = vam_db_insert_id();
for ($i = 0, $n = sizeof($languages); $i < $n; $i++) {
$language_id = (int) $languages[$i]['id'];
$filter_query_raw = "select specification_value,\n value_sort_order\n from " . TABLE_SPECIFICATIONS_VALUES_DESCRIPTION . " \n where specification_values_id = '" . $specification_values_id . "'\n ";
$filter_query = vam_db_query($filter_query_raw);
$filter_array = vam_db_fetch_array($filter_query);
$sql_data_array = array('specification_values_id' => $new_specification_values_id, 'language_id' => $language_id, 'specification_value' => $filter_array['specification_value']);
vam_db_perform(TABLE_SPECIFICATIONS_VALUES_DESCRIPTION, $sql_data_array);
}
}
// if (isset ($_POST['specification_values_id']
vam_redirect(vam_href_link(FILENAME_PRODUCTS_SPECIFICATIONS, 'sgpath=' . $specs_group_path . '&spath=' . $copy_to_value_id . '&value=1&vid=' . $new_specification_values_id));
break;
// Delete a Specification Value
// Delete a Specification Value
case 'delete_value_confirm':
示例14: confirmation
function confirmation()
{
global $cartID, $customer_id, $languages_id, $order, $order_total_modules;
if (isset($_SESSION['cartID'])) {
$insert_order = false;
if (isset($_SESSION['cart_qiwi_id'])) {
$order_id = substr($_SESSION['cart_qiwi_id'], strpos($_SESSION['cart_qiwi_id'], '-') + 1);
$curr_check = vam_db_query("select currency from " . TABLE_ORDERS . " where orders_id = '" . (int) $order_id . "'");
$curr = vam_db_fetch_array($curr_check);
if ($curr['currency'] != $order->info['currency'] || $cartID != substr($_SESSION['cart_qiwi_id'], 0, strlen($cartID))) {
$check_query = vam_db_query('select orders_id from ' . TABLE_ORDERS_STATUS_HISTORY . ' where orders_id = "' . (int) $order_id . '" limit 1');
if (vam_db_num_rows($check_query) < 1) {
vam_db_query('delete from ' . TABLE_ORDERS . ' where orders_id = "' . (int) $order_id . '"');
vam_db_query('delete from ' . TABLE_ORDERS_TOTAL . ' where orders_id = "' . (int) $order_id . '"');
vam_db_query('delete from ' . TABLE_ORDERS_STATUS_HISTORY . ' where orders_id = "' . (int) $order_id . '"');
vam_db_query('delete from ' . TABLE_ORDERS_PRODUCTS . ' where orders_id = "' . (int) $order_id . '"');
vam_db_query('delete from ' . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . ' where orders_id = "' . (int) $order_id . '"');
vam_db_query('delete from ' . TABLE_ORDERS_PRODUCTS_DOWNLOAD . ' where orders_id = "' . (int) $order_id . '"');
}
$insert_order = true;
}
} else {
$insert_order = true;
}
if ($insert_order == true) {
$order_totals = array();
if (is_array($order_total_modules->modules)) {
reset($order_total_modules->modules);
while (list(, $value) = each($order_total_modules->modules)) {
$class = substr($value, 0, strrpos($value, '.'));
if ($GLOBALS[$class]->enabled) {
for ($i = 0, $n = sizeof($GLOBALS[$class]->output); $i < $n; $i++) {
if (vam_not_null($GLOBALS[$class]->output[$i]['title']) && vam_not_null($GLOBALS[$class]->output[$i]['text'])) {
$order_totals[] = array('code' => $GLOBALS[$class]->code, 'title' => $GLOBALS[$class]->output[$i]['title'], 'text' => $GLOBALS[$class]->output[$i]['text'], 'value' => $GLOBALS[$class]->output[$i]['value'], 'sort_order' => $GLOBALS[$class]->sort_order);
}
}
}
}
}
if ($_SESSION['customers_status']['customers_status_ot_discount_flag'] == 1) {
$discount = $_SESSION['customers_status']['customers_status_ot_discount'];
} else {
$discount = '0.00';
}
if ($_SERVER["HTTP_X_FORWARDED_FOR"]) {
$customers_ip = $_SERVER["HTTP_X_FORWARDED_FOR"];
} else {
$customers_ip = $_SERVER["REMOTE_ADDR"];
}
$sql_data_array = array('customers_id' => $_SESSION['customer_id'], 'customers_name' => $order->customer['firstname'] . ' ' . $order->customer['lastname'], 'customers_cid' => $order->customer['csID'], 'customers_vat_id' => $_SESSION['customer_vat_id'], 'customers_company' => $order->customer['company'], 'customers_status' => $_SESSION['customers_status']['customers_status_id'], 'customers_status_name' => $_SESSION['customers_status']['customers_status_name'], 'customers_status_image' => $_SESSION['customers_status']['customers_status_image'], 'customers_status_discount' => $discount, 'customers_street_address' => $order->customer['street_address'], 'customers_suburb' => $order->customer['suburb'], 'customers_city' => $order->customer['city'], 'customers_postcode' => $order->customer['postcode'], 'customers_state' => $order->customer['state'], 'customers_country' => $order->customer['country']['title'], 'customers_telephone' => $order->customer['telephone'], 'customers_email_address' => $order->customer['email_address'], 'customers_address_format_id' => $order->customer['format_id'], 'delivery_name' => $order->delivery['firstname'] . ' ' . $order->delivery['lastname'], 'delivery_company' => $order->delivery['company'], 'delivery_street_address' => $order->delivery['street_address'], 'delivery_suburb' => $order->delivery['suburb'], 'delivery_city' => $order->delivery['city'], 'delivery_postcode' => $order->delivery['postcode'], 'delivery_state' => $order->delivery['state'], 'delivery_country' => $order->delivery['country']['title'], 'delivery_address_format_id' => $order->delivery['format_id'], 'billing_name' => $order->billing['firstname'] . ' ' . $order->billing['lastname'], 'billing_company' => $order->billing['company'], 'billing_street_address' => $order->billing['street_address'], 'billing_suburb' => $order->billing['suburb'], 'billing_city' => $order->billing['city'], 'billing_postcode' => $order->billing['postcode'], 'billing_state' => $order->billing['state'], 'billing_country' => $order->billing['country']['title'], 'billing_address_format_id' => $order->billing['format_id'], 'payment_method' => $order->info['payment_method'], 'payment_class' => $order->info['payment_class'], 'shipping_method' => $order->info['shipping_method'], 'shipping_class' => $order->info['shipping_class'], 'language' => $_SESSION['language'], 'comments' => $order->info['comments'], 'customers_ip' => $customers_ip, 'orig_reference' => $order->customer['orig_reference'], 'login_reference' => $order->customer['login_reference'], 'cc_type' => $order->info['cc_type'], 'cc_owner' => $order->info['cc_owner'], 'cc_number' => $order->info['cc_number'], 'cc_expires' => $order->info['cc_expires'], 'date_purchased' => 'now()', 'orders_status' => $order->info['order_status'], 'currency' => $order->info['currency'], 'currency_value' => $order->info['currency_value']);
vam_db_perform(TABLE_ORDERS, $sql_data_array);
$insert_id = vam_db_insert_id();
$customer_notification = SEND_EMAILS == 'true' ? '1' : '0';
$sql_data_array = array('orders_id' => $insert_id, 'orders_status_id' => $order->info['order_status'], 'date_added' => 'now()', 'customer_notified' => $customer_notification, 'comments' => $order->info['comments']);
vam_db_perform(TABLE_ORDERS_STATUS_HISTORY, $sql_data_array);
for ($i = 0, $n = sizeof($order_totals); $i < $n; $i++) {
$sql_data_array = array('orders_id' => $insert_id, 'title' => $order_totals[$i]['title'], 'text' => $order_totals[$i]['text'], 'value' => $order_totals[$i]['value'], 'class' => $order_totals[$i]['code'], 'sort_order' => $order_totals[$i]['sort_order']);
vam_db_perform(TABLE_ORDERS_TOTAL, $sql_data_array);
}
for ($i = 0, $n = sizeof($order->products); $i < $n; $i++) {
$sql_data_array = array('orders_id' => $insert_id, 'products_id' => vam_get_prid($order->products[$i]['id']), 'products_model' => $order->products[$i]['model'], 'products_name' => $order->products[$i]['name'], 'products_price' => $order->products[$i]['price'], 'final_price' => $order->products[$i]['final_price'], 'products_tax' => $order->products[$i]['tax'], 'products_quantity' => $order->products[$i]['qty']);
vam_db_perform(TABLE_ORDERS_PRODUCTS, $sql_data_array);
$order_products_id = vam_db_insert_id();
$attributes_exist = '0';
if (isset($order->products[$i]['attributes'])) {
$attributes_exist = '1';
for ($j = 0, $n2 = sizeof($order->products[$i]['attributes']); $j < $n2; $j++) {
if (DOWNLOAD_ENABLED == 'true') {
$attributes_query = "select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix, pad.products_attributes_maxdays, pad.products_attributes_maxcount , pad.products_attributes_filename, pad.products_attributes_is_pin\n from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa\n left join " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad\n on pa.products_attributes_id=pad.products_attributes_id\n where pa.products_id = '" . $order->products[$i]['id'] . "'\n and pa.options_id = '" . $order->products[$i]['attributes'][$j]['option_id'] . "'\n and pa.options_id = popt.products_options_id\n and pa.options_values_id = '" . $order->products[$i]['attributes'][$j]['value_id'] . "'\n and pa.options_values_id = poval.products_options_values_id\n and popt.language_id = '" . $_SESSION['languages_id'] . "'\n and poval.language_id = '" . $_SESSION['languages_id'] . "'";
$attributes = vam_db_query($attributes_query);
} else {
$attributes = vam_db_query("select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa where pa.products_id = '" . $order->products[$i]['id'] . "' and pa.options_id = '" . $order->products[$i]['attributes'][$j]['option_id'] . "' and pa.options_id = popt.products_options_id and pa.options_values_id = '" . $order->products[$i]['attributes'][$j]['value_id'] . "' and pa.options_values_id = poval.products_options_values_id and popt.language_id = '" . $_SESSION['languages_id'] . "' and poval.language_id = '" . $_SESSION['languages_id'] . "'");
}
// update attribute stock
vam_db_query("UPDATE " . TABLE_PRODUCTS_ATTRIBUTES . " set\n\t\t\t\t\t\t attributes_stock=attributes_stock - '" . $order->products[$i]['qty'] . "'\n\t\t\t\t\t\t where\n\t\t\t\t\t\t products_id='" . $order->products[$i]['id'] . "'\n\t\t\t\t\t\t and options_values_id='" . $order->products[$i]['attributes'][$j]['value_id'] . "'\n\t\t\t\t\t\t and options_id='" . $order->products[$i]['attributes'][$j]['option_id'] . "'\n\t\t\t\t\t\t ");
$attributes_values = vam_db_fetch_array($attributes);
$sql_data_array = array('orders_id' => $insert_id, 'orders_products_id' => $order_products_id, 'products_options' => $attributes_values['products_options_name'], 'products_options_values' => $attributes_values['products_options_values_name'], 'options_values_price' => $attributes_values['options_values_price'], 'price_prefix' => $attributes_values['price_prefix']);
vam_db_perform(TABLE_ORDERS_PRODUCTS_ATTRIBUTES, $sql_data_array);
if (DOWNLOAD_ENABLED == 'true' && (isset($attributes_values['products_attributes_filename']) && vam_not_null($attributes_values['products_attributes_filename']) or $attributes_values['products_attributes_is_pin'])) {
//PIN add
for ($pincycle = 0; $pincycle < $order->products[$i]['qty']; $pincycle++) {
if ($attributes_values['products_attributes_is_pin']) {
$pin_query = vam_db_query("SELECT products_pin_id, products_pin_code FROM " . TABLE_PRODUCTS_PINS . " WHERE products_id = '" . $order->products[$i]['id'] . "' AND products_pin_used='0' LIMIT 1");
if (vam_db_num_rows($pin_query) == '0') {
// We have no PIN for this product
// insert some error notifying here
$pin = PIN_NOT_AVAILABLE;
} else {
$pin_res = vam_db_fetch_array($pin_query);
$pin = $pin_res['products_pin_code'];
vam_db_query("UPDATE " . TABLE_PRODUCTS_PINS . " SET products_pin_used='" . $insert_id . "' WHERE products_pin_id = '" . $pin_res['products_pin_id'] . "'");
}
}
//PIN
$sql_data_array = array('orders_id' => $insert_id, 'orders_products_id' => $order_products_id, 'orders_products_filename' => $attributes_values['products_attributes_filename'], 'download_maxdays' => $attributes_values['products_attributes_maxdays'], 'download_count' => $attributes_values['products_attributes_maxcount'], 'download_is_pin' => $attributes_values['products_attributes_is_pin'], 'download_pin_code' => $pin);
vam_db_perform(TABLE_ORDERS_PRODUCTS_DOWNLOAD, $sql_data_array);
}
}
}
}
//.........这里部分代码省略.........
示例15: vam_db_query
$manufacturer_query = vam_db_query("select manufacturers_description from " . TABLE_MANUFACTURERS_INFO . " where manufacturers_id = '" . (int) $manufacturer_id . "' and languages_id = '" . (int) $language_id . "'");
$manufacturer = vam_db_fetch_array($manufacturer_query);
return $manufacturer['manufacturers_description'];
}
// EOF manufacturers meta tags
switch ($_GET['action']) {
case 'insert':
case 'save':
$manufacturers_id = vam_db_prepare_input($_GET['mID']);
$manufacturers_name = vam_db_prepare_input($_POST['manufacturers_name']);
$sql_data_array = array('manufacturers_name' => $manufacturers_name);
if ($_GET['action'] == 'insert') {
$insert_sql_data = array('date_added' => 'now()');
$sql_data_array = vam_array_merge($sql_data_array, $insert_sql_data);
vam_db_perform(TABLE_MANUFACTURERS, $sql_data_array);
$manufacturers_id = vam_db_insert_id();
} elseif ($_GET['action'] == 'save') {
$update_sql_data = array('last_modified' => 'now()');
$sql_data_array = vam_array_merge($sql_data_array, $update_sql_data);
vam_db_perform(TABLE_MANUFACTURERS, $sql_data_array, 'update', "manufacturers_id = '" . vam_db_input($manufacturers_id) . "'");
}
$dir_manufacturers = DIR_FS_CATALOG_IMAGES . "/manufacturers";
if ($manufacturers_image =& vam_try_upload('manufacturers_image', $dir_manufacturers)) {
vam_db_query("update " . TABLE_MANUFACTURERS . " set\r\n manufacturers_image ='manufacturers/" . $manufacturers_image->filename . "'\r\n where manufacturers_id = '" . vam_db_input($manufacturers_id) . "'");
}
$languages = vam_get_languages();
for ($i = 0, $n = sizeof($languages); $i < $n; $i++) {
$manufacturers_url_array = $_POST['manufacturers_url'];
// BOF manufacturers descriptions + meta tags
$manufacturers_meta_title_array = $_POST['manufacturers_meta_title'];
$manufacturers_meta_keywords_array = $_POST['manufacturers_meta_keywords'];