为什么要修改后台登陆地址呢?很简单,为了更安全。因为不是你一个人在用Ecshop,很多人在用,用的人多了,关注的人也就多了,当然也包括黑客了。既然大家都知道了后台的登陆地址是/admin,那么黑客说实话,就方便多了。一般我们使用开源的系统时,都会修改默认的东西,包括数据库名,数据表名(这个最好是在安装的时候就设置,要不改着麻烦),今天就教你如何修改后台登陆地址,让你的网店更加安全些。
PHP代码
- 1.修改data/config.php$admin_dir="admin";修改成$admin_dir="新目录名";
- 分行2.修改admin/index.php//货号require_once(ROOT_PATH.'admin/includes/lib_goods.php');修改成require_once(ROOT_PATH.$admin_dir.'/includes/lib_goods.php');
- 分行3.修改admin/database.phprequire_once(ROOT_PATH.'admin/includes/cls_sql_dump.php');修改成require_once(ROOT_PATH.$admin_dir.'/includes/cls_sql_dump.php');
- 分行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;
- 分行5.修改admin/goods.phprequire_once(ROOT_PATH.'/admin/includes/lib_goods.php');修改成require_once(ROOT_PATH.$admin_dir.'/includes/lib_goods.php');
- 分行6.修改admin/check_file_priv.php$dir[]='admin';修改成$dir[]=$admin_dir;
- 分行7.修改admin/includes/init.phpif(file_exists(ROOT_PATH.'data/config.php')){include(ROOT_PATH.'data/config.php')
- }else{include(ROOT_PATH.'includes/config.php');}
- 修改成下面代码,并将代码移至“”注释之前。
- if(file_exists('../data/config.php')){include('../data/config.php');}
- else{include('../includes/config.php');}
- 分行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__)));
- 分行require(ROOT_PATH.'admin/includes/lib_main.php');
- 修改成require(ROOT_PATH.$admin_dir.'/includes/lib_main.php');
- 分行require(ROOT_PATH.'admin/includes/cls_exchange.php');
- 修改成require(ROOT_PATH.$admin_dir.'/includes/cls_exchange.php');
- 分行$smarty->template_dir=ROOT_PATH.'admin/templates';
- 修改成$smarty->template_dir=ROOT_PATH.$admin_dir.'/templates';
- 分行$admin_path=preg_replace('/:\d+/','',$ecs->url()).'admin';
- 修改成$admin_path=preg_replace('/:\d+/','',$ecs->url()).$admin_dir;
- 分行8.修改
- include/lib_main.phpinclude_once(ROOT_PATH.'admin/includes/lib_template.php');
- 修改成global$admin_dir;include_once(ROOT_PATH.$admin_dir.'/includes/lib_template.php');
- 分行9.修改include/cls_ecshop.php
- $curr=strpos(PHP_SELF,'admin/')!==false?preg_replace('/(.*)(admin)(\/?)(.)*/i','\1',dirname(PHP_SELF)):dirname(PHP_SELF);
- 修改成global$admin_dir;$curr=strpos(PHP_SELF,$admin_dir.'/')!==false?preg_replace('/(.*)('.$admin_dir.')(\/?)(.)*/i','\1',dirname(PHP_SELF)):dirname(PHP_SELF);
- 分行10.修改/admin/picture_batch.php将include_once(ROOT_PATH.'/admin/includes/lib_goods.php');
- 修改成include_once(ROOT_PATH.$admin_dir.'/includes/lib_goods.php');
- 分行11.修改quotation.phpinclude_once(ROOT_PATH.'admin/includes/lib_main.php');
- 修改成global$admin_dir;include_once(ROOT_PATH.$admin_dir.'/includes/lib_main.php');