<!--#include file="../utf-8.asp" -->
<!--#include file="Function.asp" -->
<!--#include file="../CheckAdmin.asp" -->
<!--#include file="../../inc/ins.asp" -->
<%
'*******************************************************
'易达CMS中小企业快速建站系统
'软件开发 黑龙江省世纪伟成网络科技有限公司
'网址：http://yidacms.com
'软件享有著作权，未经公司或开发者同意禁止更改以下代码。
'*******************************************************

if request("yidacms")="tongbu" Then
shuaiweb_tongbuurl = request("shuaiweb_tongbuurl")
shuaiweb_tongbuwebpath = request("shuaiweb_tongbuwebpath")

if request("shuaiweb_validation") <> validation  then
	response.write"<script language=javascript>alert('口令码错误，不能添加项目！');history.back(-1);</script>" 
	response.end
end if

if left(request("shuaiweb_tongbuurl"),18) <> "h"&"t"&"t"&"p"&":"&"//"&"y"&"i"&"d"&"a"&"c"&"m"&"s"&"."&"c"&"o"&"m" then '保护判断，防止被黑客利用！
	response.write"<script language=javascript>alert('非法的同步地址！');history.back(-1);</script>" 
	response.end
end if

Set xPost = CreateObject("Microsoft.XMLHTTP")
xPost.Open "GET",""&shuaiweb_tongbuurl&"",False
xPost.Send()    
Set sGet = CreateObject("ADODB.Stream")
tongbudown()
set sGet = nothing    
set sPOST = nothing    
response.Write("本次同步完成！<br>")
End If

if request("yidacms")="chajiagengxin" Then
	url="http://yidacms.com/htdocs/web/vipchajian.asp"
	str=getHTTPPage(url)
	title=strcut(str,"<h1>","</h1>",2)
if title = Plugindate then
	response.Write("插件文件已是最新,不需要更新！<br>")
		else
Set xPost = CreateObject("Microsoft.XMLHTTP") 
downurl()
xPost.Send()    
Set sGet = CreateObject("ADODB.Stream")    
down()
set sGet = nothing    
set sPOST = nothing    
response.Write("插件主程序更新完成！<br>2秒后进行下一组更新!<meta http-equiv=""Refresh"" content=""2;URL=admin_newPlugins.asp?yidacms=chajiagengxin2"" />")
 End If
end if

if request("yidacms")="chajiagengxin2" Then
	url="http://yidacms.com/htdocs/web/vipchajian2.asp"
	Set xPost = CreateObject("Microsoft.XMLHTTP") 
downurl2()
xPost.Send()    
Set sGet = CreateObject("ADODB.Stream")    
down2()
set sGet = nothing    
set sPOST = nothing    
response.Write("插件调用程序更新完成！<br>全部更新完毕!")
end if

'**********************************************
'易达3获取插件最新日期,用来更新系统插件(测试!)
Function getHTTPPage(url)
On Error Resume Next
dim http
set http=Server.createobject("Microsoft.XMLHTTP")
Http.open "GET",url,false
Http.send()
if Http.readystate<>4 then
exit function
end if
getHTTPPage=bytesToBSTR(Http.responseBody,"GB2312")
set http=nothing
If Err.number<>0 then
Response.Write "<p align='center'><font color='red'><b>服务器获取文件内容出错</b></font></p>"
Err.Clear
End If
End Function
Function BytesToBstr(body,Cset)
dim objstream
set objstream = Server.CreateObject("adodb.stream")
objstream.Type = 1
objstream.Mode =3
objstream.Open
objstream.Write body
objstream.Position = 0
objstream.Type = 2
objstream.Charset = Cset
BytesToBstr = objstream.ReadText
objstream.Close
set objstream = nothing
End Function
'**********************************************
Function strCut(strContent,StartStr,EndStr,CutType)
Dim strHtml,S1,S2
strHtml = strContent
On Error Resume Next
Select Case CutType
Case 1
S1 = InStr(strHtml,StartStr)
S2 = InStr(S1,strHtml,EndStr)+Len(EndStr)
Case 2
S1 = InStr(strHtml,StartStr)+Len(StartStr)
S2 = InStr(S1,strHtml,EndStr)
End Select
If Err Then
strCute = "<p align='center'>没有找到需要的内容。</p>"
Err.Clear
Exit Function
Else
strCut = Mid(strHtml,S1,S2-S1)
End If
End Function
%>