Home >CMS Tutorial >PHPCMS >What is the phpcms backend?
phpcms backend address is "your domain name/admin.php". Because PHPCMS adopts the MVC design pattern, its backend access address is fixed. Although it can be modified by modifying the routing configuration file, But it will be troublesome to modify the routing configuration file every time.
phpcmsThe default backend address is: "your domain name/admin.php
".
The latest release of PHPCMS V9 adopts the MVC design pattern, so its background access address is fixed. Although it can be modified by modifying the routing configuration file, it is difficult for me to modify the routing configuration file every time. It's a bit troublesome, and mistakes can happen if you're not careful. Another once-and-for-all method is used here to achieve the purpose of conveniently modifying the access to the backend entrance. The entire modification is divided into two steps:
The first step:
Create a folder in the root directory of the website, In the future, you will use this folder to enter the backend login interface, so the folder name must be a name that is not easy for others to guess. As a demonstration here, I will call it managers. Next, create a new file index.php in this folder with the content:
<?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');
Step 2:
Create a new file MY_index.php in the phpcms/modules/admin/ folder , the content is:
<?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(); } } ?>
Okay, the modification is completed. In the future, you can only access the backend login portal through the managers/ directory. If you directly use index.php?m=admin to access it, it will jump directly to the homepage of the website, thus preventing direct access to the backend login portal.
The above is the detailed content of What is the phpcms backend?. For more information, please follow other related articles on the PHP Chinese website!