⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sysadm_chgacct.asp

📁 酷虎网同学录V1.0
💻 ASP
字号:
<!--#INCLUDE FILE="setup.asp" -->
<!--#include file=char.asp-->
<!--#include file=checkuser.asp-->
<%
if  not sysadmin or session("adminlogin")<>"OK" then
		Errmsg=Errmsg+"<br>"+"<li>本页面为管理员专用,请<a href=sysadm_index.asp target=_top>登陆</a>后进入。"
		call Error("Information",errmsg)
else
		if request("action")="change" then
			call changeacct()
		else
			call changeform()
		end if
end if
call endconnection()

sub changeform()
call pagehead()
%>
<BR>
<form method="POST" action=sysadm_chgacct.asp>
<input type=hidden name=action value=change>
<table width="90%" border="0" cellspacing="1" cellpadding="3"  align=center bgcolor=<%=Tablebordercolor%>>
<tr bgcolor=<%=Tabletitlecolor%>> 
<td height="11" colspan="2" ><font color="<%=TableContentColor%>"><b>管理员帐号修改</b></font></td>
</tr>
<tr  bgcolor=<%=Tablebodycolor2%>> 
<td width="41%" height="18"><font color="<%=TableContentColor%>">管理员登陆帐号</font></td>
<td width="59%" height="18"> 
<input type="text" name="admacct" value="<%=membername%>">
</td>
</tr>
<tr   bgcolor=<%=Tablebodycolor2%> >
<td width="41%" height="18"><font color="<%=TableContentColor%>">管理员帐号密码</font></td>
<td width="59%" height="18"> 
        <input type="password" name="admpwd1">
</td></tr>

<tr   bgcolor=<%=Tablebodycolor2%> >
<td width="41%" height="18"><font color="<%=TableContentColor%>">请再次输入密码</font></td>
<td width="59%" height="18"> 
        <input type="password" name="admpwd2">
</td></tr>

<tr bgcolor=<%=Tabletitlecolor%>> 
<td height="23" colspan="2" align=right > 
<input type="submit" name="Submit" value="执行修改">
</td>
</tr>
</table>
</form>
<%
end sub

sub changeacct()

dim rs,sql


userid=trim(request.form("admacct"))

if userid="" then
	errmsg=errmsg+"<br>"+"<li>请输入管理员帐号!"
	founderr=true
elseif strlength(userid)<4 then
	errmsg=errmsg+"<br>"+"<li>管理员帐号不得少于4个字符!"
	founderr=true
elseif strlength(userid)>12 then
	errmsg=errmsg+"<br>"+"<li>管理员帐号不得多于12个字符!"
	founderr=true
elseif isValidstring(userid)<>"" then
	if isValidstring(userid)=" " then invld="空格" else invld=isValidstring(userid)
	errmsg=errmsg+"<br>"+"<li>用户名中含有非法字符&nbsp;<font color=#cc0000>"&invld&"</font>&nbsp;。"
	founderr=true
else

	if userid<>membername then
	set rs=conn.execute("select * from [student] where userid='"&userid&"'")

	if not (rs.EOF and rs.bof) then
		Errmsg=Errmsg+"<br>"+"<li>这个用户名已被使用!"
		founderr=true
	end if
	set rs=nothing

	end if
end if

userpwd1=request.form("admpwd1")
userpwd2=request.form("admpwd2")
if userpwd2<>userpwd1 then 
	errmsg=errmsg+"<br>"+"<li>您两次输入的密码不一致!"
	founderr=true
end if

if userpwd1="" then 
	errmsg=errmsg+"<br>"+"<li>请确认输入了密码(6-10个字符)!"
	founderr=true
elseif strlength(userpwd1)<6 or strlength(userpwd1)>10 then
	errmsg=errmsg+"<br>"+"<li>密码不能少于六个字符或多余十个字符!"
	founderr=true
elseif isValidstring(userpwd1)<>"" then
	if isValidstring(userpwd1)=" " then invld="空格" else invld=isValidstring(userpwd1)
	errmsg=errmsg+"<br>"+"<li>密码中含有非法字符&nbsp;<font color=#cc0000>"&invld&"</font>&nbsp;。"
	founderr=true
elseif userpwd1=userid then
	errmsg=errmsg+"<br>"+"<li>密码不能和用户名相同!"
	founderr=true
end if


if founderr=true then
	call pagehead()
	response.write "<br>"&errmsg
else

	if userid=membername then
		conn.execute("update student set userpwd='"&userpwd1&"' where userid='"&membername&"'")
	else

	sql="update [classboard] set name='"&userid&"' where name='"&membername&"'"
	conn.execute(sql)

	sql="update [append] set collector='"&userid&"' where collector='"&membername&"'"
	conn.execute(sql)

	sql="update [teacher] set collector='"&userid&"' where collector='"&membername&"'"
	conn.execute(sql)

	sql="update [friend] set F_username='"&userid&"' where F_username='"&membername&"'"
	conn.execute(sql)

	sql="update [friend] set F_friend='"&userid&"' where F_friend ='"&membername&"'"
	conn.execute(sql)

	sql="update [message] set sender='"&userid&"' where sender='"&membername&"'"
	conn.execute(sql)

	sql="update [message] set incept='"&userid&"' where incept='"&membername&"'"
	conn.execute(sql)

	sql="update [bbs] set username='"&userid&"' where username='"&membername&"'"
	conn.execute(sql)

	sql="update [comment] set name='"&userid&"' where name='"&membername&"'"
	conn.execute(sql)

	sql="update [photo] set name='"&userid&"' where name='"&membername&"'"
	conn.execute(sql)

	sql="select classid,degree from [joinclass] where userid='"&membername&"' and isauditing=false"
	set rs=conn.execute(sql)
	do until rs.eof 
		studclass=rs(0)
		userclass=rs(1)

		sql="update [class] set studcount=studcount-1 where classid="&studclass
		conn.execute(sql)

		if userclass=8 then
		sql="update [class] set admin1='"&userid&"' where admin1='"&membername&"' and classid="&studclass
		conn.execute(sql)
		elseif userclass=7 then
		sql="update [class] set admin2='"&userid&"' where admin2='"&membername&"' and classid="&studclass
		conn.execute(sql)
		else
		'....
		end if

		rs.movenext
	loop

	set rs=nothing

	sql="update [joinclass] set userid='"&userid&"' where userid='"&membername&"'"
	conn.execute(sql)

	sql="update [student] set userid='"&userid&"',userpwd='"&userpwd1&"' where userid='"&membername&"'"
	conn.execute(sql)

	sql="update admin set userid='"&userid&"' where userid='"&membername&"'"
	conn.execute(sql)
	response.cookies("fengyue")("txlusr")=userid
	end if
	response.cookies("fengyue")("txlpwd")=userpwd1
	call pagehead()
	response.write "<b>成功修改管理员帐号!</b>"

end if

end sub


sub pagehead()
%>
<title><%=SchoolmateName%>--管理页面</title>
<!--#include file="css.asp"-->

<body alink=#333333 vlink=#333333 link=#333333 topmargin=0 bgcolor=<%=bodycolor%>>
<table width=80% align=center><tr><td><BR>
<%end sub
%>



⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -