<!--#include file="setup.asp"-->
<!--#include file="check.asp"-->
<%
Function ArrayLength(ByVal Arr)
 On Error Resume Next
 ArrayLength = UBound(Arr) - LBound(Arr)
 If Err.Number > 0 Then
  Err.Clear
  ArrayLength = ArrayLength Xor ArrayLength
  Response.Write Err.Number
 End If
End Function  


If Not CheckAdmin("AddGameList") Then
    Server.Transfer("showerr.asp")
    Response.End
End If
Dim Rs_type, Sql_Type
titlename="智能发布系统"
Admin_header
Action = LCase(Request("action"))
Select Case Trim(Action)
Case "add"
	Call AddGame()
Case Else
	Call AddList()
End Select
Sub AddList()
%>
<SCRIPT language=JavaScript>
function check(){

if(document.form1.gameid.value=="")
{
alert("请选择您要发布的广告类型！");
document.form1.gameid.focus();
return false;
}

 
}
</SCRIPT>
<SCRIPT language=javascript src="../JS/setday.js"></SCRIPT>
<style type="text/css">
<!--
.STYLE1 {
	color: #FF0000;
	font-weight: bold;
}
-->
</style>

<table width=98% align="center" border="0" cellspacing="1" cellpadding="2" class="tableBorder">
<FORM name="form" action="?action=add" method="post">
<tr> 
<th colspan="2">智能发布系统</th>
</tr>
<TR>
<td align="right" class="TableRow1">游戏分类：</TD>
<td class="TableRow1">
<%
Set Rs_type = Server.CreateObject("ADODB.RecordSet")
Sql_Type="select * from Gq_Gametype order by orderid"
rs_type.open sql_type,conn,1,3
%>
<select id=select size=1 name=gameid>
<%
if rs_type.eof and rs_type.bof then
response.Write "<option value= selected>请添加游戏分类</option>"
else
do while not rs_type.EOF
response.Write "<option value="&rs_type("id")&">"&rs_type("game")&"</option>"
rs_type.movenext
loop
rs_type.close
end if
%></select><font color="#FF0000">*</font></TD>
</TR>
<TR>
<td align="right" class="TableRow1">条数：</TD>
<td class="TableRow1"><INPUT name=count size="2" maxLength=2 value="1" class="input_out"> <FONT face=宋体 color=#FF0000>*</FONT> <FONT color=#006600>连体广告</FONT></TD> 
</TR>


<TR>
<td align="right" class="TableRow1">广告期限：</TD>
<td class="TableRow1">
<select name="Daytime" size="0">
<option value="1">推荐①天</option>
<option value="2">推荐②天</option>
<option value="3">推荐③天</option>
<option value="4">推荐④天</option>
<option value="5">推荐⑤天</option>
<option value="6">推荐⑥天</option>
<option value="7">推荐⑦天</option>
<option value="30">推荐①月</option>
<option value="90">推荐①季</option>
<option value="364">推荐①年</option>
</select> <font color="#FF0000">*</font></TD> 
</TR>
<TR>
<td align="right" class="TableRow1">全天+精品：</font></TD>
<td class="TableRow1">
<select name="Fine" size="0">
<option value="0" selected>不 推 荐</option>
<option value="1">精品推荐</option>
<option value="9">全天套黄</option>
</select> 开始显示时间:<INPUT name=addtime value="<%=Now()%>" size="22" maxLength=22 class="input_out">* 设置为精品推荐则会在首页最顶部显示精品字样</TD>
</TR>
<TR>
<td align="right" class="TableRow1">固定推荐：</font></TD>
<td class="TableRow1">
<select name="isBest" size="0">
<option value=0 selected>不 固 定</option>
<option value=1>固定推荐</option>
</select> <font color="#FF0000">*</font> <font color="#000000">设置为固定推荐则会在首页套黄处出现</font></TD>
</TR>
<TR>
<td align="right" class="TableRow1">通宵推荐：</font></TD>
<td class="TableRow1">
<select name="hot" size="0">
<option value=0 selected>不 通 宵</option>
<option value=1>通宵推荐</option>
<option value=2>通宵固顶</option>
</select> <font color="#FF0000">*</font> <font color="#000000">设置为通宵推荐则会在首页套黄处底部出现通宵推荐</font></TD>
</TR>
<TR>
<td align="right" class="TableRow1">快速提交：</TD>
<td class="TableRow1"><label></label>
  &nbsp;&nbsp;&nbsp;
  <table  border="0" cellpadding="2" cellspacing="1">
    <tr>
      <td><textarea name="kuaicontent" cols="60" rows="30" class="qiku2_out"></textarea></td>
      <td width="290"><span class="input_out">格式如下：(多个广告用|||分隔)<br />
        <br />
            服务器名：CaiSF.com系统V2.0<br />
            服务器IP：admin-bjl.com系统V2.0<br />
            开区时间：<%=date()%> 09:30<br />
            地区线路：中国电信<br />
            版本介绍：CaiSF发布网专业制作发布站<br />
            客服QQ：53660542<br />
            主页地址：Www.CaiSF.COM<br />
            |||<br />
            服务器名：CaiSF.com系统V2.0.5<br />
            服务器IP：admin-bjl.com系统V2.0.5<br />
            开区时间：<%=date()%> 09:30<br />
            地区线路：中国网通<br />
            版本介绍：CaiSF发布网专业制作发布站2<br />
            客服QQ：53660542<br />
            主页地址：Www.CaiSF.COM</td>
    </tr>
  </table></TD>
</TR>
<TR>
<td class="TableRow1" colspan="2" height="30" align="center"><INPUT type=submit class=btn value= 提交广告信息 name=btn><input class="btn" type="reset" name="reset" value="清空重写" class="TableRow1"></TD>
</TR>
</FORM>
</TABLE>

<%
End Sub
Sub AddGame()
dim name,ip,gameid,sdate,hour,minute,addr,xingzhi,homepage,download,hot,isBest,Daytime,Fine,Service,QQ,addtime,count,kuaicontent,xianlu,shijian,sj,fans,j
Dim arrfield, arrrx, rx
'==================================

fans=split(QiKuCMS.CheckStr(request("kuaicontent")),"|||")
j=0
for each i in fans

kuaicontent=fans(j)

arrfield=array("name","ip","shijian","addr","xingzhi","qq","homepage")
arrrx=array("^(服务器名|游戏名字)[:：]([^\r\n]+)","^(服务器IP|服务器ip|登陆器地址|登陆器下载)[:：]([^\r\n]+)","^(开区时间|开放时间|广告时间|游戏时间)[:：]([^\r\n]+)","^(线路类别|线路类型|地区线路|游戏线路)[:：]([^\r\n]+)","^(版本介绍|版本类型|版本简介|游戏介绍|游戏类型|游戏简介)[:：]([^\r\n]+)","^(客服QQ|客服 QQ|客服 Q Q|客服ＱＱ)[:：]([^\r\n]+)","^(主页地址|主页网址|游戏地址|游戏网址)[:：]([^\r\n]+)")
set rx = new regexp
rx.Multiline=true
rx.Global=True
Dim y
for y=0 to ubound(arrfield)
  rx.Pattern=arrrx(y)
  Dim mc, m
  set mc=rx.Execute(kuaicontent)
    if mc.count>0 then
     set m=mc(0)
execute (arrfield(y) & "=""" & m.submatches(1) & """") 
  else
  end if
next
set rx=nothing
if InStr(homepage, "http://") = 0 then
homepage="http://"&homepage
end if
	if InStr(addr, "电信") > 0 and InStr(addr, "网通") = 0 then
        Service=0
	elseif InStr(addr, "电信") = 0 and InStr(addr, "网通") > 0 then
        Service=1
	else
        Service=2
	end if
sj=split(shijian," ")

	if ArrayLength(sj)<>1 then
	response.Write("请检查=开区时间=")
	response.End()
	end if 

sdate=sj(0)

	if ArrayLength(split(sj(1),":"))<>1 then
	response.Write("请检查=开区时间=")
	response.End()
	end if 

hour=split(sj(1),":")(0)
minute=split(sj(1),":")(1)
gameid=QiKuCMS.CheckStr(trim(request.form("gameid")))
hot=QiKuCMS.CheckStr(request.form("hot"))
isBest=QiKuCMS.CheckStr(request.form("isBest"))
Daytime=QiKuCMS.CheckStr(request.form("Daytime"))
Fine=QiKuCMS.CheckStr(request.form("Fine"))
download=QiKuCMS.CheckStr(request.form("download"))
addtime=QiKuCMS.CheckStr(request.form("addtime"))
count=QiKuCMS.CheckStr(request.form("count"))
if name="" or ip="" or gameid="" or Service="" or  homepage="" or QQ="" or xingzhi="" or addr="" or SDATE="" or hour="" or minute=""  then
	response.write "<script>alert('带*的选项必须填写或选择，请返回检查后再提交');history.back()</script>"
	response.end()
end If
	Dim ppp
	ppp = 1
	for ppp = 1 to count
		set rs = server.createobject("adodb.recordset")
		sql="select * from Gq_sfdata" 
		rs.open sql,conn,1,3
		rs.addnew
		rs("name")=name
		rs("ip")=ip
		rs("gameid")=gameid
		rs("Service")=Service
		rs("SDATE")=sdate
		rs("hour")=hour
		rs("minute")=minute
		rs("addr")=addr
		rs("xingzhi")=xingzhi
		rs("QQ")=QQ
		rs("homepage")=homepage
		rs("download")=homepage
		rs("ulock")=1
		rs("isBest")=1
		rs("hot")=1
		rs("Fine")=2
        rs("hot")=hot
        rs("isBest")=isBest
        rs("Fine")=Fine
        rs("addtime")=addtime
        rs("Daytime")=Daytime
        if trim(request.form("isBest"))="1" then
	rs("BestTime")=Now()
	end if
        if trim(request.form("hot"))="1" then
	rs("hottime")=Now()
	end if
        if trim(request.form("fine"))="1" then
	rs("finetime")=Now()
	end If
	rs.update
	Rs.Close:Set Rs = Nothing
  Next
'==================================
j=j+1
next
	response.Write"<script>alert('发布成功！');location.href='QiKuCMS_add.asp';</script>"
end sub
Admin_footer
CloseConn
%>
 
