Home > CMS Tutorial > PHPCMS > body text

What is the phpcms backend?

藏色散人
Release: 2020-07-17 10:04:47
Original
4175 people have browsed it

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.

What is the phpcms backend?

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(&#39;PHPCMS_PATH&#39;, realpath(dirname(__FILE__) . &#39;/..&#39;) . &#39;../&#39;); 
include PHPCMS_PATH . &#39;/phpcms/base.php&#39;; 
// pc_base::creat_app(); 
$session_storage = &#39;session_&#39; . pc_base :: load_config(&#39;system&#39;, &#39;session_storage&#39;); pc_base :: load_sys_class($session_storage); session_start(); $_SESSION[&#39;right_enter&#39;] = 1; unset($session_storage); header(&#39;location:../index.php?m=admin&#39;);
Copy after login

Step 2:

Create a new file MY_index.php in the phpcms/modules/admin/ folder , the content is:

<?php defined(&#39;IN_PHPCMS&#39;) or exit(&#39;No permission resources.&#39;);
class MY_index extends index {
public function __construct() {
if (empty($_SESSION[&#39;right_enter&#39;])) {
header(&#39;location:./&#39;);
exit;
}
parent :: __construct();
}
public function public_logout() {
$_SESSION[&#39;right_enter&#39;] = 0;
parent :: public_logout();
}
}
?>
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template