Tutorial: How to set discuz that only the administrator can access the background?

admin.php is the default backend address of discuz, which can be accessed directly under normal circumstances. In order to prevent some malicious access, the following content can be modified to improve security performance.
Open the admin.php file,

Find

$discuz->init();

Add the following code below and it will work

if(! G [ ′ u i d ′ ] ∣ ∣ ! g e t s t a t u s ( _G['uid'] || !getstatus( G[uid]!getstatus(_G[‘member’][‘allowadmincp’], 1)) {header(‘Location: /’);

}

The function of this code: If you are not an administrator, you cannot access the forum backend page but jump to the homepage, which greatly enhances the backend protection. You can also change Location: / to the URL you want to redirect to.

Guess you like

Origin blog.csdn.net/dafanpai/article/details/109852166