Sorry to wonder back in here with another issue:
I just installed (Just..more like 8 hours ago actually) WISHLIST 2.0 and as expected, I am running into another register_globals=off issue. (or at least I think so)
The installation went smooth, but as it stands now, no fucntionality. Since this is a multiple page problem, I paste the code for the pages where I suspect the problem may be:
##########APPLICATION_TOP.PHP
MODIFICATION # 1
THIS ONE I SOLVED using the link_get_variable CMOTD showed me for the Admin Paging problem just before this post. This code was giving me an SQL sytax error, but as I said, it is fixed:
OLD CODE
// performed by the 'buy now' button in product listings and review page
case 'buy_now' : if (isset($HTTP_GET_VARS['products_id'])) {
// Wish List 2.3 Start
if (tep_session_is_registered('customer_id')) {
tep_db_query("delete from " . TABLE_WISHLIST . " WHERE customers_id=$customer_id AND products_id=$products_id");
tep_db_query("delete from " . TABLE_WISHLIST_ATTRIBUTES . " WHERE customers_id=$customer_id AND products_id=$products_id");
}
// Wish List 2.3 End
if (tep_has_product_attributes($HTTP_GET_VARS['products_id'])) {
tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_GET_VARS['products_id']));
} else {
$cart->add_cart($HTTP_GET_VARS['products_id'], $cart->get_quantity($HTTP_GET_VARS['products_id'])+1);
}
}
tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
break;
NEW FIXED CODE using "link_get_variables"
case 'buy_now' : if (isset($HTTP_GET_VARS['products_id'])) {
link_get_variable('customer_id');
link_get_variable('products_id');
// Wish List 2.3 Start
if (tep_session_is_registered('customer_id')) {
tep_db_query("delete from " . TABLE_WISHLIST . " WHERE customers_id=$customer_id AND products_id=$products_id");
tep_db_query("delete from " . TABLE_WISHLIST_ATTRIBUTES . " WHERE customers_id=$customer_id AND products_id=$products_id");
}
// Wish List 2.3 End
if (tep_has_product_attributes($HTTP_GET_VARS['products_id'])) {
tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_GET_VARS['products_id']));
} else {
$cart->add_cart($HTTP_GET_VARS['products_id'], $cart->get_quantity($HTTP_GET_VARS['products_id'])+1);
}
}
tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
break;
MODIFICATION # 2
case 'cust_order' : if (tep_session_is_registered('customer_id') && isset($HTTP_GET_VARS['pid'])) {
// Wish List 2.3 Start
tep_db_query("delete from " . TABLE_WISHLIST . " where products_id = '" . $HTTP_GET_VARS['pid'] . "' and customers_id = '" . $customer_id . "'");
tep_db_query("delete from " . TABLE_WISHLIST_ATTRIBUTES . " WHERE customers_id=$customer_id AND products_id='" . $HTTP_GET_VARS['pid']."'");
// Wish List 2.3 End
if (tep_has_product_attributes($HTTP_GET_VARS['pid'])) {
tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_GET_VARS['pid']));
} else {
$cart->add_cart($HTTP_GET_VARS['pid'], $cart->get_quantity($HTTP_GET_VARS['pid'])+1);
}
}
tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
break;
// Wish List 2.3 Start
// *****************************************
// Remove item from the Wish List
case 'remove_wishlist':
tep_db_query("delete from " . TABLE_WISHLIST . " where products_id = '" . $HTTP_GET_VARS['pid'] . "' and customers_id = '" . $customer_id . "'");
tep_db_query("delete from " . TABLE_WISHLIST_ATTRIBUTES . " WHERE customers_id=$customer_id AND products_id= '" . $HTTP_GET_VARS['pid'] . "'");
tep_redirect(tep_href_link(FILENAME_WISHLIST));
break;
} // end switch $HTTP_GET_VARS['action']
} // end if is set $HTTP_GET_VARS['action']
// Shopping cart actions through POST variables from forms
if (isset($HTTP_POST_VARS['wishlist_action'])) {
// redirect the customer to a friendly cookie-must-be-enabled page if cookies are disabled
if ($session_started == false) {
tep_redirect(tep_href_link(FILENAME_COOKIE_USAGE));
}
$goto = basename($PHP_SELF);
switch ($HTTP_POST_VARS['wishlist_action']) {
// Customer wants to update the product quantity in their shopping cart
case 'add_wishlist' : if (ereg('^[0-9]+$', $HTTP_POST_VARS['products_id'])) {
if ($HTTP_POST_VARS['products_id']) {
if ($customer_id > 0) {
// Queries below replace old product instead of adding to queatity.
tep_db_query("delete from " . TABLE_WISHLIST . " where products_id = '" . $HTTP_POST_VARS['products_id'] . "' and customers_id = '" . $customer_id . "'");
tep_db_query("insert into " . TABLE_WISHLIST . " (customers_id, products_id, products_model, products_name, products_price) values ('" . $customer_id . "', '" . $products_id . "', '" . $products_model . "', '" . $products_name . "', '" . $products_price . "' )");
tep_db_query("delete from " . TABLE_WISHLIST_ATTRIBUTES . " where products_id = '" . $HTTP_POST_VARS['products_id'] . "' and customers_id = '" . $customer_id . "'");
// Read array of options and values for attributes in id[]
if (isset ($id)) {
foreach($id as $att_option=>$att_value) {
// Add to customers_wishlist_attributes table
tep_db_query("insert into " . TABLE_WISHLIST_ATTRIBUTES . " (customers_id, products_id, products_options_id , products_options_value_id) values ('" . $customer_id . "', '" . $products_id . "', '" . $att_option . "', '" . $att_value . "' )");
}
}
}
}
}
break;
case 'wishlist_add_cart' :if (ereg('^[0-9]+$', $HTTP_POST_VARS['products_id'])) {
if ($HTTP_POST_VARS['products_id']) {
if ($customer_id > 0) {
tep_db_query("delete from " . TABLE_WISHLIST . " where products_id = '" . $HTTP_POST_VARS['products_id'] . "' and customers_id = '" . $customer_id . "'");
tep_db_query("delete from " . TABLE_WISHLIST_ATTRIBUTES . " where products_id = '" . $HTTP_POST_VARS['products_id'] . "' and customers_id = '" . $customer_id . "'");
// Read array of options and values for attributes in id[]
if (isset($HTTP_POST_VARS['products_id']) && is_numeric($HTTP_POST_VARS['products_id'])) {
$cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $HTTP_POST_VARS['id']))+1, $HTTP_POST_VARS['id']);
}
tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
break;
}
}
}
break;
// Wishlist Checkboxes
case 'add_delete_products_wishlist':
if (isset($HTTP_POST_VARS['add_wishprod'])) {
if ($HTTP_POST_VARS['borrar'] == 0) {
// 'borrar' form variable refers to deleting products in array $add_wishprod[] from wishlist
foreach ($HTTP_POST_VARS['add_wishprod'] as $value) {
if (ereg('^[0-9]+$', $value)) {
$cart->add_cart($value, $cart->get_quantity(tep_get_uprid($value, $HTTP_POST_VARS['id'][$value]))+1, $HTTP_POST_VARS['id'][$value]);
tep_db_query("delete from " . TABLE_WISHLIST . " where products_id = $value and customers_id = '" . $customer_id . "'");
tep_db_query("delete from " . TABLE_WISHLIST_ATTRIBUTES . " where products_id = '$value' and customers_id = '" . $customer_id . "'");
}
}
tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
}
if ($HTTP_POST_VARS['borrar'] == 1) {
foreach ($HTTP_POST_VARS['add_wishprod'] as $value) {
if (ereg('^[0-9]+$', $value)) {
tep_db_query("delete from " . TABLE_WISHLIST . " where products_id = $value and customers_id = '" . $customer_id . "'");
tep_db_query("delete from " . TABLE_WISHLIST_ATTRIBUTES . " where products_id = '$value' and customers_id = '" . $customer_id . "'");
}
}
tep_redirect(tep_href_link(FILENAME_WISHLIST));
}
}
break;
} // end switch ($HTTP_POST_VARS['wishlist_action'])
} // end isset($HTTP_POST_VARS)
// *****************************************
// Wish List 2.3 End
// include the who's online functions
I also suspect the products_info.php and wishlist.php pages may also have code that needs patching, but I get the feeling the problem is in this page.
As always, upong fixing/texting this problem, I will posted a TXT file to the WISHLIST 2.0 contribution so anyone else with this problem can fix it next time around.
Thanks in advanced
Edited by canary100, 27 November 2004, 13:40.