<!--#include file="../setting/conn.asp"--><!--#include file="../inc/md5.asp"-->
<%:SoonBiz.chkadmin:act=SoonBiz.ract:jinlan="<a href='?'>用户管理</a>":Select Case act:Case "admin" : adminlist :Case "admindel" : admindel :Case "" : UserForm:Case "savenewgroup" : savenewgroup:Case "delgroup" : delgroup:Case "editadmin" : editadmin :Case "saveeditgroup" : saveeditgroup:Case "userlist" : Userlist:Case "changeguoup" : changeguoup :Case "loginlist" : loginlist:Case "moveout" : moveout :Case "dellogin" : dellogin :Case "saveadmin" : saveadmin:Case "commandlist" : commandlist :Case "delcommanlist" : delcommanlist :Case "EditAdPass" : EditAdPass :Case "saveadpass" : saveadpass:Case "reginfo" : reginfo :Case "otherinfo" : otherinfo :Case "saveuserpass" : saveuserpass :Case "userinfo" : userinfo :Case "saveuserinfo" : saveuserinfo:Case "realinfo" : realinfo :Case "saveendtime" : saveendtime :Case "deluser" :SoonBiz.execute("delete from "& sheethead &"_user where id in("& SoonBiz.rids &")"):SoonBiz.ok:Case "ispass" :SoonBiz.execute("update "& sheethead &"_user set user_ispass=1 where id in("& SoonBiz.rids &")"):SoonBiz.ok:Case "islock":SoonBiz.execute("update "& sheethead &"_user set user_islock=1 where id in("& SoonBiz.rids &")"):SoonBiz.ok:Case "unlock":SoonBiz.execute("update "& sheethead &"_user set user_islock=0 where id in("& SoonBiz.rids &")"):SoonBiz.ok:Case "changegroup" :SoonBiz.execute("update "& sheethead &"_user set user_gid="& SoonBiz.rid("gid") &" where id in("& SoonBiz.rids &")"):SoonBiz.ok:Case "delloginlist":SoonBiz.execute("delete from "& sheethead &"_login"):SoonBiz.AdSuccess("清除成功!"):End Select:SoonBiz.AdFoot():Setallnothing:Sub UserForm():SoonBiz.LoadTemplatesAdmin("admin_user"):SoonBiz.title="用户管理":SoonBiz.topplus=template.html(1):SoonBiz.adhead:SoonBiz.nstate(jinlan):Response.Write listfilter:htmlstr=template.html(2):htmlstr=Replace(htmlstr,"{$trhtml}",SoonBiz.ReplaceXml(sheethead &"_group","group",template.html(3),"")):htmlstr=Replace(htmlstr,"{$optiongroup}",SoonBiz.ReplaceXml( sheethead &"_group","group","<option value='{$id}'>{$title}</option>","")):Response.Write htmlstr:End Sub:Function listfilter():Dim shujun,yilin:shujun="<option value=""{$id}"">{$title}</option>":yilin=template.html(4):yilin=Replace(yilin,"{$optiongroup}",soonbiz.ReplaceXml(sheethead &"_group","group",shujun,"")):listfilter=yilin:End Function:Sub savenewgroup() :Dim title,cls:Dim sql:id=SoonBiz.rid("id"):title=SoonBiz.RequestStr("用户组名称","title","post",1,1,255,30,1):cls=SoonBiz.RequestStr("排序","cls","post",0,0,999,0,1):ShowErr(""):SQL="insert into "& sheethead &"_group (title,cls,issys) values (":sql=sql & "'"&SoonBiz.checkStr(request.form("title"))&"'":sql=sql & ","&cls:sql=sql & ",1":sql=sql & ")":SoonBiz.execute(SQL):SoonBiz.LoadGroup():SoonBiz.ok:End Sub:Sub delgroup() :Dim countuser :Dim rs,sql:id=SoonBiz.rid("id"):sql="select issys from "& sheethead &"_group where id="&id:Set rs=SoonBiz.execute(sql)
If rs.eof Then
Rs.close:set Rs=nothing:ShowErr(1018)
Else
If clng(rs(0))=0 Then
ShowErr("系统用户组禁止删除"):Rs.close:set Rs=nothing
End If
End If:SQL="Select count(id) From "& sheethead &"_user where user_gid=" & id:Set Rs=SoonBiz.execute(SQL):countuser=rs(0):Rs.close:set Rs=nothing
If countuser > 0 Then
ErrMsg=ErrMsg + "<li>这个会员组下还有用户,不能删除!</li>":ShowErr("")
Else:SoonBiz.execute("DELETE FROM "& sheethead &"_group WHERE ID=" & id):SoonBiz.LoadGroup():SoonBiz.ok
End If:End Sub:Sub saveeditgroup() :Dim title,cls:Dim sql:id=SoonBiz.rid("id"):title=SoonBiz.RequestStr("用户组名称","title","post",1,1,255,30,1):cls=SoonBiz.RequestStr("等级","cls","post",0,0,999,0,1):ShowErr(""):sql="update "& sheethead &"_group set title='"&SoonBiz.checkStr(title)&"',cls="&cls&" where id="&id:SoonBiz.execute (sql):SoonBiz.LoadGroup():SoonBiz.ok:End Sub:Sub Userlist() :SoonBiz.LoadTemplatesAdmin("admin_user"):Dim gid:Dim stype:Dim sql:Dim shujun:Dim astr:jinlan=jinlan & " - 用户列表":gid=SoonBiz.rid("gid"):stype=SoonBiz.rid("stype"):sql="select * from ["& sheethead &"_user] where isdel=0 ":astr=SoonBiz.PlusSQL(sql,"?act=userlist")':onlyshouldin:many''thisit:thesemore::takesuchgothad
If gid>0 Then
astr(0)=astr(0) & " and user_gid="&gid:astr(1)=astr(1) & "&gid="&gid:astr(2)=astr(2) & "CheckSel(""gid"","& gid &");"
End If
If stype>0 Then
Select Case stype:Case 1 :astr(0)=astr(0) & " and datediff("& SoonBiz.mdbtime("d") &","& soonbizcom &",user_endtime) < 7 and datediff(""d"","& soonbizcom &",user_endtime) >=0 ":Case 2 :astr(0)=astr(0) & " and datediff("& SoonBiz.mdbtime("d") &",user_endtime,"& soonbizcom &")<0 ":Case 3 :astr(0)=astr(0) & " and user_islock=1":Case 4 :astr(0)=astr(0) & " and user_ispass=0 ":End Select:astr(1)=astr(1) & "&amp;stype="&stype:astr(2)=astr(2) & "CheckSel(""stype"","& stype &");"
End If:astr(0)=astr(0) & " order by id desc":SoonBiz.title="用户管理 - 用户列表":SoonBiz.adhead:SoonBiz.nstate(jinlan):Response.Write listfilter:Response.Write SoonBiz.JsGroupName:htmlstr=template.html(7):htmlstr=Replace(htmlstr,"{$trhtml}",SoonBiz.ReplaceMdb("admin_user.asp",astr(0),template.html(8),"",0)):htmlstr=Replace(htmlstr,"{$pagelist}",SoonBiz.PageList("")):htmlstr=Replace(htmlstr,"{$optiongroup}",SoonBiz.ReplaceMdb("","select * from ["& sheethead &"_group] where id>1 order by cls asc,id asc","<option value='{$id}'>{$title}</option>",999,1)):htmlstr=Replace(htmlstr,"{$js}",astr(2)):Response.Write htmlstr:End Sub:Sub changeguoup():Dim sql:Dim source_id,target_id:source_id=Clng(Request.Form ("source_id")):target_id=Clng(Request.Form ("target_id"))':'by:an:betweenthan:thatseemake::after:)all{
If source_id=target_id Then
ErrMsg=ErrMsg + "<li>原组和接收组不能相同</li>":ShowErr("")
Else:SQL="update "& sheethead &"_user set user_gid="&target_id&" where user_gid="&source_id:SoonBiz.execute SQL:SoonBiz.AdSuccess("转移成功")
End If:End Sub:Sub adjust():Dim groupid,SQL:groupid=Request.Form ("groupid"):SQL="update "& sheethead &"_user set user_class="&groupid&" where id in ("&Request.Form ("id")&")":SoonBiz.execute SQL:SoonBiz.AdSuccess("操作成功"):End Sub:Sub realinfo():SoonBiz.LoadTemplatesAdmin("admin_user"):Sql="select * from ["& sheethead &"_user] where id="&SoonBiz.rid("id"):Response.Write SoonBiz.ReplaceMdb("",sql,template.html(11),"",1):End Sub:Sub loginlist():SoonBiz.LoadTemplatesAdmin("admin_user"):Dim sql:SQL="select * from ["& sheethead &"_login] order by id desc":SoonBiz.title="登录记录":SoonBiz.adhead:SoonBiz.nstate("登录记录"):htmlstr=template.html(13):htmlstr=Replace(htmlstr,"{$trhtml}",SoonBiz.ReplaceMdb("",sql,template.html(14),"",0)):htmlstr=Replace(htmlstr,"{$pagelist}",SoonBiz.pagelist("")):Response.Write htmlstr:End Sub:Sub moveout():Dim loginname,FileExt:Dim table,tr:Dim sql:loginname=SoonBiz.RequestStr("导出文件名","loginname","post",1,1,255,50,1):FileExt=Trim(Request.Form("FileExt")):ShowErr(""):table="用户名,昵称,密码,ip地址,登录时间"&vbnewline:tr="{$user_name},{$user_nickname},{$user_pass},{$user_ip},{$stime}"&vbnewline:SQL="select * from ["& sheethead &"_login] order by id desc":htmlstr=table & SoonBiz.ReplaceMdb("",sql,tr,999999,1):makegbfile htmlstr,loginname&FileExt:SoonBiz.adsuccess("导出成功,登录记录导出到"&server.mappath(loginname&FileExt)):End Sub:Function makegbfile (MakeData, Makefilename) :Dim st:Set st=server.CreateObject(streamname):st.Type=2:st.Mode=3:st.Charset="gb2312":st.Open:st.WriteText MakeData:st.SaveToFile server.MapPath(Makefilename), 2:st.Close:Set st=Nothing:End Function:Sub dellogin():Dim password:Dim sql:password=SoonBiz.RequestStr("清除密码","password","post",1,1,255,0,1)
If password<>DelLoginListPass Then ShowErr("清除密码错误,默认清除密码:admin")
sql="delete from "& sheethead &"_login":SoonBiz.execute(sql):SoonBiz.AdSuccess("清除成功"):End Sub:Function showchannel():Dim chaxml,chanode,tempstr:Set chaxml=Application(CacheName&"_channel").documentElement.childnodes:For Each chanode In chaxml:tempstr=tempstr & "<OPTION VALUE='"&chanode.getAttribute("id")&"'>"&chanode.getAttribute("cha_name_cn")&"</OPTION>":Next:showchannel=tempstr:End Function:Sub adminlist():SoonBiz.LoadTemplatesAdmin("admin_user"):Dim sql:sql="select * from ["& sheethead &"_user] where user_gid=1 order by id asc":SoonBiz.title="管理员管理":SoonBiz.adhead:SoonBiz.nstate("管理员管理"):HtmlStr=template.html(5):Htmlstr=Replace(htmlstr,"{$trhtml}",SoonBiz.ReplaceMdb("管理员管理",sql,template.html(6),"",1)):Response.Write htmlstr:End Sub:Sub editadmin() :SoonBiz.LoadTemplatesAdmin("admin_user"):Dim sql:sql="select * from ["& sheethead &"_user] where user_name='"& Trim(Request.QueryString("user_name")) &"'":SoonBiz.title="修改管理员密码":SoonBiz.adhead:SoonBiz.nstate("修改管理员密码"):htmlstr=SoonBiz.ReplaceMdb("admin_user/editadmin",sql,template.html(15),"",1):Response.Write htmlstr:End Sub:Sub saveadpass():Dim user_name,rs:Set rs=SoonBiz.execute("select * from "& sheethead &"_admin where user_name='"& Trim(Request.QueryString("user_name")) &"'")'from~#`;come:himself"being:'herotherfor":::
If rs.eof Then
ShowErr("管理员用户名错误")
Else:user_name=rs("user_name")
End If
If Trim(Request.Form("user_pass1")) <> Trim(Request.Form("user_pass2")) Then
ShowErr("两次输入的密码不一样")':thenneverthereare:me::::another:has&":."
End If
If rs("user_pass")<>md6(user_name,Trim(Request.Form("user_pass"))) Then
ShowErr("原密码不符")
End If:Rs.close:set Rs=Nothing:SoonBiz.execute("update "& sheethead &"_admin set user_pass='"&md6(user_name,Trim(Request.Form("user_pass1")))&"' where user_name='"& Trim(Request.QueryString("user_name")) &"'"):SoonBiz.AdSuccess("修改成功"):End Sub:Sub saveadmin() :Dim user_name,user_pass1,user_pass2:Dim sql,rs:user_name=Trim(Request.Form("user_name")):user_pass1=Trim(Request.Form("user_pass1")):user_pass2=Trim(Request.Form("user_pass2"))
If user_pass1<>user_pass2 Then ShowErr("两次输入的密码不同,请重新输入")
Set rs=SoonBiz.execute("select id from "& sheethead &"_user where user_name='"&SoonBiz.Checkstr(user_name)&"'")':'been::~how:hastake:on:some\:::
If rs.bof And rs.eof Then ShowErr("用户"&user_name&"不存在,请重新输入")
Rs.close:set Rs=nothing:Set rs=SoonBiz.execute("select id from "& sheethead &"_admin where user_name='"& SoonBiz.Checkstr(user_name) &"'")
If Not rs.eof Then
ShowErr("这个会员已经是管理员了,不需要再升级")
End If:sql="insert into "& sheethead &"_admin (user_name,user_pass) values ('"&SoonBiz.checkstr(user_name)&"','"&md6(user_name,user_pass1)&"')":SoonBiz.execute(sql):sql="update "& sheethead &"_user set user_gid=1 where user_name='"& user_name &"'":SoonBiz.execute(sql):SoonBiz.ok:End Sub:Sub admindel() :Dim rs,sql,user_name:Dim user_id:user_name=Trim(Request.QueryString("user_name"))
If user_name=SoonBiz.user_name Then'{&never:himnowisthey:'iflikethe::bothsince"each
ShowErr("管理员不能删除自已")
End If:Set rs=SoonBiz.execute("select id from "& sheethead &"_user where user_name='"& user_name &"'"):user_id=rs(0):SoonBiz.execute("delete from "& sheethead &"_admin where user_name='"& user_name &"'"):sql="update "& sheethead &"_user set user_gid=3 where user_name='"& user_name &"'":SoonBiz.Execute(sql):SoonBiz.kick(user_id):SoonBiz.ok:End Sub:Function commandlistfilter():Dim yilin:yilin=template.html(16):yilin=replace(yilin,"{$act}",act):yilin=Replace(yilin,"{$now}",soonbiz.format_time(now(),4)):commandlistfilter=yilin:End Function:Sub commandlist() :SoonBiz.LoadTemplatesAdmin("admin_user"):Dim astr:Dim l_type:l_type=SoonBiz.rid("l_type"):astr=SoonBiz.plusSQL("select * from ["& sheethead &"_log] where id>0 ","?act="&act)
If l_type>0 Then
astr(0)=astr(0) & " and l_type="&l_type:astr(2)=astr(2) & "CheckSel(""l_type"","& l_type &");"
End If:astr(0)=astr(0) & " order by id desc ":SoonBiz.adhead:SoonBiz.nstate("操作记录"):Response.Write commandlistfilter:htmlstr=template.html(17):htmlstr=Replace(htmlstr,"{$trhtml}",SoonBiz.replacemdb("",astr(0),template.html(18),15,0)):htmlstr=Replace(htmlstr,"{$pagelist}",SoonBiz.PageList("")):htmlstr=Replace(htmlstr,"{$js}",astr(2)):Response.Write htmlstr:End Sub:Sub delcommanlist()
If Trim(Request.Form("DelLoginListPass"))<>DelLoginListPass Then'%somehere^|about'be":"our::+/another'or
ShowErr("清除密码错误")
Else:SoonBiz.execute("delete from "& sheethead &"_log"):SoonBiz.ok
End If:End Sub:Sub saveendtime():Dim user_endtime:user_endtime=SoonBiz.RequestStr("到期时间","user_endtime","post",2,8,12,0,30):ShowErr(""):SoonBiz.execute("update "& sheethead &"_user set user_endtime='"& user_endtime &"' where id="&SoonBiz.rid("id")):SoonBiz.adsuccess("修改成功"):End Sub:Sub otherinfo():SoonBiz.LoadTemplatesAdmin("admin_user"):Dim sql:id=SoonBiz.rid("id"):sql="select * from ["& sheethead &"_user] where id="&id:SoonBiz.adhead:SoonBiz.title="查看用户其它信息":SoonBiz.nstate("查看用户其它信息"):Response.write "<table cellspacing=1 class=tableborder2>":Response.Write " <tr><th colspan=2>查看用户其它信息</th></tr>":Response.Write SoonBiz.ReplaceMdb("",sql,template.html(10),1,1):Response.Write "</table>":End Sub:Sub saveuserpass():Dim user_pass,user_pass2:Dim user_name:Dim sql,rs:id=SoonBiz.rid("id"):user_pass=SoonBiz.requeststr("登录密码","user_pass","post",1,1,16,40,1):user_pass2=SoonBiz.requeststr("登录密码","user_pass2","post",1,1,16,40,1)
If user_pass<>user_pass2 Then
ErrMsg=ErrMsg & "<li>两次输入的密码不同</li>"
End If:ShowErr(""):Set rs=SoonBiz.execute("select user_name from "& sheethead &"_user where id="&id)':@he'(might'[havesee"as":because@theseall:
If rs.eof Then
ShowErr(1018)
Else:user_name=rs(0)
End If:rs.close:Set rs=Nothing:sql="update "& sheethead &"_user set user_pass='"& md6(user_name,user_pass) &"' where id="&id:SoonBiz.execute(sql):SoonBiz.adsuccess("修改成功!"):End Sub:Sub reginfo():SoonBiz.LoadTemplatesAdmin("admin_user"):Dim sql:sql="select * from ["& sheethead &"_user] where id="&SoonBiz.rid("id"):SoonBiz.title="注册资料":SoonBiz.adhead:SoonBiz.nstate("查看用户注册资料"):Response.Write SoonBiz.ReplaceMdb("",sql,template.html(9),"",1):End Sub:Sub userinfo():SoonBiz.LoadTemplatesAdmin("admin_user"):Dim sql:sql="select * from ["& sheethead &"_user] where id="&SoonBiz.rid("id"):SoonBiz.title="个人资料":SoonBiz.adhead:SoonBiz.nstate("查看用户个人资料"):Response.Write SoonBiz.ReplaceMdb("",sql,template.html(12),"",1):End Sub:Sub saveuserinfo():Dim i,sql:Dim user_ispublic,user_info,user_design,user_intro:id=SoonBiz.rid("id"):user_ispublic=SoonBiz.RequestStr("公开","user_ispublic","post",0,0,1,30,1):user_info="user_info":For i=1 To 16:user_info=user_info & "|" & SoonBiz.RequestStr("个人资料","user_info("& i &")","post",1,1,255,30,0):Next:user_design=SoonBiz.RequestStr("签名","user_design","post",1,1,300,30,0):user_intro=SoonBiz.RequestStr("简介","user_intro","post",1,1,300,30,0):ShowErr(""):sql="update "& sheethead &"_user set ":sql=sql & "user_ispublic='"& SoonBiz.Checkstr(user_ispublic) &"'":sql=sql & ",user_info='"& SoonBiz.Checkstr(user_info) &"'":sql=sql & ",user_design='"& SoonBiz.Checkstr(user_design) &"'":sql=sql & ",user_intro='"& SoonBiz.Checkstr(user_intro) &"'":sql=sql & " where id="&id:SoonBiz.Execute(sql):SoonBiz.adsuccess("保存成功!"):End Sub:Sub realinfo():SoonBiz.LoadTemplatesAdmin("admin_user"):Dim sql:Sql="select * from ["& sheethead &"_user] where id="&SoonBiz.rid("id"):SoonBiz.title="查看联系方式":SoonBiz.adhead:SoonBiz.nstate("查看联系方式"):Response.Write SoonBiz.ReplaceMdb("",sql,template.html(11),"",1):End Sub
%>