Imperial CMS Secondary Development Tutorial: Prohibit a user group from logging in to ensure website security

Imperial CMS secondary thinking

By default, Empire CMS does not have functions like discuz, nor does it restrict certain users from using the website. If some users maliciously use the website, what should the webmaster do if he does not want to provide services to these users?

The background can delete the account and ban the IP, but after the deletion, the user name can be used to re-register the account with the previous information, which is a temporary solution, not a permanent cure.

We need to re-develop a way to retain the user's information, keep the email or mobile phone number information for registration verification, prevent repeated registration, and prevent him from continuing to log in to use website functions. I share a secondary development method of Empire cms, which can ban a certain Some users are logged in.

Imperial CMS Secondary Development Method

1. First go to the background user management menu, create a new user group "Little Black Room" to store Black Mamba users, remember the user group ID

Imperial CMS secondary thinking

By default, Empire CMS does not have functions like discuz, nor does it restrict certain users from using the website. If some users maliciously use the website, what should the webmaster do if he does not want to provide services to these users?

The background can delete the account and ban the IP, but after the deletion, the user name can be used to re-register the account with the previous information, which is a temporary solution, not a permanent cure.

We need to re-develop a way to retain the user's information, keep the email or mobile phone number information for registration verification, prevent repeated registration, and prevent him from continuing to log in to use website functions. I share a secondary development method of Empire cms, which can ban a certain Some users are logged in.

Imperial CMS Secondary Development Method

1. First go to the background user management menu, create a new user group "Little Black Room" to store Black Mamba users, remember the user group ID

 

Screenshot of user group setting method

2. Find /e/member/class/member_loginfun.php

3. Search

1

2

3

4

5

//IP

$lastip=egetip();

$lastipport=egetipport();

$usql=$empire->query("update ".eReturnMemberTable()." set ".egetmf('rnd')."='$rnd',".egetmf('groupid')."='$r[groupid]' where ".egetmf('userid')."='$r[userid]'");

$empire->query("update {$dbtbpre}enewsmemberadd set lasttime='$lasttime',lastip='$lastip',loginnum=loginnum+1,lastipport='$lastipport' where userid='$r[userid]'");

4. Add the restricted login code below

1

2

3

if($r['groupid']==小黑屋用户组ID){

printerror("该账号涉嫌恶意使用已被禁止登录使用!","history.go(-1)",1,0,1);

}

Interpretation: When logging in, determine the user group ID of the user. If it is equal, pop up a window and return to the previous page, and do not continue to execute the following code. It's as simple as that.

Screenshot of user group setting method

2. Find /e/member/class/member_loginfun.php

3. Search

1

2

3

4

5

//IP

$lastip=egetip();

$lastipport=egetipport();

$usql=$empire->query("update ".eReturnMemberTable()." set ".egetmf('rnd')."='$rnd',".egetmf('groupid')."='$r[groupid]' where ".egetmf('userid')."='$r[userid]'");

$empire->query("update {$dbtbpre}enewsmemberadd set lasttime='$lasttime',lastip='$lastip',loginnum=loginnum+1,lastipport='$lastipport' where userid='$r[userid]'");

4. Add the restricted login code below

1

2

3

if($r['groupid']==小黑屋用户组ID){

printerror("该账号涉嫌恶意使用已被禁止登录使用!","history.go(-1)",1,0,1);

}

Interpretation: When logging in, determine the user group ID of the user. If it is equal, pop up a window and return to the previous page, and do not continue to execute the following code. It's as simple as that.

Guess you like

Origin blog.csdn.net/winkexin/article/details/131350012