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

📄 admin_usersave.asp

📁 庐江二中
💻 ASP
字号:
<!--#include file="session.asp"-->
<%checkAdmin2%>
<!--#include file="conn.asp"-->
<%
id=trim(request.QueryString("id"))
act=trim(request("act"))
page=trim(Request.QueryString ("page"))

if act="edit" then
	username=trim(request.form("username"))
	password=trim(request.form("password"))
	Sex=trim(request.form("Sex"))
	Email=trim(request.form("Email"))
	oicq=trim(request.form("oicq"))
	sign=trim(request.form("sign"))
	UserPoint=trim(request.form("UserPoint"))
	UserLevel=trim(request.form("UserLevel"))
	UserWebName=trim(request.form("UserWebName"))
	UserWebUrl=trim(request.form("UserWebUrl"))
	if username="" or password="" or Sex="" then
		conn.close
		set conn=nothing
errmsg="<br><li>管理员名称,密码和性别都不能为空!</li>"
call error()
Response.End
	end if
	sql="select * from Users where id="& request("id")
	set rs=server.CreateObject("ADODB.RecordSet")
	rs.open sql,conn,1,3
	if not rs.eof then
		rs("Username")=username
		rs("Password")=password
		rs("Sex")=Sex
		rs("Email")=Email
		rs("oicq")=oicq
		rs("UserWebName")=UserWebName
		rs("UserWebUrl")=UserWebUrl
		rs("sign")=sign
		rs("UserPoint")=Int(UserPoint)
		rs("UserLevel")=Int(UserLevel)
		rs.update
	end if
	rs.close
	set rs=nothing
elseif act="lock" then
	set rs=server.CreateObject("ADODB.RecordSet")
	sql="select lockuser from Users where id="&id
	rs.open sql,conn,1,3
	if not rs.eof then
		if rs("lockuser")=false then
			rs("lockuser")=true
		else
			rs("lockuser")=false
		end if
		rs.update
	end if
	rs.close
	set rs=nothing
elseif act="check" then
	set rs=server.CreateObject("ADODB.RecordSet")
	sql="select ischecked from Users where id="&id
	rs.open sql,conn,1,3
	if not rs.eof then
		if rs("ischecked")=false then
			rs("ischecked")=true
		else
			rs("ischecked")=false
		end if
		rs.update
	end if
	rs.close
	set rs=nothing
elseif act="checkall" then
	set rs=server.CreateObject("ADODB.RecordSet")
	sql="select ischecked from Users"
	rs.open sql,conn,1,3
	if not rs.eof then
		do while not rs.eof
			rs("ischecked")=true
			rs.update
			rs.movenext
		loop
	end if
	rs.close
	set rs=nothing
elseif act="del" then
	username=Request.QueryString("username")
	conn.execute("delete from Users where username='"&username&"'")
'	conn.execute("delete from SendNews where FromUser='"&username&"' or ForUser='"&username&"'")
	conn.execute("delete from gstbook where name='"&username&"'")
elseif act="deldate" then
	selectdate=trim(Request.Form ("selectdate"))
	selecttimes=trim(Request.Form ("selecttimes"))
	if selectdate<>"" or selecttimes<>"" then
		thisdate=date()
		set rs=server.CreateObject("ADODB.RecordSet")
		if selectdate="" and selecttimes<>"" then
			sql="select username from Users where logins<"&selecttimes
		elseif selectdate<>"" and selecttimes="" then
			sql="select username from Users where datediff('y',datevalue(lastlogin),#"&thisdate&"#)>"&selectdate
		elseif selectdate<>"" and selecttimes<>"" then
			sql="select username from Users where datediff('y',datevalue(lastlogin),#"&thisdate&"#)>"&selectdate&" and logins<"&selecttimes
		end if
		rs.open sql,conn,1,1
		if not rs.eof then
			arrRow=rs.GetRows
			arrCon=rs.RecordCount
			rs.close
			set rs=nothing
			for i=0 to arrCon-1
				conn.execute("delete from Users where username='"&arrRow(0,i)&"'")
'				conn.execute("delete from SendNews where FromUser='"&arrRow(0,i)&"' or ForUser='"&arrRow(0,i)&"'")
				conn.execute("delete from gstbook where name='"&arrRow(0,i)&"'")
			next
			arrRow=null
			arrCon=null
		else
			rs.close
			set rs=nothing
		end if
	end if
end if
conn.close
set conn=nothing
response.redirect "admin_UserMana.asp?page="&page
%>

⌨️ 快捷键说明

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