📄 user.php
字号:
<?php
session_start();
include "../include/query.php";
include "../include/functions.php";
if($_SESSION["administrator"]=="")
{
header("location:../notice.php?id=".admin_only);
exit;
}
timer();
$db = new db_query;
$db->connect();
?>
<html>
<head>
<title>
<?=getConfig("chatroom_name")?> -- 用户管理
</title>
<link rel="StyleSheet" type="text/css" href="../styles/admin.css">
<META http-equiv="Content-Type" content="text/html;charset=gb2312">
<Script language="javascript">
function selectAll(fm)
{
for(var i=0;i<fm.elements.length;i++)
{
var e = fm.elements[i];
if(e.name=="userid[]")
{
e.checked = fm.sl.checked;
}
}
}
function chkFm(fm)
{
if(fm.username.value=="")
{
alert("请填写用户名称!");
fm.username.focus();
return false;
}
}
function checkPassword(fm)
{
if(fm.username.value=="")
{
alert("请填写用户名!");
fm.username.focus();
return false;
}
if(fm.password.value=="")
{
alert("请填写密码!");
fm.password.focus();
return false;
}
if(fm.password.value.length<6)
{
alert("请填写大于6位的密码!");
fm.password.focus();
return false;
}
if(fm.password.value!=fm.reTypepassword.value)
{
alert("两次密码输入不正确!");
fm.password.focus();
fm.password.value = "";
fm.reTypepassword.value = "";
return false;
}
return true;
}
function viewinfo(name)
{
if(name=="")
{
alert("用户名称没有填写!");
return;
}
window.open("../member.php?mode=info&username="+name,"","Width=400,Height=510,statusbar=no,Top=0");
}
</script>
</head>
<body bgcolor="<?=getConfig("page_bgcolor")?>">
<?php
include "menu.php";
?>
<table width=700 align="center" cellspacing=0 cellpadding=0 class="messagebox">
<tr>
<td class="messagetitle">
用户管理
</td>
</tr>
<tr>
<td class="messageright">
<table width=700 cellspacing=1 cellpadding=2 bgcolor="black">
<tr>
<td colspan=2 align=center bgcolor="#6699ff">
<b>修改用户密码</b>
</td>
</tr>
<tr>
<td width=200 align="right" bgcolor="buttonface">
<form name="editPasswordForm" action="saveconfig.php?w=user" method="post" onsubmit="return checkPassword(this)">
<input type="hidden" name="act" value="editpassword">
用户名
</td>
<td width=500 bgcolor="white">
<input type="text" name="username" maxlength=20>
在用户密码被遗忘后,您可以修改用户目前的密码。
</td>
</tr>
<tr>
<td width=200 align="right" bgcolor="buttonface">
新密码
</td>
<td width=500 bgcolor="white">
<input type="password" name="password" maxlength=20>
输入该用户的新密码。
</td>
</tr>
<tr>
<td width=200 align="right" bgcolor="buttonface">
确认新密码
</td>
<td width=500 bgcolor="white">
<input type="password" name="reTypepassword" maxlength=20>
再一次输入该用户的新密码。
</td>
</tr>
<tr>
<td width=200 align="right" bgcolor="buttonface">
</td>
<td width=500 bgcolor="white">
<input type="submit" value="确认修改">
</td>
</tr>
</form>
<tr>
<td colspan=2 align=center bgcolor="#6699ff">
<form name="rankForm" action="saveconfig.php?w=user" method="post">
<input type="hidden" value="editrank" name="act">
<b>调整用户级别</b>
</td>
</tr>
<tr>
<td width=200 align="right" bgcolor="buttonface">
用户名
</td>
<td width=500 bgcolor="white">
<input type="text" name="username" maxlength=20> <input type="button" onclick="viewinfo(username.value)" value="查看信息">
</td>
</tr>
<tr>
<td width=200 align="right" bgcolor="buttonface">
新级别
</td>
<td width=500 bgcolor="white">
<select name="newrank">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
</select>
用户的新级别。
</td>
</tr>
<tr>
<td width=200 align="right" bgcolor="buttonface">
原因
</td>
<td width=500 bgcolor="white">
<input type="text" name="why" size=40>
</td>
</tr>
<tr>
<td width=200 align="right" bgcolor="buttonface">
禁止用户名
</td>
<td width=500 bgcolor="white">
<input type="checkbox" name="unupgrade" value=1>同时禁止该用户分数自动升级
</td>
</tr>
<tr>
<td width=200 align="right" bgcolor="buttonface">
</td>
<td width=500 bgcolor="white">
<input type="submit" value="调整级别">
</td>
</tr>
</form>
<tr>
<td colspan=2 align=center bgcolor="#6699ff">
<b>解禁用户名</b>
</td>
</tr>
<tr>
<td width=200 bgcolor="buttonface" align="right">
用户列表
</td>
<td width=500 bgcolor="white">
<form name="unforbidUserForm" action="saveconfig.php?w=user" method="post">
<input type="hidden" value="unforbid" name="act">
<table width=200 cellspacing=1 cellpadding=3 bgcolor="black">
<tr>
<td width=140 align="center" bgcolor="buttonface"><b>被禁用户名</b></td>
<td width=60 align="center" bgcolor="buttonface"><b><input type="checkbox" name="sl" onclick="selectAll(document.unforbidUserForm)"></b></td>
</tr>
<?php
$userResult = $db->query("select `username`,`id` from `members` where `forbid` = 1");
while($userRow = $db->fetchArray($userResult))
{
?>
<tr>
<td width=120 align="center" bgcolor="white"><?=$userRow["username"]?></td>
<td width=100 align="center" bgcolor="white"><input type="checkbox" name="userid[]" value="<?=$userRow["id"]?>"></td>
</tr>
<?php
}
?>
</table>
</td>
</tr>
<tr>
<td width=200 align="right" bgcolor="buttonface">
原因
</td>
<td width=500 bgcolor="white">
<input type="text" name="why" size=40>
</td>
</tr>
<tr>
<td width=200 align="right" bgcolor="buttonface">
</td>
<td width=500 bgcolor="white">
<input type="submit" value="解除封锁">
</td>
</tr>
</form>
<tr>
<td colspan=2 align=center bgcolor="#6699ff">
<b>禁止用户名</b>
</td>
</tr>
<tr>
<td width=200 align="right" bgcolor="buttonface">
<form name="forbidUserForm" action="saveconfig.php?w=user" method="post" onsubmit="return chkFm(this)">
<input type="hidden" name="act" value="forbid">
用户名
</td>
<td width=500 bgcolor="white">
<input type="text" name="username" maxlength=20> <input type="button" onclick="viewinfo(username.value)" value="查看信息">
</td>
</tr>
<tr>
<td width=200 align="right" bgcolor="buttonface">
原因
</td>
<td width=500 bgcolor="white">
<input type="text" name="why" size=40>
</td>
</tr>
<tr>
<td width=200 align="right" bgcolor="buttonface">
</td>
<td width=500 bgcolor="white">
<input type="submit" value="禁止用户">
</td>
</tr>
</form>
<tr>
<td colspan=2 align=center bgcolor="#6699ff">
<b>保护用户名</b>
</td>
</tr>
<tr>
<td width=200 bgcolor="buttonface" align="right">
用户列表
</td>
<td width=500 bgcolor="white">
<form name="protectedUserForm" action="saveconfig.php?w=user" method="post">
<input type="hidden" value="unprotec" name="act">
<table width=200 cellspacing=1 cellpadding=3 bgcolor="black">
<tr>
<td width=140 align="center" bgcolor="buttonface"><b>受保护用户名</b></td>
<td width=60 align="center" bgcolor="buttonface"><b><input type="checkbox" name="sl" onclick="selectAll(document.protectedUserForm)"></b></td>
</tr>
<?php
$protectedResult = $db->query("select `username`,`id` from `members` where `protected` = 1");
while($protectedRow = $db->fetchArray($protectedResult))
{
?>
<tr>
<td width=120 align="center" bgcolor="white"><?=$protectedRow["username"]?></td>
<td width=100 align="center" bgcolor="white"><input type="checkbox" name="userid[]" value="<?=$protectedRow["id"]?>"></td>
</tr>
<?php
}
?>
</table>
</td>
</tr>
<tr>
<td width=200 align="right" bgcolor="buttonface">
原因
</td>
<td width=500 bgcolor="white">
<input type="text" name="why" size=40>
</td>
</tr>
<tr>
<td width=200 align="right" bgcolor="buttonface">
</td>
<td width=500 bgcolor="white">
<input type="submit" value="取消保护">
</td>
</tr>
</form>
<tr>
<td colspan=2 align=center bgcolor="#6699ff">
<b>添加保护</b>
</td>
</tr>
<tr>
<td width=200 align="right" bgcolor="buttonface">
<form name="addProtectedUserForm" action="saveconfig.php?w=user" method="post" onsubmit="return chkFm(this)">
<input type="hidden" name="act" value="protec">
用户名
</td>
<td width=500 bgcolor="white">
<input type="text" name="username" maxlength=20> <input type="button" onclick="viewinfo(username.value)" value="查看信息">
</td>
</tr>
<tr>
<td width=200 align="right" bgcolor="buttonface">
原因
</td>
<td width=500 bgcolor="white">
<input type="text" name="why" size=40>
</td>
</tr>
<tr>
<td width=200 align="right" bgcolor="buttonface">
</td>
<td width=500 bgcolor="white">
<input type="submit" value="添加保护">
</td>
</tr>
</form>
<tr>
<td colspan=2 align=center bgcolor="#6699ff">
<b>允许自动升级</b>
</td>
</tr>
<tr>
<td width=200 bgcolor="buttonface" align="right">
用户列表
</td>
<td width=500 bgcolor="white">
<form name="upgradeForm" action="saveconfig.php?w=user" method="post">
<input type="hidden" value="upgrade" name="act">
<table width=200 cellspacing=1 cellpadding=3 bgcolor="black">
<tr>
<td width=140 align="center" bgcolor="buttonface"><b>被禁升级用户名</b></td>
<td width=60 align="center" bgcolor="buttonface"><b><input type="checkbox" name="sl" onclick="selectAll(document.upgradeForm)"></b></td>
</tr>
<?php
$upgradeResult = $db->query("select `username`,`id` from `members` where `upgrade` = 0");
while($upgradeRow = $db->fetchArray($upgradeResult))
{
?>
<tr>
<td width=120 align="center" bgcolor="white"><?=$upgradeRow["username"]?></td>
<td width=100 align="center" bgcolor="white"><input type="checkbox" name="userid[]" value="<?=$upgradeRow["id"]?>"></td>
</tr>
<?php
}
?>
</table>
</td>
</tr>
<tr>
<td width=200 align="right" bgcolor="buttonface">
原因
</td>
<td width=500 bgcolor="white">
<input type="text" name="why" size=40>
</td>
</tr>
<tr>
<td width=200 align="right" bgcolor="buttonface">
</td>
<td width=500 bgcolor="white">
<input type="submit" value="允许升级">
</td>
</tr>
</form>
<tr>
<td colspan=2 align=center bgcolor="#6699ff">
<b>禁止自动升级</b>
</td>
</tr>
<tr>
<td width=200 align="right" bgcolor="buttonface">
<form name="unupgradeForm" action="saveconfig.php?w=user" method="post" onsubmit="return chkFm(this)">
<input type="hidden" name="act" value="unupgrade">
用户名
</td>
<td width=500 bgcolor="white">
<input type="text" name="username" maxlength=20> <input type="button" onclick="viewinfo(username.value)" value="查看信息">
</td>
</tr>
<tr>
<td width=200 align="right" bgcolor="buttonface">
原因
</td>
<td width=500 bgcolor="white">
<input type="text" name="why" size=40>
</td>
</tr>
<tr>
<td width=200 align="right" bgcolor="buttonface">
</td>
<td width=500 bgcolor="white">
<input type="submit" value="禁止升级">
</td>
</tr>
</form>
<tr>
<td colspan=2 align=center bgcolor="#6699ff">
<b>管理员级别的用户</b>
</td>
</tr>
<tr>
<td width=200 align="right" bgcolor="buttonface">
用户列表
</td>
<td width=500 bgcolor="white">
<table width=300 bgcolor="black" cellspacing=1 cellpadding=2>
<tr>
<td bgcolor="buttonface" align="center" width=120><b>用户名</b></td>
<td bgcolor="buttonface" align="center" width=80><b>级别</b></td>
<td bgcolor="buttonface" align="center" width=100><b>经验值</b></td>
</tr>
<?php
$theGrade = $db->result($db->query("select `value` from `config` where `name` = 'enable_kick'"),0,"value");
$theResult = $db->query("select `username`,`cents`,`rank` from `members` where `rank` >= '{$theGrade}'");
while($theRow = $db->fetchArray($theResult))
{
echo "<tr>";
echo "<td bgcolor=\"white\" align=\"center\">{$theRow["username"]}</td>";
echo "<td bgcolor=\"white\" align=\"center\">{$theRow["rank"]}</td>";
echo "<td bgcolor=\"white\" align=\"center\">{$theRow["cents"]}</td>";
echo "</tr>";
}
?>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
<br>
<?php
include "../include/copyrights.php";
?>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -