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