แสดงบทความที่มีป้ายกำกับ OsCommerce แสดงบทความทั้งหมด
แสดงบทความที่มีป้ายกำกับ OsCommerce แสดงบทความทั้งหมด

01 มีนาคม 2554

ช่วยด้วย พบปัญหา FATAL ERROR: register_globals is disabled in php.ini, please enable it!

ช่วยด้วยจ้า
พบปัญหา FATAL ERROR: register_globals is disabled in php.ini, please enable it!
ของ oscommerce จ้า
ใครก็ได้ ช่วยด้วยจ้า

01 มีนาคม 2553

1054 - Unknown column 'p.products_id' in 'on clause' ใน oscommerce

เกิดปัญหา

1054 - Unknown column 'p.products_id' in 'on clause'

select count(p.products_id) as total from products_description pd, products p left join manufacturers m on p.manufacturers_id = m.manufacturers_id, products_to_categories p2c left join specials s on p.products_id = s.products_id where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '4' and p2c.categories_id = '21'

[TEP STOP]


ไปหาในเน็ต เค้าว่าอย่างนี้ครับ
OSC ที่ทำจาก PHP4 แล้วมาใช้ใน PHP5
ให้ทำการแก้ไขไฟล์ตามนี้นะครับ!!

1. ไฟล์ index.php

หาข้อความนี้
------------------------------------------------------------------
// show the products of a specified manufacturer
if (isset($HTTP_GET_VARS['manufacturers_id'])) {
if (isset($HTTP_GET_VARS['filter_id']) && tep_not_null($HTTP_GET_VARS['filter_id'])) {
// We are asked to show only a specific category
$listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "'";
} else {
// We show them all
$listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where p.products_status = '1' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "'";
}
} else {
// show the products in a given categorie
if (isset($HTTP_GET_VARS['filter_id']) && tep_not_null($HTTP_GET_VARS['filter_id'])) {
// We are asked to show only specific catgeory
$listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'";
} else {
// We show them all
$listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'";
}
}
-------------------------------------------------------------------
แล้วให้แทนที่ของเดิมด้วย ตามนี้
-------------------------------------------------------------------
// show the products of a specified manufacturer
if (isset($HTTP_GET_VARS['manufacturers_id'])) {
if (isset($HTTP_GET_VARS['filter_id']) && tep_not_null($HTTP_GET_VARS['filter_id'])) {
// We are asked to show only a specific category
$listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from (" . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c ) left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "'";
} else {
// We show them all
$listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from (" . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m) left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where p.products_status = '1' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "'";
}
} else {
// show the products in a given categorie
if (isset($HTTP_GET_VARS['filter_id']) && tep_not_null($HTTP_GET_VARS['filter_id'])) {
// We are asked to show only specific catgeory
$listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from (" . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c) left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'";
} else {
// We show them all
$listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from ((" . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS . " p) left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c) left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'";
}
}

-------------------------------------------------------------------

และอีกไฟล์คือ advanced_search_result.php

หาข้อความนี้

-------------------------------------------------------------------
$from_str = "from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m using(manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c";
-------------------------------------------------------------------

แล้วแทนที่ด้วย

-------------------------------------------------------------------
$from_str = "from ((" . TABLE_PRODUCTS . " p) left join " . TABLE_MANUFACTURERS . " m using(manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd) left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c";
-------------------------------------------------------------------

21 พฤษภาคม 2552

เมื่อครูบ้านนอก งมหาข้อผิดพลาดของ OsCommerce

จากการที่เว็บ Hosting ได้ย้ายการขอใช้บริการ บริษัทแห่งหนึ่ง เพราะถูกโจมตีฐานข้มูล SQL ซึ่งลักษณะดังกล่าวไม่ได้ถูกขโมยข้อมูล ผู้ประสงค์ร้ายก็เลยใช้วิธีส่งข้อมูลเข้า Mysql ของเว็บใด เว็บหนึ่ง
ส่งผลให้เว็บอื่นๆในเครือข่ายของผู้ให้บริการ ล่มเหมือนกันหมด

สร้างความเสียหายมาก (ยอมรับว่า คนที่ทำ เลวจริงๆ รู้ไหมว่า มีคนเดือนร้อนมากมายขนาดไหน)

ทีนี้เมื่อมีการย้ายฐานข้อมูลมา ทำให้บางเว็บมีข้อมูลสูญหาย บางเว็บต้อง setup ใหม่หมดเลย

ในตอนนี้แหละ ทำให้ผมเรียนรู้ว่า
1. การทำเว็บด้วยโค๊ด HTML ดีที่สุด sql ล่ม ก็ยังใช้ได้ ข้อมูลเสียหาย ก็อัพ ได้
2. ต้องสำรองฐานข้อมูลบ่อยๆ และเน้นที่ฐานข้อมูลของระบบ CMS
3. เรียนรู้ในการป้องกัน ไม่เปิดช่องว่างให้ถูกโจมตี
4. คนที่ทำเลว แล้วสะใจ อย่าไปโกรธเคือง เพราะเขาคนนั้นมีวุฒิภาวะต่ำ อีกทั้งยังอาจขาดการเลี้ยงดูสั่งสอนที่ดี

ทีนี้เมื่อมาหาข้อผิดพลาดของ OsCommerce พบว่า พาทของฐานข้อมูลอันเก่าของเว็บไม่เหมือนกัน
และเวอร์ชั่นของ server ก็มี พาทการเรียกข้อมูลไม่เหมือนกัน

เอาเถอะ เรียนรู้เพื่อสร้างสิ่งใหม่ๆ
อนาคต รวยแน่นอน โดยเฉพาะ Adsense

20 พฤษภาคม 2552

ครูบ้านนอก กับปัญหา OsCommerce

เมื่อวานมีการย้าย host ทำให้ระบบที่ MySQL ต้อง setup ใหม่ทั้งหมด
และเมื่อดำเนินการแล้ว ก็พบปัญหาของ OsCommerce ดังนี้

1. ลง oscommerce แล้วพอกด "เครื่องมือดูแลระบบ(administration tool)" มันก็ขึ้นว่า
Fatal error: Cannot re-assign $this in C:\AppServ\www\oscommerce-2.2ms2 Thai Edition\catalog\admin\includes\classes\upload.php on line 31

วิธีแก้ไข
เข้าไปที่ part C:\AppServ\www\oscommerce-2.2ms2 Thai Edition\catalog\admin\includes\classes\upload.php
คลิ๊กขวา edit file upload.php ตรงบรรทัดที่ 31 เพิ่ม $this = null; แก้เป็น // $this = null;
ให้คะแนนข้อเขียนนี้...คุณจะให้กี่ดาวดีจ๊ะ