Results 1 to 10 of 26

Hybrid View

  1. #1
    Join Date
    Aug 2004
    Posts
    1,590
    Plugin Contributions
    1

    Default Re: Need Help Please

    Make a backup of the file.

    On the error block you mentionned, if you replace it with this one:

    PHP Code:
    if (eregi('\\'$product_name[$i])) {
        
    $image substr($product_image[$i], 1);
    } else {
        
    $image str_replace('\\''/'$image);
        
    $image substr($image1);

    Will it still return the same error message ?

  2. #2
    Join Date
    May 2007
    Posts
    69
    Plugin Contributions
    0

    Default Re: Need Help Please

    thx oracle that code seems to have worked ...

    next error lol

    Parse error: syntax error, unexpected T_STRING in /home/tower/public_html/admin/quick_add_products.php on line 66

    Code:
    $db->Execute("INSERT INTO " . TABLE_PRODUCTS_TO_CATEGORIES . " VALUES ('" . $products_id->products_id . "', '" . $product_categories[$i] . "'));
    note there is only a few lines left of code before it starts to display the page... hopefully this will be all that faults...

  3. #3
    Join Date
    Aug 2004
    Posts
    1,590
    Plugin Contributions
    1

    Default Re: Need Help Please

    PHP Code:
    $db->Execute("INSERT INTO " TABLE_PRODUCTS_TO_CATEGORIES " VALUES ('" $products_id->products_id "', '" $product_categories[$i] . "')); 
    to:

    PHP Code:
    $db->Execute("INSERT INTO " TABLE_PRODUCTS_TO_CATEGORIES " VALUES ('" . (int)$products_id->products_id "', '" $product_categories[$i] . "')"); 

  4. #4
    Join Date
    May 2007
    Posts
    69
    Plugin Contributions
    0

    Default Re: Need Help Please

    still same error

  5. #5
    Join Date
    Aug 2004
    Posts
    1,590
    Plugin Contributions
    1

    Default Re: Need Help Please

    Post between line 60 and 70. It is doubtful the error is still on the SQL injection line.

  6. #6
    Join Date
    May 2007
    Posts
    69
    Plugin Contributions
    0

    Default Re: Need Help Please

    lines 46 -> 71

    Code:
    for ($i = 1; $i <= MAX_PRODUCTS; $i++) {
    $valid = false; $product_exist = false;
    if(isset($product_name) && $product_name[$i]){
    foreach($product_name[$i] as $id => $product_language_name){
    if($product_language_name != ''){
    if(!$product_exist){
    //if(strrchr($product_name[$i], '\\'))$image = substr(strrchr($product_image[$i])), '\\', 1;else $image = substr(strrchr($product_image[$i])), '/', 1;
    if (eregi('\\', $product_name[$i])) { 
        $image = substr($product_image[$i], 1); 
    } else { 
        $image = str_replace('\\', '/', $image); 
        $image = substr($image, 1); 
    } 
    $db->Execute("INSERT INTO " . TABLE_PRODUCTS . " (products_quantity, products_model, products_image, products_price, products_weight, products_status, products_tax_class_id, manufacturers_id) VALUES (" . $product_quantity[$i] . ", '" . $product_model[$i] . "', '" . $image . "', " . $product_price[$i] . ", " . $product_weight[$i] . ", ". $product_status[$i] . ", " . $product_tax[$i] . ", " . $product_manufacturer[$i] . ")");
    $products_id_query = $db->Execute("SELECT products_id from " . TABLE_PRODUCTS . " WHERE products_quantity=" . $product_quantity[$i] ." and products_model='" . $product_model[$i] ."' and products_price=" . $product_price[$i] . " and products_weight=" . $product_weight[$i] . " and products_image='" . $image . "' and products_status=" . $product_status[$i] . " and products_tax_class_id=" . $product_tax[$i] . " and manufacturers_id=" . $product_manufacturer[$i] . ");
    $products_id = new objectInfo($products_id_query->fields);
    //$db->Execute("INSERT INTO " . TABLE_PRODUCTS_TO_CATEGORIES . " VALUES ('" . $products_id->products_id . "', '" . $product_categories[$i] . "');");
    $db->Execute("INSERT INTO " . TABLE_PRODUCTS_TO_CATEGORIES . " VALUES ('" . (int)$products_id->products_id . "', '" . $product_categories[$i] . "')");
    }
    $db->Execute("INSERT INTO " . TABLE_PRODUCTS_DESCRIPTION . " (products_id, language_id, products_name, products_description) VALUES ('" . $products_id->products_id . "', '" . $languages[$i][$id] . "', '" . $product_language_name . "', '" . $product_description[$i][$id] . "');");
    $product_exist = true;
    $valid = true;
    }
    }
    }

  7. #7
    Join Date
    May 2007
    Posts
    69
    Plugin Contributions
    0

    Default Re: Need Help Please

    this was another idea we tried...


    Code:
    ##// Update database
      switch ($_GET['action']) {
        case 'add' :
      $products_added = 0;
      
      for ($i = 1; $i <= MAX_PRODUCTS; $i++) {
       $valid = false; $product_exist = false;
       if($_POST['product_name'][$i]){
        foreach($_POST['product_name'][$i] as $id => $product_language_name){ 
         if($product_language_name != ''){
          if(!$product_exist){
           if(strrchr($_POST['product_image'][$i], '\\'))$image = substr(strrchr(trim(stripslashes($_POST['product_image'][$i])), '\\'), 1);else $image = substr(strrchr(trim(stripslashes($_POST['product_image'][$i])), '/'), 1);
           $db->Execute("INSERT INTO " . TABLE_PRODUCTS . " (products_quantity, products_model, products_image, products_price, products_weight, products_status, products_tax_class_id, manufacturers_id) VALUES (" . $_POST['product_quantity'][$i] . ", '" . $_POST['product_model'][$i] . "', '" . $image . "', " . $_POST['product_price'][$i] . ", " . $_POST['product_weight'][$i] . ", ". $_POST['product_status'][$i] . ", " . $_POST['product_tax'][$i] . ", " . $_POST['product_manufacturer'][$i] . ");");
           $products_id_query = "SELECT products_id from " . TABLE_PRODUCTS . " WHERE products_quantity=" . $_POST['product_quantity'][$i] ." and products_model='" . $_POST['product_model'][$i] ."' and products_price=" . $_POST['product_price'][$i] . " and products_weight=" . $_POST['product_weight'][$i] . " and products_image='" . $image . "' and products_status=" . $_POST['product_status'][$i] . " and products_tax_class_id=" . $_POST['product_tax'][$i] . " and manufacturers_id=" . $POST['product_manufacturer'][$i] . ";";
           $products_id = $db->Execute($products_id_query);
           $db->Execute("INSERT INTO " . TABLE_PRODUCTS_TO_CATEGORIES . " VALUES ('" . $products_id->fields['products_id'] . "', '" . $POST['product_categories'][$i] . "');");
          }
          $db->Execute("INSERT INTO " . TABLE_PRODUCTS_DESCRIPTION . " (products_id, language_id, products_name, products_description) VALUES ('" . $products_id->fields['products_id'] . "', '" . $POST['languages'][$i][$id] . "', '" . $product_language_name . "', '" . $POST['product_description'][$i][$id] . "');");
     
          $product_exist = true;
          $valid = true;
         }
        }
       }
       if($valid)$products_added++;
      }
      $messageStack->add($products_added . ' ' . TEXT_PRODUCTS_ADDED , 'success');
        break;
      }

 

 

Similar Threads

  1. v150 I need help with my product listing please help im going insane!!
    By Darion in forum Templates, Stylesheets, Page Layout
    Replies: 10
    Last Post: 10 Sep 2012, 04:16 AM
  2. v150 I need help with my product listing please help im going insane!!
    By Darion in forum General Questions
    Replies: 1
    Last Post: 10 Sep 2012, 02:12 AM
  3. please help need help for reviews and tips page
    By abs007 in forum General Questions
    Replies: 2
    Last Post: 9 Apr 2009, 02:14 PM
  4. Need help with color scheme - URGENT PLEASE HELP
    By nepton in forum Templates, Stylesheets, Page Layout
    Replies: 4
    Last Post: 18 Nov 2008, 03:48 AM
  5. Mcafee scan says I need to fix I need help please??
    By touchclothing in forum General Questions
    Replies: 2
    Last Post: 30 Sep 2008, 08:57 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg