How to change the background login address in phpcms?
Many people know that the default phpcmsv9 background management path is not safe for the website. However, we can use some simple techniques to modify the background management login path. After modification, others will We can no longer access our backend login address using the default path.
phpcmsv9 can also modify the background path by default, but his method must bind a second-level domain name, which is very inconvenient. The method we introduce today is very simple and can be completed in two steps:
The first step: Create a folder in the root directory of the website. You will use this folder to enter the backend login interface in the future, so the folder name should be a name that you can remember and will not be easily guessed by others. As a demonstration here, I will call it tianxing. Then, 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 with the content:
<?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(); } } ?>
After the above two steps of setup, we are done. After the modification is completed, the backend login portal can only be accessed through the tianxing/ directory. If you directly use admin.php and index.php?m=admin to access it, it will jump directly to the homepage of the website, thus preventing access to the backend login portal. of direct access.
The above method is to set a session value in the login entry file, and before entering the background, go back and judge if there is this session value or the session value is correct, you will log in. .
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 background login address in phpcms. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Atom editor mac version download
The most popular open source editor

Dreamweaver Mac version
Visual web development tools

SublimeText3 Linux new version
SublimeText3 Linux latest version