<!--#INCLUDE FILE="setup.asp" -->
<!--#include file=checkuser.asp-->
<!--#include file=include/encrypt.asp-->
<!--#include file=include/htmlencode.asp-->
<title><%=StrVar(1)%>--管理页面</title>
<link href="css.asp" rel="stylesheet" type="text/css">
<!--#include file=theme.css-->
<body alink=#333333 vlink=#333333 link=#333333 topmargin=0 bgcolor=<%=bodycolor%>>
<%
if  not sysadmin or session("adminlogin")<>"0K" Then
	Errmsg=Errmsg+"<br>"+"<li>本页面为管理员专用，请<a href=superindex.asp target=_top>登陆</a>后进入。"
	Call Error("Information",ErrMsg)
Else
	Call main()
	Set rs=Nothing
End if

Call endconnection()


Sub main()
%><BR>
<table cellpadding=5 cellspacing=1 border=0 width=90% Class=TableBorder align=center>
<tr>
	<th>欢迎<b><%=membername%></b>进入管理页面</th>
</tr>
<tr Class=DarkTableBody>
	<td width="100%" valign=top>
		<%
		if Request("action")="save" Then
			Call update()
		Else
			Call userinfo()
		End if
		%></font>
	</td>
</tr>
</table>
<%
End Sub


Sub userinfo()

	dim sql,rs
	dim  mydegree
	sql="select locked from student where userid='"&membername&"'"
	set rs=conn.execute(sql)
	if not (rs.eof and rs.bof) then
		mydegree=rs(0)
	end if
	set rs=nothing


	sql="Select * from student where userid='"&trim(Request("name"))&"'"
	set rs=conn.execute(sql)
	if rs.eof and rs.bof Then
		response.write "<br><br><CENTER>该用户名不存在。</CENTER>"
		response.end
	elseif rs("locked")>1 and rs("userid")<>membername  and mydegree=2 then
		response.write "<br><br><CENTER>操作失败，您的权限不够！</CENTER>"
		response.end
	Else
%>
<BR>
<form method="POST" action=sysadm_modiuser.asp?Action=save>
<table width="80%" border="0" cellspacing="1" cellpadding="5"  align=center Class=TableBorder>
<tr> 
<th height="11" colspan="2" ><b><%=htmlencode(rs("userid"))%>的个人资料</b></font></th>
</tr>
<tr Class=LightTableBody> 
<td width="41%" height="18">用&nbsp;户&nbsp;名</font></td>
<td width="59%" height="18"> 
<%=htmlencode(rs("userid"))%>
<input type="hidden" name="Name" size="35" value="<%=Request("name")%>">
</td>
</tr>
<tr Class=LightTableBody >
<td width="41%" height="18">用户密码</font></td>
<td width="59%" height="18"> 
        <input type="text" name="userpwd" size="35" value="<%=rs("userpwd")%>">
</td>
</tr>
<tr Class=LightTableBody> 
<td height="11" >真实姓名</font></td>
<td height="11" > 
<input type="text" name="realname" size="35" value="<%=rs("realname")%>">
</td>
</tr>

<tr Class=LightTableBody> 
<td width="41%" height="18">邮件地址</font></td>
<td width="59%" height="18"> 
<input type="text" name="Email" size="35" value="<%=rs("Email")%>">
</td>
</tr>
<tr Class=LightTableBody> 
<td width="41%" height="18">个人主页</font></td>
<td width="59%" height="18"> 
<input type="text" name="homepage" size="35" value="<%=rs("homepage")%>">
</td>
</tr>
<tr Class=LightTableBody> 
<td width="41%" height="8">用户积分</font></td>
<td width="59%" height="-2"> 
<input type="text" name="point" size="35" value="<%=rs("point")%>">
</td>
</tr>
<tr Class=LightTableBody> 
<td width="41%" height="18">锁定用户</font></td>
<td width="59%" height="18"> 
<select name="locked" <%if rs("locked")=3 Then Response.Write "disabled"%>>
<option value="0" <%if rs("locked")=0 Then%>selected<%End if%>>否 
<option value="1" <%if rs("locked")=1 Then%>selected<%End if%>>是 
</Select>
</td>
</tr>
<tr Class=LightTableBody> 
<td height="23" colspan="2" > 
<input type="submit" name="Submit" value="更 新" class=button>&nbsp;<input type="button" value="返 回" onclick="javascript:history.go(-1)" class=button>
</td>
</tr>
</table>
</form>
<%
	End if
	Set rs=Nothing
End Sub


Sub update()
	dim sql,rs
	dim locked
	Set rs=server.createobject("adodb.recordset")
	sql="Select * from student where userid='"&trim(Request.form("name"))&"'"
	rs.open sql,conn,1,3
	if rs.eof and rs.bof Then
		response.write "<br><br><center>该用户名不存在!</center>"
		Exit Sub
	Else
		
		rs("userpwd")=md5(Request.form("userpwd"))
		rs("realname")=Request.form("realname")
		rs("email")=Request.form("email")
		rs("homepage")=Request.form("homepage")
		rs("point")=Request.form("point")
		locke=request.form("locked")
		if locked<>"" then
		rs("locked")=cint(locked)
		end if
		rs.update
        rs.close
	End if
	Set rs=Nothing
%><center><p><b>更新用户数据成功！</b>
<%
End Sub
%>