PHPCMS Background Login Path Modification method (V9 version)

Source: Internet
Author: User
Tags php define

The latest release of Phpcms V9 because of the MVC design pattern, so its background access address is fixed, although you can modify the routing configuration file to implement the modification, but each time the routing configuration file is a bit of a problem for me, and accidentally error. Here to use another one once and for all, to facilitate the modification of access to the background entrance, the whole modification is divided into two steps:

The first step:

Create a folder at the root of the Web site, will be through this folder to enter the background login interface, so the folder name is not easy to guess the name of a person easily guessed. Here as a demonstration, I'll take it as a admpub. Next, create a new file index.php in this folder, with the following contents:

<?php define (' Phpcms_path ', Realpath (dirname). ‘/..‘) . ‘/‘);

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 Two:

Create a new file my_index.php in the Phpcms/modules/admin/folder with the following contents:

<?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 ();

}

}

OK, the modifications are complete. In the future only through the admpub/directory access to the background login portal, if directly using Index.php?m=admin access, will jump directly to the homepage of the site, which prevents the background login access to the portal directly.

PHPCMS Background Login Path Modification method (V9 version)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.