<%@ 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 = ",openurl,visitor,chatmoney,yj,unyj,changename,cess,dg,call,kickvalue,kickvalueno,lockvalue,lockvalueno,bombvalue,bombvalueno,level1to2,level2to3,level3to4,level4to5,maxpeople,closedoor,disnewuser,disproxy,maxtimeout,allowhtml,enablesaysfilter,lowmanagehigh,moneymanage,kicknamedontlogin,iplocktime,"
If InStr(allow, "," & f1 & ",") = 0 Then Msg "参数名称有误！"
f2 = Trim(Request.Form("f2"))
If f2 = "" Then Msg "请指定新参数值。"
If f2 = Application("wsaxhxf_c_" & f1) Then Msg "参数值没有变化，不需要更改。"
If Not IsNumeric(f2) Then Msg "参数值格式有误！"
f2 = Int(f2)
If f2 < 0 Then Msg "参数值格式有误！"
f2 = Replace(f2, Chr(13) & Chr(10), "")
Select Case f1
 Case "openurl"
  systemname = "退出时是否弹指定窗口"
 Case "visitor"
  systemname = "聊天室访问量"
 Case "chatmoney"
  systemname = "聊天室资金库"
 Case "yj"
  systemname = "永久保留所需货币"
 Case "unyj"
  systemname = "取消永久保留所需货币"
 Case "changename"
  systemname = "修改用户名所需货币"
 Case "cess"
  systemname = "货币流通税率"
 Case "dg"
  systemname = "点歌所需货币"
 Case "call"
  systemname = "呼叫所需货币"
 Case "kickvalue"
  systemname = "踢人所需货币"
 Case "kickvalueno"
  systemname = "踢人被扣货币"
 Case "lockvalue"
  systemname = "封锁所需货币"
 Case "lockvalueno"
  systemname = "封锁被扣货币"
 Case "bombvalue"
  systemname = "轰炸所需货币"
 Case "bombvalueno"
  systemname = "轰炸被扣货币"
 Case "level1to2"
  systemname = "1-2级所需经验值"
 Case "level2to3"
  systemname = "2-3级所需经验值"
 Case "level3to4"
  systemname = "3-4级所需经验值"
 Case "level4to5"
  systemname = "4-5级所需经验值"
 Case "maxpeople"
  systemname = "允许最大聊天人数"
 Case "closedoor"
  systemname = "聊天室开门/关门"
 Case "disnewuser"
  systemname = "是否允许新人登陆"
 Case "disproxy"
  systemname = "是否允许代理登陆"
 Case "maxtimeout"
  systemname = "允许不发言时间"
 Case "allowhtml"
  systemname = "允许使用html级别"
 Case "enablesaysfilter"
  systemname = "是否启用脏话过滤"
 Case "lowmanagehigh"
  systemname = "受否允许低级管理(同级)高级"
 Case "moneymanage"
  systemname = "是否启用货币管理"
 Case "kicknamedontlogin"
  systemname = "被踢后登陆时间限制"
 Case "iplocktime"
  systemname = "封锁IP的时间长度"
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刷新系统参数即可看到。"
%>