📄 useradmin.asp
字号:
<!--#include file="Conn.asp"-->
<!--#include file="Inc/CheckUser.asp"-->
<HTML>
<HEAD>
<title>工程学院教学管理系统 —— 用户管理 —— 用户管理 </title>
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta http-equiv="Expires" content="0">
<meta http-equiv="Pragma" content="no-cache">
<LINK href="Style/style.css" rel="stylesheet">
<script language="javascript" type="text/javascript" src="Jscript/function.js"></script>
</HEAD>
<body background="Images/bg.jpg" topmargin="0" leftmargin="0">
<table class="borderon" id="control" cellSpacing="0" cellPadding="0" width="100%" border="0">
<tr align="center">
<td height="20" width="100"></td>
<td class="tbutton" onclick="javascript:location.href='?action=add';">添加用户</td>
<td class="tbutton" onclick="javascript:location.href='?action=list';">用户列表</td>
<td width="100"></td>
</table>
<form name="index" method="post" action="?action=save" ID="Form1">
<%
dim action,iyear
action = Request.QueryString("action")
select case action
case "list"
call list()
case "add"
call add()
case "change"
call change()
case "save"
call save()
case else
call list()
end select
'学习简历列表
sub list()
Set rs = Server.CreateObject("ADODB.RecordSet")
sql = "Select * From [userinfo] Where userpower = '1'"
rs.Open sql,conn,1,1
dim i,j
dim page,pagecount,show_str,total,content
%>
<table cellSpacing="0" cellPadding="0" width="100%" border="0" ID="Table1">
<tr>
<td vAlign="top" height="30">
<ol style="line-height:150%">
<li>
管理用户的个人资料</li>
</td>
</tr>
</table>
<input type="hidden" name="act" value="delete" ID="Hidden1">
<table width="95%" border="0" cellpadding="3" cellspacing="1" bgcolor="#000000" align="center" ID="Table2">
<tr style="BACKGROUND-IMAGE: url('Images/title1.gif');">
<td bgcolor="#99A6BF" style="background-image: url('')"></td>
<td bgcolor="#99A6BF" style="background-image: url('')">
<b>用户ID</b></td>
<td bgcolor="#99A6BF" style="background-image: url('')">
<b>教师名</b></td>
<td bgcolor="#99A6BF" style="background-image: url('')">
<b>性 别</b></td>
<td bgcolor="#99A6BF" style="background-image: url('')">
<b>登陆密码</b></td>
<td bgcolor="#99A6BF" style="background-image: url('')">
<b>所属单位</b></td>
<td bgcolor="#99A6BF" style="background-image: url('')">
<b>所属专业</b></td>
<td bgcolor="#99A6BF" style="background-image: url('')">
<b>登陆次数</b></td>
<td bgcolor="#99A6BF" style="background-image: url('')">
<b>管 理</b></td>
</tr>
<%
if rs.BOF or rs.EOF then
total=0
page=0
pagecount=0
for j = 1 to 10
%>
<tr bgcolor="<%=TableBodyColor%>">
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<%
next
else
i = 0
total = rs.RecordCount
rs.pagesize = 10
if request("page") = "" then
page = 1
else
page = request("page")
end if
rs.AbsolutePage = page
pagecount = rs.pagecount
if int(page) >= int(rs.pagecount) then
page = rs.pagecount
end if
if page = 1 then
show_str = ""
else
show_str = " <a href=?page="&page-1&"&action=list>上一页</a> "
end if
if int(page) >= int(rs.pagecount) then
show_str = show_str&""
else
show_str = show_str&" <a href=?page="&page+1&"&action=list>下一页</a> "
end if
do while not(rs.EOF or rs.BOF)
%>
<tr bgcolor="<%=TableBodyColor%>" onMouseOver="this.style.backgroundColor='#ffffff'; " onMouseOut="this.style.backgroundColor='';">
<td>
<input type="checkbox" name="delid" value="<%=rs("id")%>" ID="Checkbox1">
</td>
<td>
<%=rs("id")%>
</td>
<td>
<%=rs("userid")%>
</td>
<td>
<%if rs("sex") = 1 then:Response.Write "男":else:Response.Write "女":end if%>
</td>
<td>
<%=rs("userpass")%>
</td>
<td>
<%=rs("college")%>
</td>
<td>
<%=rs("class")%>
</td>
<td>
<%=rs("loginTimes")%>
</td>
<td align="center">
<a href="?action=change&id=<%=rs("id")%>">修改</a></td>
</tr>
<%
i = i + 1
if i = rs.pagesize then exit do
rs.MoveNext
loop
if i < 10 then
for j = 1 to (10 - i)
%>
<tr bgcolor="<%=TableBodyColor%>">
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<%
next
end if
%>
<tr bgcolor="<%=TableLeftColor%>">
<td colspan="9">
<table cellSpacing="0" cellPadding="0" border="0" height="80%" width="100%" ID="Table3">
<tr>
<td>
<input type="checkbox" name="chkall" value="on" onclick="CheckAll(this.form)" ID="chkall"><label for="chkall">选中所有显示用户</label>
<input type="submit" name="del" value="删除选中的用户" ID="Submit1">
</td>
<td>
每页显示
<%=rs.PageSize%>
个用户, 共 <font color="red"><b>
<%=page%>
</b></font>/<%=pagecount%>
页, 共有 <font color="red"><b>
<%=total%>
</b></font>个用户,
<%=show_str%>
</td>
</tr>
</table>
</td>
</tr>
<%
end if
%>
</table>
<%
rs.Close()
end sub
'添加学习简历
sub add()
%>
<table cellSpacing="0" cellPadding="0" border="0" height="80%" width="100%" ID="Table4">
<tr>
<td vAlign="top" height="50">
<ol style="line-height:150%">
<li>
添加教师的登陆资料</li>
</td>
</tr>
<tr>
<td align="center" valign="top">
<input type="hidden" name="act" value="add" ID="Hidden2">
<table width="90%" border="0" cellpadding="4" cellspacing="1" bgcolor="#000000" align="center" ID="Table5">
<tr style="BACKGROUND-IMAGE: url('Images/title1.gif');">
<td colspan="2" align="center" bgcolor="#99A6BF" style="background-image: url('')"><b>用 户 管 理 —— 教师添加</b></td>
</tr>
<tr>
<td bgcolor="#E7EAEF" width="30%">
<b>教师名:</b></td>
<td bgcolor="#FFFFFF">
<input type="text" name="userid" class="text" ID="Text1" size="30"></td>
</tr>
<tr>
<td bgcolor="#E7EAEF">
<b>密 码:</b></td>
<td bgcolor="#FFFFFF">
<input type="password" name="userpass" class="text" ID="Password1" size="30"></td>
</tr>
<tr>
<td bgcolor="#E7EAEF">
<b>确认密码:</b></td>
<td bgcolor="#FFFFFF">
<input type="password" name="ruserpass" class="text" ID="Password2" size="30"></td>
</tr>
<tr>
<td bgcolor="#E7EAEF">
<b>所在单位:</b></td>
<td bgcolor="#FFFFFF">
<input type="text" name="college" class="text" ID="Text2" size="40"><br>
格式:工程学院</td>
</tr>
<tr>
<td bgcolor="#99A6BF" align="middle" colspan="2">
<input type="submit" name="submit" value=" 添 加 " onMouseOver="this.className='button1_o';"
onMouseOut="this.className='button1';" class="button1" ID="Submit2">
<input type="reset" name="reset" value=" 重 置 " onMouseOver="this.className='button1_o';"
onMouseOut="this.className='button1';" class="button1" ID="Reset1"></td>
</tr>
</table>
</td>
</tr>
</table>
<%
end sub
'修改学习简历
sub change()
Set rs = Server.CreateObject("ADODB.RecordSet")
sql = "Select * From [userinfo] Where id = " & Request.QueryString("id")
rs.Open sql,conn,1,1
if rs.bof or rs.eof then
else
%>
<table cellSpacing="0" cellPadding="0" border="0" height="80%" width="100%" ID="Table6">
<tr>
<td vAlign="top" height="50">
<ol style="line-height:150%">
<li>
修改教师的个人资料</li>
</td>
</tr>
<tr>
<td align="center" valign="top">
<input type="hidden" name="act" value="change" ID="Hidden3"> <input type="hidden" name="id" value="<%=Request.QueryString("id")%>" ID="Hidden4">
<table width="90%" border="0" cellpadding="4" cellspacing="1" bgcolor="#000000" align="center"
ID="Table7">
<tr style="BACKGROUND-IMAGE: url('Images/title1.gif');">
<td colspan="2" align="center" bgcolor="#99A6BF" style="background-image: url('')"><b>用 户 管 理 —— 教师资料修改</b></td>
</tr>
<tr>
<td bgcolor="#E7EAEF" width="30%">
<b>教师名:</b></td>
<td bgcolor="#FFFFFF">
<input type="text" name="userid" class="text" ID="Text3" size="30" value="<%=rs("userid")%>"></td>
</tr>
<tr>
<td bgcolor="#E7EAEF">
<b>密 码:</b></td>
<td bgcolor="#FFFFFF">
<input type="password" name="userpass" class="text" ID="Password3" size="30"></td>
</tr>
<tr>
<td bgcolor="#E7EAEF">
<b>确认密码:</b></td>
<td bgcolor="#FFFFFF">
<input type="password" name="ruserpass" class="text" ID="Password4" size="30"></td>
</tr>
<tr>
<td bgcolor="#E7EAEF">
<b>所在单位:</b></td>
<td bgcolor="#FFFFFF">
<input type="text" name="college" class="text" ID="Text4" size="40" value="<%=rs("college")%>"><br>
格式:工程学院</td>
</tr>
<tr>
<td bgcolor="#99A6BF" align="middle" colspan="2">
<input type="submit" name="submit" value=" 修 改 " onMouseOver="this.className='button1_o';"
onMouseOut="this.className='button1';" class="button1" ID="Submit3">
<input type="reset" name="reset" value=" 重 置 " onMouseOver="this.className='button1_o';"
onMouseOut="this.className='button1';" class="button1" ID="Reset2"></td>
</tr>
</table>
</td>
</tr>
</table>
<%
end if
rs.close()
end sub
'修改操作
sub save()
if Request.Form("act") = "add" then
if Trim(Request.Form("userid")) = "" then
Response.Write("<script>alert('对不起,请填写用户名!');window.history.back();</script>")
Response.End()
elseif Trim(Request.Form("userpass")) = "" then
Response.Write("<script>alert('对不起,请填写密码!');window.history.back();</script>")
Response.End()
elseif Trim(Request.Form("userpass")) <> Trim(Request.Form("ruserpass")) then
Response.Write("<script>alert('对不起,两次密码输入不一致,请重新输入!');window.history.back();</script>")
Response.End()
elseif Trim(Request.Form("college")) = "" then
Response.Write("<script>alert('对不起,请填写用户所在单位!');window.history.back();</script>")
Response.End()
end if
Response.Write("添加用户")
conn.execute("Insert into [userinfo] (userid,userpass,userpower,college) Values ('"&Trim(Request.Form("userid"))&"','"&Trim(Request.Form("userpass"))&"','1','"&Trim(Request.Form("college"))&"') ")
Response.Write("<script>alert('成功添加用户!');location.href='?action=list';</script>")
elseif Request.Form("act") = "change" then
if Trim(Request.Form("userid")) = "" then
Response.Write("<script>alert('对不起,请填写用户名!');window.history.back();</script>")
Response.End()
elseif Trim(Request.Form("userpass")) = "" then
Response.Write("<script>alert('对不起,请填写密码!');window.history.back();</script>")
Response.End()
elseif Trim(Request.Form("userpass")) <> Trim(Request.Form("ruserpass")) then
Response.Write("<script>alert('对不起,两次密码输入不一致,请重新输入!');window.history.back();</script>")
Response.End()
elseif Trim(Request.Form("college")) = "" then
Response.Write("<script>alert('对不起,请填写用户所在单位!');window.history.back();</script>")
Response.End()
end if
Response.Write("修改用户")
conn.execute("Update [userinfo] Set userid = '"&Trim(Request.Form("userid"))&"',userpass = '"&Trim(Request.Form("workplace"))&"',college = '"&Trim(Request.Form("college"))&"' Where id = " & Request.Form("id"))
Response.Write("<script>alert('成功修改用户!');location.href='?action=list';</script>")
elseif Request.Form("act") = "delete" then
Response.Write("删除用户")
dim delid
delid = Request.Form("delid")
if delid = "" then
Response.Write("<script>alert('对不起,请选中要删除的用户!');window.history.back();</script>")
Response.End()
end if
conn.execute("Delete * From [userinfo] where id in ("&delid&")")
Response.Write("<script>alert('成功删除选定的用户!');location.href='?action=list';</script>")
end if
end sub
Set rs = nothing
CloseDataBase
%>
</form>
<script language="javascript" src="copyright.htm" type="text/javascript"></script>
</body>
</HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -