第一步:
在網(wǎng)站根目錄創(chuàng)建一個(gè)文件夾,以后就要通過這個(gè)文件夾進(jìn)入后臺(tái)登錄界面的,所以文件夾名就要取一個(gè)不易被人輕易猜到的名稱。這里作為演示,我就取為 phpcms8 好了。接著,在這個(gè)文件夾里新建一個(gè)文件index.php,內(nèi)容為:
define('PHPCMS_PATH', realpath(dirname(__FILE__) . '/..') . '/'); include PHPCMS_PATH . '/phpcms/base.php'; // pc_base::creat_app(); $session_storage = 'session_' . pc_base :: load_config('system', 'session_storage'); pc_base :: load_sys_class($session_storage); session_start(); $_SESSION['right_enter'] = 1; unset($session_storage); header('location:../index.php?m=admin');
第二步:
在 phpcms/modules/admin/ 文件夾里新建一個(gè)文件 MY_index.php,內(nèi)容為:
defined('IN_PHPCMS') or exit('No permission resources.'); class MY_index extends index { public function __construct() { if(empty($_SESSION['right_enter'])) { header('location:./');exit; } parent::__construct(); } public function public_logout() { $_SESSION['right_enter'] = 0; parent::public_logout(); } } --Vevb.com
第三步:
打開robots.txt
增加 Disallow:/phpcms8
意思是禁止蜘蛛索引,好了,修改完成,以后就只能通過 phpcms8/ 目錄訪問后臺(tái)登錄入口 了,如果直接使用 index.php?m=admin 訪問的話,會(huì)直接跳轉(zhuǎn)到網(wǎng)站首頁(yè),這樣就阻止了對(duì)后臺(tái)登錄入口的直接訪問了.
新聞熱點(diǎn)
疑難解答
圖片精選