ecshop v4.0.8問題分析
ecshop v4.0.8安裝后出現MySQL server error report:Array ( [0] => Array ( [message] => MySQL Query Error ) [1] => Array ( [sql] => select value from ecs_shop_config where code = 'shop_logo' ) [2] => Array ( [error] => Table 'ecshop.ecs_shop_config' doesn't exist ) [3] => Array ( [errno] => 1146 ) )
分析源代碼后發現,許多代碼處使用ecs_為前綴,安裝時定義的表前綴仍未生效,因此需要對源碼進行修改。如果使用默認的ecs_表前綴當然不會有問題,但這樣就不安全,如果改就會出問題,也就是說要么就去授權,要么就別用。
ecshop v4.0.8ecshop修改表前綴后打不開解決方法
1、首次出現的地方是/includes/lib_main的1164行如下:
自定義導航欄
$sql = "select value from ecs_shop_config where code = 'shop_logo' ";
$shop_logo = $GLOBALS['db']->getRow($sql);
需要修改為
$sql = "select value from ".$GLOBALS['ecs']->table("shop_config")." where code = 'shop_logo' ";
2、/index.php 161行
$sql = "select a.position_id,a.position_name,b.ad_link,b.ad_code from ecs_ad_position a left join ecs_ad b on a.position_id = b.position_id where a.position_name like '%pcindex圖片%' and b.enabled ='1";
修改為
$sql = "select a.position_id,a.position_name,b.ad_link,b.ad_code from ".$GLOBALS['ecs']->table("ad_position")." a left join ".$GLOBALS['ecs']->table("ad")." b on a.position_id = b.position_id where a.position_name like '%pcindex圖片%' and b.enabled ='1'";
3、此外/admin/mobile_setting.php這個腳本出現也比較多,大家需要自行修改,修改的方法是將原來sql語句中的表名稱進行修改,例如表名稱為ecs_ad,我們要修改為".$GLOBALS['ecs']->table("ad").",其他地方只要是出現了就是修改。
青鋒建站,提供專業的高品質網站制作服務,使用的建站系統包括:ecshop建站、dedecms建站、phpcms建站、wordpress建站、opencart建站;包括網站建設,SEO,網絡營銷,PHP開發,網站建設知名品牌,全國接單,為企業構建強有力的營銷平臺。
青鋒建站,提供專業的高品質網站制作服務,使用的建站系統包括:ecshop建站、dedecms建站、phpcms建站、wordpress建站、opencart建站;包括網站建設,SEO,網絡營銷,PHP開發,網站建設知名品牌,全國接單,為企業構建強有力的營銷平臺。