行业动态
ECSHOP修改后台地址的方法
发布日期:2012-11-16 阅读次数:3747 字体大小:

为什么要修改后台登陆地址呢?很简单,为了更安全。因为不是你一个人在用Ecshop,很多人在用,用的人多了,关注的人也就多了,当然也包括黑客了。既然大家都知道了后台的登陆地址是/admin,那么黑客说实话,就方便多了。一般我们使用开源的系统时,都会修改默认的东西,包括数据库名,数据表名(这个最好是在安装的时候就设置,要不改着麻烦),今天就教你如何修改后台登陆地址,让你的网店更加安全些。

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');