<!--#include file="inc_const.asp"-->
<%response.expires=0
Response.CacheControl = "Private"
application.lock

set cschat=server.createobject("ffcschat.cssbchat")
my_level=cschat.getLevel(Session,Application(ConstStr & "_user_list"),Application(ConstStr & "_room_list"))

application.unlock
if  my_level-application( ConstStr & "_superlevel")<>0 then
 set cschat=nothing
 response.end
end if

function chkstr(u)
  chkstr=replace(replace(replace(replace(replace(trim(u),chr(13),""),chr(10),""),"'",""),"\",""),chr(34),"")
end function

application.lock
bbss=application( ConstStr & "_bbss")
if request("B1")="修改" then
  id=cint(request("id"))
  a_link=chkstr(request("a_link"))
  a_text=chkstr(request("a_text"))
  bbss(id,0)=a_link
  bbss(id,1)=a_text
  application( ConstStr & "_bbss")=bbss
elseif request("B1")="轮换" then
  if isarray(bbss) then
    for iii=ubound(bbss) to 1 step -1
      bbss(iii,0)=bbss(iii-1,0)
      bbss(iii,1)=bbss(iii-1,1)
    next
  else
   redim bbss(0,1)
  end if

  bbss(0,0)=chkstr(request("a_link"))
  bbss(0,1)=chkstr(request("a_text"))

  application( ConstStr & "_bbss")=bbss
  says = Application(ConstStr & "_says")
  current = Application(ConstStr & "_current")
  cschat.newsay "大家","",0,-2,"<\script>parent.addnews(\'" & bbss(0,0) & "\',\'" & bbss(0,1) & "\')</\script>","","",-5,says,current
  Application(ConstStr & "_says") = says
  Application(ConstStr & "_current") = current
elseif request("B1")="追加" then
  dim new_bbss
  if isarray(bbss) then
    redim new_bbss(ubound(bbss)+1,1)
    for iii=1 to ubound(new_bbss)
      new_bbss(iii,0)=bbss(iii-1,0)
      new_bbss(iii,1)=bbss(iii-1,1)
    next
  else
    redim new_bbss(0,1)
  end if
  new_bbss(0,0)=chkstr(request("a_link"))
  new_bbss(0,1)=chkstr(request("a_text"))

  application( ConstStr & "_bbss")=new_bbss
  says = Application(ConstStr & "_says")
  current = Application(ConstStr & "_current")
  cschat.newsay "大家","",0,-2,"<\script>parent.addnews(\'" & new_bbss(0,0) & "\',\'" & new_bbss(0,1) & "\')</\script>","","",-5,says,current
  Application(ConstStr & "_says") = says
  Application(ConstStr & "_current") = current
elseif request("B1")="save" then
  Set Conn=Server.CreateObject("ADODB.Connection")
  conn.open Application( ConstStr & "_connstr")
  for i=ubound(bbss) to 0 step -1
    conn.Execute("insert into scrollad (ad_link,ad_title,ad_new_flag) values ('"&chkstr(bbss(i,0))&"','"&chkstr(bbss(i,1))&"',0)")
  next
  conn.close
  set conn=nothing
elseif request("B1")="read" then
  Set Conn=Server.CreateObject("ADODB.Connection")
  conn.open Application( ConstStr & "_connstr")
  sql = "SELECT count(*) as cs FROM scrollad"
  Set Rs = conn.Execute(sql)
  i = Rs("cs")
  If i = 0 Then
    Application(ConstStr & "_bbss") = ""
  Else
    sql = "SELECT * FROM scrollad order by ID desc"
    Set Rs = conn.Execute(sql)
    If i > 6 Then i = 6
    ReDim bbss(i - 1, 1)
    For j = 0 To i - 1
     bbss(j, 1) = Trim(Rs("ad_title"))
     bbss(j, 0) = Trim(Rs("ad_link"))
     Rs.MoveNext
   Next
   Application(ConstStr & "_bbss") = bbss
 End If
 rs.close
 set rs=nothing
 conn.close
 set conn=nothing 
end if
bbss=application( ConstStr & "_bbss")

set cschat=nothing
application.unlock
%>
 <META content="text/html; charset=gb2312" http-equiv=content-type><meta HTTP-EQUIV='Pragma' CONTENT='no-cache'>
<link rel="stylesheet" type="text/css" href="chat.css"><style>td{text-align:left}u{color:990099}a{color:red}</style>
<body  style="background-color:EAF2FF;color:112233;scrollbar-Base-Color: #b0d8ff;SCROLLBAR-DARKSHADOW-COLOR:#b0d8ff;SCROLLBAR-arrow-COLOR:#336699;SCROLLBAR-TRACK-COLOR: EAF2FF;SCROLLBAR-3DLIGHT-COLOR: #b0d8ff;SCROLLBAR-SHADOW-COLOR: #336699;SCROLLBAR-HIGHLIGHT-COLOR: #b0d8ff;" leftmargin=3 topmargin=20 style="color:000000">
  <table width=450 align=center cellspacing=0 cellpadding=0 border=1 BORDERCOLORLIGHT=#000000 BORDERCOLORDARK=#ffffff>
  <tr><td class=navy1><center>广告字幕当前信息 [<a href=javascript:history.go(0)>刷新</a>] [<a href='javascript:history.go(-1)'>后退</a>]</center></td></tr>
  <tr><td><table align="center" height="100%" width="100%" border=0 cellspacing=0 cellpadding=4>
<%if isarray(bbss) then
 for i=0 to ubound(bbss)%>
  <tr><td>
  <form method="POST" action="modad1online.asp">
  <input type=hidden name=id value='<%=i%>'>
  字幕<%=i+1%>:<input type=text name=a_text maxlength=100 size=50 value='<%=bbss(i,1)%>'><tr><td nowrap>
  联接:<input type=text name=a_link maxlength=100 size=40 value='<%=bbss(i,0)%>'>
  <input type="submit" class=navy1 value="修改" name="B1">
  <input class=navy1 type="reset" value="复原" name="B2"><br><hr style="width:100%"></td></tr></form>
<%next
end if%>
<tr><td class=navy1><center>添加/轮换新的字幕[修改后在线聊友自动刷新]</center>
<tr><td><form method="POST" action="modad1online.asp">
字幕:<input type=text name=a_text maxlength=100 size=50 ><tr><td nowrap>
  联接:<input type=text name=a_link maxlength=100 size=40>
  <input type="submit" class=navy1 value="轮换" name="B1">
  <input type="submit" class=navy1 value="追加" name="B1"></td></tr></form>
<tr><td class=navy1><center>其他功能及说明</center><tr><td>
<ul><li><u>追加</u>字幕:不删除原来的字幕而添加新的字幕。字幕总数增加1。
<li>字幕<u>轮换</u>:字幕总数不变，删除字幕1(最早)，添加新的字幕到最后。
<li><a href=modad1online.asp?B1=save>保存至数据库</a>:字幕被动态修改后，把内存字幕保存到聊天室数据库设置里面。
<li><a href=modad1online.asp?B1=read>重读数据库</a>:修改聊天室数据库设置后，将新设置重新读入到内存。
<li><u>应用</u>：在字幕中显示网页更新信息、最新新闻报道、论坛最新热门等等，可以使用字幕轮换，只需要向scrollad表中插入新的记录ad_link,ad_title，聊天室系统会自动即时更新显示。</table></table></table></body>



