PHPCMS V9隐藏后台入口的方法

Step1 建立如/asdf123/index.php, 作为新的登录入口, 其中代码如下

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

Step2 建立/phpcms/modules/admin/MY_index.php, 其中代码如下

<?php
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();
  }
}

然后就可以用www.domain.com/asdf123来访问后台入口啦