📄 members.php
字号:
if($grouptitlenew && ($creditshighernew || $creditslowernew)) {
$db->query("INSERT INTO $table_usergroups (grouptitle, status, creditshigher, creditslower, stars, groupavatar, allowvisit, allowview, allowpost, allowsigbbcode)
VALUES ('$grouptitlenew', 'Member', '$creditshighernew', '$creditslowernew', '$starsnew', '$groupavatarnew', '1', '1', '1', '1')");
}
if(is_array($group_title)) {
$ids = $comma = "";
foreach($group_title as $id => $title) {
if($delete[$id]) {
$ids .= "$comma'$id'";
$comma = ', ';
} else {
$db->query("UPDATE $table_usergroups SET grouptitle='$group_title[$id]', creditshigher='$group_creditshigher[$id]', creditslower='$group_creditslower[$id]', stars='$group_stars[$id]', groupavatar='$group_avatar[$id]' WHERE groupid='$id'");
}
}
}
if($ids) {
$db->query("DELETE FROM $table_usergroups WHERE groupid IN ($ids)");
}
} else {
if(!$confirmed) {
cpmsg("本操作不可恢复,您确定要清除现有<br>记录并把用户组设定恢复默认吗?", "admincp.php?action=usergroups&type=member&reset=yes&groupsubmit=yes", "form");
} else {
$db->query("DELETE FROM $table_usergroups WHERE status='Member' AND specifiedusers=''");
$groupreset =
<<<EOT
INSERT INTO cdb_usergroups VALUES ('', '', 'Member', 'Newbie', 0, 50, 1, '', 0, 0, 1, 1, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 20, 0, 80, 0, 0, 0, '');
INSERT INTO cdb_usergroups VALUES ('', '', 'Member', 'Member', 50, 200, 2, '', 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 30, 0, 100, 4, 10, 0, '');
INSERT INTO cdb_usergroups VALUES ('', '', 'Member', 'Conqueror', 200, 500, 3, '', 0, 2, 1, 1, 1, 1, 1, 0, 1, 2, 0, 0, 0, 1, 0, 1, 0, 0, 0, 50, 0, 150, 6, 15, 256000, 'gif,jpg,png');
INSERT INTO cdb_usergroups VALUES ('', '', 'Member', 'Lord', 500, 1000, 4, '', 1, 2, 1, 1, 1, 1, 1, 1, 1, 2, 1, 0, 0, 1, 0, 1, 0, 0, 0, 60, 0, 200, 10, 30, 512000, 'zip,rar,chm,txt,gif,jpg,png');
INSERT INTO cdb_usergroups VALUES ('', '', 'Member', 'King', 1000, 3000, 6, '', 1, 2, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 0, 0, 0, 80, 0, 300, 15, 40, 1024000, '');
INSERT INTO cdb_usergroups VALUES ('', '', 'Member', 'Forum Legend', 3000, 9999999, 8, '', 1, 2, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 0, 0, 0, 100, 0, 500, 20, 50, 2048000, '');
INSERT INTO cdb_usergroups VALUES ('', '', 'Member', 'Beggar', -9999999, 0, 0, '', 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '');
EOT;
$sqlquery = splitsql($groupreset);
foreach($sqlquery as $sql) {
$db->query($sql);
}
updatecache("usergroups");
cpmsg("用户会员组成功恢复。");
}
}
} elseif($type == "specified") {
if($specifiedusersnew) {
$specified = trim($specifiedusersnew);
$comma = ", ";
} else {
$specified = $comma = "";
}
if(is_array($group_specifiedusers)) {
foreach($group_specifiedusers as $user) {
$specified .= $comma.trim($user);
$comma = ", ";
}
}
$admins = $comma = "";
$specified = "'".str_replace(",", "', '", str_replace(" ", "", $specified))."'";
$query = $db->query("SELECT username FROM $table_members WHERE username IN ($specified) AND (status='Admin' OR status='SuperMod' OR status='Moderator')");
while($member = $db->fetch_array($query)) {
$admins .= "$comma$member[username]";
$comma = ", ";
}
if($admins) {
cpmsg("对不起,特殊用户组中包含管理员或版主($admins),这可能造成管理权限的丢失,您可以通过其他设置方式达到所需的权限设定,请返回修改。");
}
if($grouptitlenew && $specifiedusersnew) {
$specifiedusersnew = "\t".str_replace(",", "\t", str_replace(" ", "", $specifiedusersnew))."\t";
$db->query("INSERT INTO $table_usergroups (grouptitle, specifiedusers, status, stars, groupavatar, allowvisit, allowview, allowpost, allowsigbbcode)
VALUES ('$grouptitlenew', '$specifiedusersnew', 'Member', '$starsnew', '$groupavatarnew', '1', '1', '1', '1')");
}
if(is_array($group_title)) {
$ids = $comma = "";
foreach($group_title as $id => $title) {
if($delete[$id]) {
$ids .= "$comma'$id'";
$comma = ", ";
} else {
$group_specifiedusers[$id] = "\t".str_replace(",", "\t", str_replace(" ", "", $group_specifiedusers[$id]))."\t";
$db->query("UPDATE $table_usergroups SET grouptitle='$group_title[$id]', specifiedusers='$group_specifiedusers[$id]', stars='$group_stars[$id]', groupavatar='$group_avatar[$id]' WHERE groupid='$id'");
}
}
}
if($ids) {
$db->query("DELETE FROM $table_usergroups WHERE groupid IN ($ids)");
}
} elseif($type == "system") {
if(is_array($group_title)) {
foreach($group_title as $id => $title) {
$db->query("UPDATE $table_usergroups SET grouptitle='$group_title[$id]', stars='$group_stars[$id]', groupavatar='$group_avatar[$id]' WHERE groupid='$id'");
}
}
}
updatecache("usergroups");
cpmsg("用户组成功更新。如您添加了新的用户组,<br>请不要忘记修改其相应的权限设置");
}
} elseif($action == 'ipban') {
if(!$ipbansubmit) {
require $discuz_root.'./include/misc.php';
$iptoban = explode('.', $extr);
$ipbanned = '';
$query = $db->query("SELECT * FROM $table_banned ORDER BY dateline");
while($banned = $db->fetch_array($query)) {
for($i = 1; $i <= 4; $i++) {
if ($banned["ip$i"] == -1) {
$banned["ip$i"] = '*';
}
}
$ipdate = gmdate("$dateformat $timeformat", $banned[dateline] + $timeoffset * 3600);
$theip = "$banned[ip1].$banned[ip2].$banned[ip3].$banned[ip4]";
$ipbanned .= "<tr align=\"center\">\n".
"<td bgcolor=\"".ALTBG1."\"><input type=\"checkbox\" name=\"delete[".$banned[id]."]\" value=\"$banned[id]\"></td>\n".
"<td bgcolor=\"".ALTBG2."\">$theip</td>\n".
"<td bgcolor=\"".ALTBG1."\">".convertip($theip, "./")."</td>\n".
"<td bgcolor=\"".ALTBG2."\">$banned[admin]</td>\n".
"<td bgcolor=\"".ALTBG1."\">$ipdate</td></tr>\n";
}
?>
<table cellspacing="0" cellpadding="0" border="0" width="75%" align="center">
<tr><td bgcolor="<?=BORDERCOLOR?>">
<table border="0" cellspacing="<?=BORDERWIDTH?>" cellpadding="<?=TABLESPACE?>" width="100%">
<tr class="header"><td>特别提示</td></tr>
<tr bgcolor="<?=ALTBG1?>"><td>
<br><ul><li>您的 IP 地址为:<?=$onlineip?></ul>
<ul><li>要禁止某地址段,请在下面地址中该部分用“*”代替。</ul>
</td></tr></table></td></tr></table>
<form method="post" action="admincp.php?action=ipban">
<table cellspacing="0" cellpadding="0" border="0" width="75%" align="center">
<tr><td bgcolor="<?=BORDERCOLOR?>">
<table border="0" cellspacing="<?=BORDERWIDTH?>" cellpadding="<?=TABLESPACE?>" width="100%">
<tr class="header" align="center">
<td width="45"><input type="checkbox" name="chkall" class="header" onclick="checkall(this.form)">删?</td>
<td>IP 地址</td><td>地理位置</td><td>管理员</td><td>加入时间</td></tr>
<?=$ipbanned?>
<tr bgcolor="<?=ALTBG2?>"><td colspan="5" height="1"></td></tr>
<tr bgcolor="<?=ALTBG1?>">
<td colspan="5">禁止新 IP:<b>
<input type="text" name="ip1new" value="<?=$iptoban[0]?>" size="3" maxlength="3"> .
<input type="text" name="ip2new" value="<?=$iptoban[1]?>" size="3" maxlength="3"> .
<input type="text" name="ip3new" value="<?=$iptoban[2]?>" size="3" maxlength="3"> .
<input type="text" name="ip4new" value="<?=$iptoban[3]?>" size="3" maxlength="3"></b></td>
</tr></table></td></tr></table><br>
<center><input type="submit" name="ipbansubmit" value="更新 IP 禁止列表"></center>
</form>
<?
} else {
if($ip1new != '' && $ip2new != '' && $ip3new != '' && $ip4new != '') {
$own = 0;
$ip = explode('.', $onlineip);
for($i = 1; $i <= 4; $i++) {
if(!is_numeric(${'ip'.$i.'new'})) {
${'ip'.$i.'new'} = -1;
$own++;
} elseif(${'ip'.$i.'new'} == $ip[$i - 1]) {
$own++;
}
${'ip'.$i.'new'} = intval(${'ip'.$i.'new'});
}
if($own == 4) {
cpmsg('操作错误!您自己的 IP 已经存在于禁止列表中,请返回修改。');
}
$query = $db->query("SELECT * FROM $table_banned");
while($banned = $db->fetch_array($query)) {
$exists = 0;
for($i = 1; $i <= 4; $i++) {
if($banned["ip$i"] == -1) {
$exists++;
} elseif($banned["ip$i"] == ${"ip".$i."new"}) {
$exists++;
}
}
if($exists == 4) {
cpmsg("新的禁止 IP 已经存在于列表中,请返回。");
}
}
$db->query("DELETE FROM $table_sessions WHERE ip LIKE '".str_replace('-1', '%', "$ip1new.$ip2new.$ip3new.$ip4new")."'");
$db->query("INSERT INTO $table_banned (ip1, ip2, ip3, ip4, admin, dateline)
VALUES ('$ip1new', '$ip2new', '$ip3new', '$ip4new', '$discuz_user', '$timestamp')");
}
$ids = $comma = '';
if(is_array($delete)) {
foreach($delete as $id) {
$ids .= "$comma'$id'";
$comma = ', ';
}
}
if($ids) {
$db->query("DELETE FROM $table_banned WHERE id IN ($ids)");
}
cpmsg('IP 禁止列表成功更新。');
}
}
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -