行業(yè)動態(tài)
ECSHOP修改后臺地址的方法
發(fā)布日期:2012-11-16 閱讀次數(shù):3725 字體大小:

為什么要修改后臺登陸地址呢?很簡單,為了更安全。因為不是你一個人在用Ecshop,很多人在用,用的人多了,關(guān)注的人也就多了,當然也包括黑客了。既然大家都知道了后臺的登陸地址是/admin,那么黑客說實話,就方便多了。一般我們使用開源的系統(tǒng)時,都會修改默認的東西,包括數(shù)據(jù)庫名,數(shù)據(jù)表名(這個最好是在安裝的時候就設(shè)置,要不改著麻煩),今天就教你如何修改后臺登陸地址,讓你的網(wǎng)店更加安全些。

PHP代碼
  1.   
  2. 1.修改data/config.php$admin_dir="admin";修改成$admin_dir="新目錄名";   
  3.   
  4. 分行2.修改admin/index.php//貨號require_once(ROOT_PATH.'admin/includes/lib_goods.php');修改成require_once(ROOT_PATH.$admin_dir.'/includes/lib_goods.php');   
  5.   
  6. 分行3.修改admin/database.phprequire_once(ROOT_PATH.'admin/includes/cls_sql_dump.php');修改成require_once(ROOT_PATH.$admin_dir.'/includes/cls_sql_dump.php');   
  7.   
  8. 分行4.修改admin/get_password.php$reset_email=$ecs->url().'admin/get_password.php?act=reset_pwd&uid='.$admin_id.'&code='.$code;修改成$reset_email=$ecs->url().$admin_dir.'/get_password.php?act=reset_pwd&uid='.$admin_id.'&code='.$code;   
  9.   
  10. 分行5.修改admin/goods.phprequire_once(ROOT_PATH.'/admin/includes/lib_goods.php');修改成require_once(ROOT_PATH.$admin_dir.'/includes/lib_goods.php');   
  11.   
  12. 分行6.修改admin/check_file_priv.php$dir[]='admin';修改成$dir[]=$admin_dir;   
  13.   
  14. 分行7.修改admin/includes/init.phpif(file_exists(ROOT_PATH.'data/config.php')){include(ROOT_PATH.'data/config.php')   
  15.   
  16. }else{include(ROOT_PATH.'includes/config.php');}   
  17.   
  18. 修改成下面代碼,并將代碼移至“”注釋之前。   
  19.   
  20. if(file_exists('../data/config.php')){include('../data/config.php');}   
  21.   
  22. else{include('../includes/config.php');}   
  23.   
  24. 分行define('ROOT_PATH',str_replace('admin/includes/init.php','',str_replace('\\','/',__FILE__)));修改成define('ROOT_PATH',str_replace($admin_dir.'/includes/init.php','',str_replace('\\','/',__FILE__)));
  25.  
  26. 分行require(ROOT_PATH.'admin/includes/lib_main.php');
  27. 修改成require(ROOT_PATH.$admin_dir.'/includes/lib_main.php');
  28.  
  29. 分行require(ROOT_PATH.'admin/includes/cls_exchange.php');
  30. 修改成require(ROOT_PATH.$admin_dir.'/includes/cls_exchange.php');
  31.  
  32. 分行$smarty->template_dir=ROOT_PATH.'admin/templates';
  33. 修改成$smarty->template_dir=ROOT_PATH.$admin_dir.'/templates';
  34.  
  35. 分行$admin_path=preg_replace('/:\d+/','',$ecs->url()).'admin';
  36. 修改成$admin_path=preg_replace('/:\d+/','',$ecs->url()).$admin_dir;  
  37.  
  38. 分行8.修改  
  39.  
  40. include/lib_main.phpinclude_once(ROOT_PATH.'admin/includes/lib_template.php');
  41. 修改成global$admin_dir;include_once(ROOT_PATH.$admin_dir.'/includes/lib_template.php');  
  42.  
  43. 分行9.修改include/cls_ecshop.php  
  44. $curr=strpos(PHP_SELF,'admin/')!==false?preg_replace('/(.*)(admin)(\/?)(.)*/i','\1',dirname(PHP_SELF)):dirname(PHP_SELF);
  45. 修改成global$admin_dir;$curr=strpos(PHP_SELF,$admin_dir.'/')!==false?preg_replace('/(.*)('.$admin_dir.')(\/?)(.)*/i','\1',dirname(PHP_SELF)):dirname(PHP_SELF);
  46.  
  47. 分行10.修改/admin/picture_batch.php將include_once(ROOT_PATH.'/admin/includes/lib_goods.php');
  48. 修改成include_once(ROOT_PATH.$admin_dir.'/includes/lib_goods.php');
  49.  
  50. 分行11.修改quotation.phpinclude_once(ROOT_PATH.'admin/includes/lib_main.php');
  51. 修改成global$admin_dir;include_once(ROOT_PATH.$admin_dir.'/includes/lib_main.php');