Home > CMS Tutorial > PHPCMS > How to change the phpcms background path

How to change the phpcms background path

Release: 2020-01-15 17:11:30
Original
2853 people have browsed it

How to change the phpcms background path

How to modify the phpcms background path:

Method 1: Change it to a second-level domain name in the management background.

How to change the phpcms background path

##In the management background: Settings > Related Settings > Security Configuration > Backend access domain name, enter the custom second-level domain name admin.cmsyou.com, You can only log in through this domain name (if you need to remove the binding, you need to modify the parameter admin_url in /caches/configs/system.php to manually cancel the binding).

After that, admin.cmsyou.com is resolved to this host in the domain name resolution, and the host is also bound to it. In addition, the default index order index.php is set first, so that the management backend entrance is modified.

Method 2: Determine the management entrance based on the custom SESSION value.

This method requires modifying the default phpcms php file, customizing a portal to start SESSION, and then judging the SESSION. If it matches, log in, if not, jump to the home page. CMSYOU currently uses this method.

1. Modify the \phpcms\modules\admin\index.php file and add at the beginning of the public function __construct() method:

//login diy
if (empty($_SESSION['cms_login'])) {
header('location:'.APP_PATH);
exit;
}
Copy after login

Also find the public function public_logout() method, in the sentence First add the line

$_SESSION['cms_login'] = 0;
Copy after login

. This will clear the cms_login SESSION value after exiting.

2. Then customize a php file to enable the cms_login SESSION value for matching:

Create a new admin\ directory in the root directory of the website, and create a new file index.php in this directory. The content is as follows:

<?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;cms_login&#39;] = 1;
unset($session_storage);
header(&#39;location:../index.php?m=admin&#39;);
?>
Copy after login

PHP Chinese website, a large number of free

PHPCMS tutorials, welcome to learn online!

The above is the detailed content of How to change the phpcms background path. 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