www.gusucode.com > 星云DJ舞曲 4.5a源码程序 > admin/admin_usersave.asp

    <!--#include file="conn.asp"-->
<!--#include file="checkadmin.inc"-->
<%
id=request("id")
byear=request.form("byear")
bmonth=request.form("bmonth")
bday=request.form("bday")
act=request("act")
set rs=server.CreateObject("ADODB.RecordSet")
if act="edit" then
	username=trim(request("username"))
	password=trim(request("password"))
	Sex=trim(request("Sex"))
	Email=trim(request("Email"))
	sign=trim(request("sign"))
	OICQ=trim(request("oicq"))
	quesion=trim(request("quesion"))
        answer=trim(request("answer"))
        UserWebUrl=trim(request("UserWebUrl"))
	Address=trim(request("address"))
	ContactAddress=trim(request("ContactAddress"))
	TrueName=trim(request("TrueName"))
	addDate=trim(request("addDate"))
	if username="" or password="" or Sex="" then
		Response.Write "用户名称,密码和性别都不能为空!"
		Response.End 
	end if
	sql="select * from user where id="& request("id")
	rs.open sql,conn,1,3
	if not rs.eof then
		rs("Username")=username
		rs("Password")=password
		rs("Sex")=Sex
		rs("email")=email
       	rs("sex")=request("sex")
       	rs("isvip")=request("isvip")
		rs("addDate")=addDate
		rs("vipstartdate")=request("vipstartdate")
		rs("vipenddate")=request("vipenddate")
		if request("MyIntro")="" then
		rs("sign")=null
		else
		rs("sign")=request("MyIntro")
		end if
		if request("oicq")<>"" then rs("oicq")=request("oicq")
		rs("User_Birthday")=byear & "-" & bmonth & "-" & bday 
       	rs("TrueName")=request("TrueName")
       	rs("ContactAddress")=request("ContactAddress")
       	rs("Address")=request("Address")
       	rs("UserWebUrl")=request("UserWebUrl")
       	rs("Tel")=request("Tel")
       	rs("BP")=request("bp")
       	rs("points")=request("points")
        rs("quesion")=request("quesion")
   	rs("answer")=request("answer")
		rs.update
	end if
	rs.close
elseif act="lock" then
	sql="select * from user 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="alluser" then
	sql="select points from [user]"
	rs.open sql,conn,1,3
	if not rs.eof then
		do while not rs.eof
			rs("points")=request("allpoints")
			rs.update
			rs.movenext
		loop
	end if
	rs.close
	set rs=nothing
elseif act="update" then
	set rs=server.CreateObject("ADODB.RecordSet")
	sql="select count(id) from [user]"
	rs.open sql,conn,1,1
	usercount=rs(0)
	rs.close
	set rs=nothing
elseif act="checkall" then
	set rs=server.CreateObject("ADODB.RecordSet")
	sql="select ischecked from [user]"
	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
set rs=conn.execute("delete * from user where id="&request("id")) 
set rs=nothing
conn.close
set conn=nothing
response.redirect "admin_UserMana.asp"
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 [user] where lockuser<>true and logins<"&selecttimes
		elseif selectdate<>"" and selecttimes="" then
			sql="select username from [user] where lockuser<>true and datediff('y',datevalue(lastlogin),#"&thisdate&"#)>"&selectdate
		elseif selectdate<>"" and selecttimes<>"" then
			sql="select username from [user] where lockuser<>true and 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 [user] where lockuser<>true and username='"&arrRow(0,i)&"'")
			next
			arrCon=null
			arrRow=null
		else
			rs.close
			set rs=nothing
		end if
	end if
end if
conn.close
set conn=nothing
response.redirect "admin_UserMana.asp"
%>