1. Modify the admin.php file name, modify the jump address and write the complete path. The specific modifications are as follows:
<?php header('location:index.php?m=admin'); ?>
Replace the "index" in the code .php?m=admin" to a specific URL, such as: https://www.php.cn/myadmin/index.php.
2. Modify /phpcms/modules/admin/index.php and change the public function login to the address you want:
Find "?m=admin&c=index&a=login" to proceed Bulk replacement.
3. Modify /phpcms/modules/admin/classes/admin.class.php
3.1 Modify the following code:
final public function check_admin() { if(ROUTE_M =='admin' && ROUTE_C =='index' && in_array(ROUTE_A, array('login', 'public_card'))) {
to:
final public function check_admin() { if(ROUTE_M =='admin' && ROUTE_C =='index' && in_array(ROUTE_A, array('新登录函数名', 'public_card'))) {
3.2 Modify the code
if(!isset($_SESSION['userid']) || !isset($_SESSION['roleid']) || !$_SESSION['userid'] || !$_SESSION['roleid']) showmessage(L('admin_login'),'m=admin&c=index&a=login');
to
if(!isset($_SESSION['userid']) || !isset($_SESSION['roleid']) || !$_SESSION['userid'] || !$_SESSION['roleid']) showmessage(L('admin_login'),APP_PATH);
Note: This modification will avoid jumping to the homepage of the website, because you will never be able to type without knowing the exact address. Open the login page.
3.3 Change the code
final public function check_priv() { if(ROUTE_M =='admin' && ROUTE_C =='index' && in_array(ROUTE_A, array('login', 'init', 'public_card'))) return true;
to
final public function check_priv() { if(ROUTE_M =='admin' && ROUTE_C =='index' && in_array(ROUTE_A, array('新登录函数名', 'init', 'public_card'))) return true;
4. Modify /phpcms/modules/admin/templates/login.tpl.php
and change the code
<form action="index.php?m=admin&c=index&a=login&dosubmit=1" method="post" name="myform">
is modified to:
<form action="index.php?m=admin&c=index&a=新登录函数名&dosubmit=1" method="post" name="myform">
5. Search all files under /phpcms/modules/admin and change a=login to a=new login function name.
In this way, the default background address of phpcms v9 can be modified, such as https://www.php.cn/myadmin/index.php (myadmin/index.php is the modified file name).
Related recommendations: phpcms tutorial
The above is the detailed content of How to reset the backend URL in phpcms. For more information, please follow other related articles on the PHP Chinese website!