<!--#include file="../Include/Const.Asp" -->
<!--#include file="../Include/ConnDatabase.asp" -->
<!--#include file="../Include/System_Language.asp" -->
<!--#include file="../Include/Version.Asp" -->
<!--#include file="CheckAdmin.Asp"-->
<%
'*********************************************
'软件名称：博科企业网站内容管理系统（BOKECMS）
'软件开发：博科网络科技工作室
'网   址：http://www.bokew.net
'服务QQ：530051328
'服务邮箱：bbfhq@163.com
'微信公众号：bokewlkj
'*********************************************
%>
<%
Call SiteInfo()
%>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="<%=Bokecms_Lang_Copyright(13)%>">
<meta name="author" content="<%=Bokecms_Lang_Copyright(3)%>">
<title><%=Bokecms_Lang_Copyright(1)%> <%=Soft_Version%></title>
<!--#Include file="BokeCMS_Css.Asp"-->
</head>
<body>
<!--#Include file="BokeCMS_Top.Asp"-->
<!--#Include file="BokeCMS_Meun.Asp"-->
<div id="wrap">
    <%
	If InStr(CompanyAdminPurview, "|15,") = 0 Then
		response.Write ("<br /><br /><div style='height:100%; text-align:center' class='main'><font style='color:red; font-size:14px;')>"&Bokecms_Lang_System(26)&"</font></div>")
		response.End
	End If
	%>
<%Dim DBmb,connstrmb,connmb,action,id,Importpath,Importto,str2,rsi,rsmb,k
action=request.form("action")
DBmb="../ads/temp/ads.mdb"  '可修改
connstrmb="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(""&DBmb&"")
  On Error Resume Next
	Set connmb = Server.CreateObject("ADODB.Connection")
	connmb.open connstrmb
	If Err Then
		err.Clear
		Set Connmb = Nothing
		Response.Write "数据库连接出错，请检查连接字串。"'注释，需要把这几个字翻译成英文。
		Response.End
End If
if request("action")="Importto" Then
set rsmb=server.createobject("adodb.recordset")
sql = "select * from BokeCMS_ads"
rsmb.open sql,connmb,1,1
if rsmb.eof then
response.write "<table>目标数据库有默认广告记录，无法导入！</table>"
rsmb.close
set rsmb=Nothing
response.end
end If
    Set Rsi=server.createobject("adodb.recordset")
	Sql="Select * From BokeCMS_ad"
	Rsi.open Sql,conn,1,3
	IF Not Rsi.Eof Then
	response.write "<script language='javascript'>	alert('默认广告已存在,不能重复');location.href='javascript:history.go(-1)';</script>"		
	rsi.close:Set rsi=Nothing
    rsmb.close:set rsmb=Nothing
	Response.End
	Else	
do while not rsmb.eof	

	Rsi.Addnew
	Rsi("ADID")=Rsmb("ADID")
	Rsi("ADType")=Rsmb("ADType")
	Rsi("ADSrc")=Rsmb("ADSrc")
	Rsi("ADWidth")=Rsmb("ADWidth")
	Rsi("ADHeight")=Rsmb("ADHeight")
	Rsi("adsjs")=Rsmb("adsjs")
	Rsi("ADLink")=Rsmb("ADLink")
	Rsi("ADAlt")=Rsmb("ADAlt")
	Rsi("ADNote")=Rsmb("ADNote")
	Rsi("ADViews")=Rsmb("ADViews")
	Rsi("ADHits")=Rsmb("ADHits")
	Rsi("ADStopViews")=Rsmb("ADStopViews")
	Rsi("ADStopHits")=Rsmb("ADStopHits")
	Rsi("ADStopDate")=Rsmb("ADStopDate")
	Rsi("ADjs")=Rsmb("ADjs")
	Rsi("IsSys")=Rsmb("IsSys")
	Rsi("adkg")=Rsmb("adkg")
	Rsi("Advertisement_host")=Rsmb("Advertisement_host")
	Rsi.update	

rsmb.movenext
Loop
End if
rsi.close
set rsi=Nothing
rsmb.close
set rsmb=Nothing
response.write "<script language=JavaScript>" & chr(13) & "alert('导入默认广告成功！');" &"window.location='list.asp'" & "</script>"
elseif request("action")="Export" Then
%>
目标数据库名称及路径应为：temp/ads.mdb 
<%set rsi=server.createobject("adodb.recordset")
set rsmb=server.createobject("adodb.recordset")
sql = "select * from BokeCMS_ad"
rsi.open sql,conn,1,1
if rsi.eof then
response.write "<table>还没有默认广告记录，无法导出！</table>"
response.end
end If
connmb.Execute ("delete from BokeCMS_ads")'先清空目标数据库
do while not rsi.eof
sql="select * from [BokeCMS_ads]"
rsmb.open sql,connmb,1,3
rsmb.addnew
	Rsmb("ADID")=Rsi("ADID")
	Rsmb("ADType")=Rsi("ADType")
	Rsmb("ADSrc")=Rsi("ADSrc")
	Rsmb("ADWidth")=Rsi("ADWidth")
	Rsmb("ADHeight")=Rsi("ADHeight")
	Rsmb("adsjs")=Rsi("adsjs")
	Rsmb("ADLink")=Rsi("ADLink")
	Rsmb("ADAlt")=Rsi("ADAlt")
	Rsmb("ADNote")=Rsi("ADNote")
	Rsmb("ADViews")=Rsi("ADViews")
	Rsmb("ADHits")=Rsi("ADHits")
	Rsmb("ADStopViews")=Rsi("ADStopViews")
	Rsmb("ADStopHits")=Rsi("ADStopHits")
	Rsmb("ADStopDate")=Rsi("ADStopDate")
	Rsmb("ADjs")=Rsi("ADjs")
	Rsmb("IsSys")=Rsi("IsSys")
	Rsmb("adkg")=Rsi("adkg")
	Rsmb("Advertisement_host")=rsi("Advertisement_host")
rsmb.update

rsi.movenext
Loop
rsi.close
set rsi=Nothing
rsmb.close:Set rsmb=Nothing
response.write "<script language=JavaScript>" & chr(13) & "alert('导出默认广告成功！目标数据库为\ads\temp\ ads.mdb');" &"window.location='BokeCMS_ad_inout.asp'" & "</script>"
else%>	
	<div class="main">
        <div class="row">
            <ol class="breadcrumb">
                <li><i class="fa fa-home"></i> <%=Bokecms_Lang_Copyright(14)%></li>
                <li><%=Bokecms_Lang_Copyright(2)%></li>
                <li class='active'>广告导入导出</li>
            </ol>	
        </div>	
        <div class="row">
            <div class="col-lg-12 hideInIE8">
                <div class="panel panel-default">
                    <div class="panel-heading">
                        <h2><i class="fa fa-edit"></i><span class="break"></span>标准广告管理</h2> 
                    </div>
                    <div class="panel-body">
                       <a class="ShortCut2" href="BokeCMS_ad_list.asp">  
                            <i class="fa fa-list"></i>
                            <div class="title">标准广告列表</div>
                        </a>
                           <a class="ShortCut2" href="BokeCMS_ad_ad.Asp">  
                            <i class="fa fa-list"></i>
                            <div class="title">默认广告列表</div> 
							</a>
                       <a class="ShortCut2" href="BokeCMS_ad_list.asp?action=stop&all=ok">  
                            <i class="fa fa-list"></i>
                            <div class="title">到期广告列表</div>
                        </a>
                       <a class="ShortCut2" href="BokeCMS_ad_createjs_all.asp">  
                            <i class="fa fa-list"></i>
                            <div class="title">一键生成所有广告代码</div>
                        </a>							
 			              <a class="ShortCut2" href="BokeCMS_ad_inout.asp">  
                            <i class="fa fa-list"></i>
                            <div class="title">导出广告</div>
                        </a>
                       <a class="ShortCut2" href="BokeCMS_ad_inout.asp">  
                            <i class="fa fa-list"></i>
                            <div class="title">导入广告</div>
                        </a>
                    </div>
                </div>
            </div>
        </div>	
        <div class="row">
            <div class="col-lg-12 hideInIE8">
                <div class="panel panel-default">
                    <div class="panel-heading">
                        <h2><i class="fa fa-edit"></i><span class="break"></span>广告导入导出</h2> 
                    </div>
                    <div class="panel-body">                        
<%If request("action")="Import" then%>
  <form action="?Action=Importto" name="form1" method="post">
    <tr valign="middle"> 
      <td bgcolor="#FFFFFF"><br>
	 	  &nbsp;&nbsp;默认广告导入来源数据库：
              <input type=text size=50 name=Importpath value="/ads/temp/ads.mdb" class="smallInput" readonly>
              &nbsp;&nbsp;<BR>
  					&nbsp;&nbsp;数据库名称及路径应为：/ads/temp/ads.mdb<BR>
						&nbsp;&nbsp;
              <input type=submit value="下一步" class="button">
                </td>
	</tr>
	<input type="hidden" name="action" value="Restore">
  </form>
<%ElseIf request("action")="Export" Then
Else%>
<tr valign="middle"> 
      <td bgcolor="#FFFFFF"><br>
<a href="BokeCMS_ad_inout.asp?Action=Import">导入广告</a><br><a href="BokeCMS_ad_inout.asp?Action=Export" >导出广告（导出的同时将清空目标数据库）</a>
</td>
	</tr>
<%end if%>
</table>
<%end If
Call CloseDB(conn)%>
                    </div>
                </div>
            </div>
        </div>

     
    </div>
	<!--#Include file="BokeCMS_End.Asp"-->
</div>
<!--#Include file="BokeCMS_Js.Asp"-->
</body>
</html>
