<%@ LANGUAGE=VBScript.Encode codepage ="936" %>
<%if session("adminname")="" then
response.Redirect "../login.asp"
end if%>
<%
Response.Buffer = True
Response.Expires = 0
Response.CacheControl = "Private"
Sub Msg (v)
 Response.Write "<html><head><meta http-equiv='Content-Type' content='text/html; charset=gb2312'><meta http-equiv='pragma' content='no-cache'><style type=text/css>body{color:black;font-family:宋体;font-size:9pt;background-color:buttonface;border-bottom:medium none;border-left:medium none;border-right:medium none;border-top:medium none;padding-bottom:0px;padding-left:0px;padding-right:0px;padding-top:0px}</style></head><body leftMargin=0 topMargin=0 marginheight=0 marginwidth=0>"
 Response.Write "<script Language=JavaScript>alert('" & v & "');window.close();</script></body></html>"
 Response.End
End Sub
nickname=Session("hxf_u_nickname")
grade=Int(Session("hxf_u_grade"))
inthechat=Session("hxf_u_inthechat")
userip=Request.ServerVariables("REMOTE_ADDR")
If nickname = "" Then Msg "不在聊天室中，不能设置系统参数！"
if Session("hxf_u_inthechat")<>"1" and nickname<>"聊天室管理员" then Msg "不在聊天室中，不能设置系统参数！"
If grade <> 12 or Int(Session("ipbt"))<>1 Then Msg "你不是聊天室管理员 \n\n 没有设置系统参数的权限！"
f1 = Trim(Request.Form("f1"))
If f1 = "" Then Msg "请指定参数名称！"
If Server.URLEncode(f1) <> f1 Then Msg "参数名称有误！"
allow = ",chatroomname,bbsurl,homepageurl,opendate,userinto,userout,userdown,automanname,chatroombgimage,chatroombgcolor,logo,chatimage,chatbgcolor,titlecolor,chatcolor,disloginname,saysfilterstr,htmldontinstr,"
If InStr(allow, "," & f1 & ",") = 0 Then Msg "参数名称有误！"
f2 = Trim(Request.Form("f2"))
If f2 = "" Then Msg "请指定新参数值。"
If f2 = Application("wsaxhxf_c_" & f1) Then Msg "参数值没有变化，不需要更改。"
f2 = Replace(f2, Chr(13) & Chr(10), "")
Select Case f1
 Case "chatroomname"
  systemname = "聊天室名称"
 Case "bbsurl"
  systemname = "配套论坛网址"
 Case "opendate"
  systemname = "主页地址"
 Case "userinto"
  systemname = "进入聊天室提示"
 Case "userout"
  systemname = "退出聊天室提示"
 Case "userdown"
  systemname = "断线提示"
 Case "automanname"
  systemname = "机器人名称"
 Case "chatroombgimage"
  systemname = "聊天室背景图片"
 Case "chatroombgcolor"
  systemname = "聊天室背景颜色"
 Case "logo"
  systemname = "登陆页面logo图片"
 Case "chatimage"
  systemname = "聊天窗口背景图片"
 Case "chatbgcolor"
  systemname = "聊天窗口背景颜色"
 Case "titlecolor"
  systemname = "标题区颜色"
 Case "chatcolor"
  systemname = "对话区颜色"
 Case "disloginname"
  systemname = "用户名称禁止字符"
 Case "saysfilterstr"
  systemname = "脏话过滤字符"
 Case "htmldontinstr"
  systemname = "html标签过滤字符"
End Select
n = Year(Date)
y = Month(Date)
r = Day(Date)
s = Hour(Time())
f = Minute(Time())
m = Second(Time())
If Len(y) = 1 Then y = "0" & y
If Len(r) = 1 Then r = "0" & r
If Len(s) = 1 Then s = "0" & s
If Len(f) = 1 Then f = "0" & f
If Len(m) = 1 Then m = "0" & m
sjsfm = s & ":" & f & ":" & m
sj = n & "-" & y & "-" & r & " " & sjsfm
Set conn=Server.CreateObject("ADODB.CONNECTION")
Set rs=Server.CreateObject("ADODB.RecordSet")
connstr=Application("wsaxhg_connstr")
conn.open connstr
sql = "SELECT value FROM system WHERE name = '" & f1 & "'"
rs.Open sql, conn, 1, 3
If rs.Eof And rs.Bof Then
 rs.Close
 conn.Close
 Set rs = Nothing
 Set conn = Nothing
 Msg "参数名称有误！"
End If
rs("value") = f2
rs.Update
rs.Close
sql = "INSERT INTO logs (type, logtime, name, ip, opertion) VALUES ('5', '" & sj & "', '" & nickname & "', '" & userip & "', '修改了系统参数 <font class=cp>[" & systemname & "]</font> ')"
conn.Execute sql
conn.Close
Set rs = Nothing
Set conn = Nothing
Application.Lock
 Application("wsaxhxf_c_" & f1) = f2
Application.UnLock
Msg "■ 操作完成 ■\n\n[" & systemname & "]设置完成\n\n刷新系统参数即可看到。"
%>