?? newssoftindatabase_1.asp
字號:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%
Server.ScriptTimeOut = 300 '腳本超時時間(秒)
Response.Buffer = True
Const IsUpdate = False '是否進行強制更新數據庫并重新生成靜態文件
%>
<!--#include file="Check.asp" -->
<!--#include file="../inc/HeadDH.asp" -->
<!--#include file="../inc/oConn.asp" -->
<!--#include file="../inc/function.asp" -->
<!--#include file="../Soft/Function.asp" -->
<%
Call PrintHead("多多軟件園最新更新軟件信息采集入庫")
Print "<br><p align='center'>"
For i = 1 to 2
Response.Write "<a href='NewsSoftInDataBase_1.asp?ClassID="&i&"'>第 "&i&" 頁</a> "
Next
%>
</p>
<TABLE align='center' width='550' cellpadding='4' cellspacing='1' bgcolor='#f5f5f5' style="border:1 solid #b8b8b8">
<TR>
<TD align='center' style="background:#ffffff;border:1 solid #cccccc">多多軟件園軟件資料入庫</TD>
</TR>
<TR>
<TD height="60" style="background:#ffffff;border:1 solid #cccccc">狀態:<span id='UpdateText'></span></TD>
</TR>
<TR>
<TD height="30" style="background:#ffffff;border:1 solid #cccccc"><span id='UpdateTime'></span></TD>
</TR>
</TABLE>
<script language='JavaScript'>UpdateTime.innerHTML="請等待..."</script>
<%
Response.Flush()
Call NewsSoftList()
Call PrintFoot()
Response.Flush()
Call CLoseCOnn()
Sub NewsSoftList()
Dim strUrl,strList,strTmp,strID,i,ClassID
ClassID = Request.QueryString("ClassID")
If ClassID = "" Then ClassID = 1
strUrl = "http://www.ddooo.com/Softnew/"&Year(Date)&"_"&Month(Date)&"_"&Day(Date)&"_"&ClassID&".htm"
strList = getHTTPPage(strUrl)
'取得下載文件列表
strTmp = strCut(strList,"<!--軟件列表循環開始-->","</table>",2)
'Response.Write strTmp
'Response.End
strArray = Split(strTmp,"<a href=""/softdown")
For i = 2 to Ubound(strArray)
strID = strCut(strArray(i),"/",".htm",2)
Call PageIfEnd()
Call SoftInfoInData(strID,ClassID)
Next
Response.Write "<script language='JavaScript'>UpdateTime.innerHTML=""更新完成,共更新"&i&"個軟件,用時"&Timer-PageStart&"秒...""</script>"
End Sub
Function GetHtml(SoftID)
Dim strUrl,strHtml
strUrl = "http://www.ddooo.com/softdown/"&SoftID&".htm"
strHtml = GetHttpPage(strUrl)
GetHtml = strHtml
End Function
Sub SoftInfoInData(SoftID,ClassID)
On Error Resume Next
Dim strHtml
strHtml = GetHtml(SoftID)
Dim strTmp,strSQL,objRs
Dim SoftName,SoftSize,SoftLanguage,SoftClass,SoftOperation,SoftType,SoftUpdateTime,SoftBigClass
Dim SoftLinkMan,SoftRemark,SoftAboutID,ArticleAboutID,SoftClassBigName,SoftClassSmallName
Dim SOftDownUrlList,SoftDownUrlArray,i,strTmp1,strTmp2,strTmp3,strTmp4
strList = strHtml
strTmp = strHtml
'SoftName = strCut(strTmp,"<font color='#004FC6' size='3'>","</font>",2)
SoftSize = strCut(strTmp,"<B>軟件大小:</B>","<br>",2)
SoftLanguage = strCut(strTmp,"<B>軟件語言:</B>","<br>",2)
SoftType = strCut(strTmp,"<B>軟件類別:</B>","<br>",2)
SoftOperation = strCut(strTmp,"<B>運行環境:</B>","<br>",2)
SoftUpdateTime = strCut(strTmp,"<B>更新時間:</B>","<br>",2)
SoftLinkMan = strCut(strTmp,"<B>聯 系 人:</B>","<br>",2)
SoftLinkMan = strCut(SoftLinkMan,""">","</a>",2)
SoftChangShang = strCut(strTmp,"<B>開 發 商:</b>","</a>",2)
SoftChangShang = strCut(SoftChangShang,"target=_blank>","</a>",2)
SoftRemark = strCut(strTmp,"<td><B>軟件簡介:","<SCRIPT LANGUAGE=""JavaScript1.1"" SRC=""/js/down9.js""></SCRIPT>",2)
SoftRemark = strCut(SoftRemark,"<td>","</td>",2)
SoftRemark = HTMLEncode(SoftRemark)
SoftDownUrl = strCut(strTmp,"<td><img src=""/images/d_download.gif"" align=""absmiddle"" border=""0"">","target=_blank>",2)
SoftDownUrl = strCut(SoftDownUrl,"<a href=""/SoftDownx.asp?SoftID="&SoftID&"&url=","""",2)
Dim AddDownUrlArray(1)
AddDownUrlArray(0) = "Delete From "&DownUrlTable&" Where SkySoftID = "&SoftID&""
AddDownUrlArray(1) = "Insert into "&DownUrlTable&" (SkySoftID,SoftDownUrl) values ("&SoftID&",'"&SoftDownUrl&"')"
'相關軟件
strTmp = strHtml
strTmp1 = strCut(strTmp,"相關軟件:</b></td>","</table>",2)
strTmpArray = Split(strTmp1,"<tr>")
strTmp3 = ""
For i = 1 to UBound(strTmpArray)
strID = strCut(strTmpArray(i),"href=""/softdown/",".htm"">",2)
SoftAboutID = SoftAboutID & strID & ","
Next
Erase strTmpArray
If InStr(SoftAboutID,",")>0 Then
SoftAboutID = Left(SoftAboutID,Len(SoftAboutID)-1)
End If
strTmp = strCut(strHtml,"<td width=""643"">您的位置:<a href=""/"">下載首頁</a>","<SCRIPT",2)
strArray = Split(strTmp,"→")
SoftClassBigName = strCut(strArray(1),"'>","</a>",2)
strSQL = "Select SoftBigClassID From "&BigClassTable&" Where SoftBigCLassName='"&SoftClassBigName&"'"
Set objRs = oConn.Execute(strSQL)
If Not objRs.Eof Then
SoftBigClass = objRs(0)
Else
oConn.Execute("Insert into "&BigClassTable&" (SoftBigClassName) values ('"&SoftClassBigName&"')")
SoftBigClass = oConn.Execute(strsQL)(0)
End If
Set objRs = Nothing
SoftClassSmallName = strCut(strArray(2),"'>","</A>",2)
SoftName = strArray(UBound(strArray))
Erase strArray
Print "<br><table align='center' width='"&MaxTableWidth&"' style='border:1 solid #cccccc;background:#f5f5f5'><tr><td>"
Print "軟件名稱:"&SoftName&"<br>"
Print "軟件尺寸:"&SoftSize&"<br>"
Print "軟件語言:"&SoftLanguage&"<br>"
Print "軟件類型:"&SoftType&"<br>"
Print "軟件平臺:"&SoftOperation&"<br>"
Print "更新時間:"&SoftUpdateTime&"<br>"
Print "軟件作者:"&SoftLinkMan&"<br>"
Print "軟件廠商:"&SoftChangShang&"<br>"
Print "軟件介紹:"&SoftRemark&"<br>"
Print "下載地址:"&SoftDownUrl&"<hr>"
Print "</td></tr></table><br>"
strSQL = "Select SoftClassID From "&ClassTable&" Where SoftClassBigName = '"&SoftClassBigName&"' And SoftClassSmallName = '"&SoftClassSmallName&"'"
Set objRs = oConn.Execute(strSQL)
If Not objRs.Eof Then
SoftClass = objRs(0)
Else
Set objRs = Nothing
strSQL = "Insert into "&ClassTable&" (SoftClassBigName,SoftClassSmallName,SoftBigClassID) values ('"&SoftClassBigName&"','"&SoftCLassSmallName&"',"&SoftBigClass&")"
oConn.Execute(strSQL)
SoftClass = oConn.Execute("Select SoftClassID From "&ClassTable&" Where SoftClassBigName = '"&SoftClassBigName&"' And SoftClassSmallName = '"&SoftClassSmallName&"'")(0)
End If
Set objRs = Nothing
strSQL = "Select SoftUpdateTime,SoftID From "&InfoTable&" Where SkySoftID = "&SoftID&""
Set objRs = oConn.Execute(strSQL)
If objRs.Eof Then
strSQL = "Insert Into "&InfoTable&" (SkySoftID,SoftName,SoftCLass,SoftSize"&_
",SoftLanguage,SoftType,SoftOperation,SoftUpdateTime,SoftLinkMan,SoftChangShang"&_
",SoftRemark,SoftAboutID,ArticleAboutID,SoftBigClass) values ("&SoftID&",'"&SoftName&"'"&_
","&SoftClass&",'"&SoftSize&"','"&SoftLanguage&"','"&SoftType&"'"&_
",'"&SoftOperation&"','"&SoftUpdateTime&"','"&SoftLinkMan&"','"&SoftChangShang&"'"&_
",'"&SoftRemark&"','"&SoftAboutID&"','"&ArticleAboutID&"',"&SoftBigClass&")"
oConn.Execute(strSQL)
'------------插入軟件下載地址
oConn.Execute(AddDownUrlArray(1))
'---------------------
Response.Write "<script language='JavaScript'>UpdateText.innerHTML=""插入軟件ID["&SoftID&"]資料成功....""</script>"
Else
If CDate(SoftUpdateTime)>CDate(objRs(0)) Or IsUpdate Then
strSQL = "Update "&InfoTable&" Set SoftName = '"&SoftName&"'"&_
",SoftClass = "&SoftClass&""&_
",SoftBigClass = "&SoftBigClass&""&_
",SoftSize = '"&SoftSize&"'"&_
",SoftLanguage = '"&SoftLanguage&"'"&_
",SoftType = '"&SoftType&"'"&_
",SoftOperation = '"&SoftOperation&"'"&_
",SoftUpdateTime = '"&SoftUpdateTime&"'"&_
",SoftLinkMan = '"&SoftLinkMan&"'"&_
",SoftChangShang = '"&SoftChangShang&"'"&_
",SoftRemark = '"&SoftRemark&"'"&_
",SoftAboutID = '"&SoftAboutID&"'"&_
",ArticleAboutID = '"&ArticleAboutID&"'"&_
" Where SoftID = "&objRs(1)&""
oConn.Execute(strSQL)
'--------更新軟件下載地址
For i = 0 to UBound(AddDownUrlArray)
oConn.Execute(AddDownUrlArray(i))
Next
'---------------------------
Response.Write "<script language='JavaScript'>UpdateText.innerHTML=""更新軟件ID["&SoftID&"]資料成功....""</script>"
Else
Response.Write "<script language='JavaScript'>UpdateText.innerHTML=""軟件ID["&SoftID&"]的資料已經存在,且為最新,沒有進行更新操作....""</script>"
End If
End If
Set objRs = Nothing
If Err Then
Err.Clear
Response.Write "<script language='JavaScript'>UpdateText.innerHTML=""更新軟件ID["&SoftID&"]的資料時錯誤,沒有進行更新操作....""</script>"
End If
Response.Flush()
End Sub
'------ 過濾HTML代碼
Function HTMLEncode(fString)
If Not IsNull(fString) Then
fString = Replace(fString, CHR(39), "'") '單引號過濾
End If
HTMLEncode = fString
End Function
%>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -