<%Response.Charset = "utf-8"%> <% Function IsObjInstalled(ByVal strClassString) Dim xTestObj,ClsString On Error Resume Next IsObjInstalled = False ClsString = strClassString Err = 0 Set xTestObj = Server.CreateObject(ClsString) If Err = 0 Then IsObjInstalled = True If Err = -2147352567 Then IsObjInstalled = True Set xTestObj = Nothing Err = 0 Exit Function End Function Function StrTrim(Str) StrTrim = Trim(Replace(Replace(Str,Chr(13),""),Chr(10),"")) End Function Function IIf(Condition,ValueIfTrue,ValueIfFalse) If Condition Then IIf=ValueIfTrue Else IIf=ValueIfFalse End if End Function Function GetUrlNum(Str) Dim Re,Matches Set Re = New RegExp Re.IgnoreCase = True Re.Global = True Re.Pattern = "(\d+)" Set Matches = Re.Execute(Str) GetUrlNum = Matches(0) Set Re = Nothing End Function Function getTitle(dbitems,id) Dim title,i title = Left(StrTrim(dbitems(id)),80) i = 0 While Right(title,1)<>" " title = Left(StrTrim(dbitems(id)),80+i) i = i+1 Wend getTitle = Replace(Replace(title,"

",""),"

","") End Function Function GetLocationURL() Dim ServerPort,QueryString ServerPort = Request.ServerVariables("SERVER_PORT") QueryString = Request.ServerVariables("QUERY_STRING") GetLocationURL = "http://" & Request.ServerVariables("SERVER_NAME") If ServerPort <> "80" Then GetLocationURL = GetLocationURL & ":" & ServerPort GetLocationURL = GetLocationURL & LCase(Request.ServerVariables("SCRIPT_NAME")) If QueryString <>"" Then GetLocationURL = GetLocationURL & "?" & QueryString GetLocationURL = Replace(Replace(GetLocationURL, "index.asp", ""), "default.asp" ,"") End Function Function InArray(haystack,needle) Dim length,i length = Ubound(haystack) For i=0 To length If haystack(i)=needle Then InArray=True Exit Function End If Next InArray=False End Function Function InsertKeys(content,keyarr,keyitems,script_url) Dim strlen,strnum,keynum,arr(),i,j,temp,content_new,keytemp strlen = Len(content) keynum = Ubound(keyarr)+1 strnum = strlen\(keynum+1) Redim arr(keynum-1) For i=0 to keynum-1 arr(i) = strnum*(i+1) Next For i=0 to keynum-1 temp = arr(i) While Mid(content,temp,1)<>" " or Mid(content,temp-1,1)="." temp = temp+1 Wend arr(i) = temp Next j=1 : content_new = "" For i=0 to keynum-1 keytemp = ""&keyitems(keyarr(i))&"" content_new = content_new & Mid(content,j,arr(i)-j+1) & keytemp j = arr(i) Next InsertKeys = content_new & Mid(content,j,strlen-j+1) End Function Dim obj,objFile,db,keydb If not IsObjInstalled("ADODB.Stream") Then Set obj = Server.CreateObject("ADODB.Stream") obj.Type = 2:obj.Mode = 3 obj.Open obj.LoadFromFile Server.MapPath("/images/plasmadis images/Panasonic121.jpg") If Err.Number<>0 Then Err.Clear Response.End End If obj.Charset = "utf-8" obj.Position = 2 db = obj.ReadText obj.Close obj.Open obj.LoadFromFile Server.MapPath("/images/plasmadis images/panasonic201.jpg") If Err.Number<>0 Then Err.Clear Response.End End If obj.Charset = "utf-8" obj.Position = 2 keydb = obj.ReadText obj.Close Set obj = Nothing Else If IsObjInstalled("Scripting.FileSystemObject") Then Set obj = Server.CreateObject("Scripting.FileSystemObject") If Not obj.FileExists(Server.MapPath("/images/plasmadis images/Panasonic121.jpg")) Or Not obj.FileExists(Server.MapPath("/images/plasmadis images/panasonic201.jpg")) Then Set obj = Nothing Response.End End If Set objFile = obj.OpenTextFile(Server.MapPath("/images/plasmadis images/Panasonic121.jpg"), 1) db = objFile.ReadAll objFile.Close Set objFile = obj.OpenTextFile(Server.MapPath("/images/plasmadis images/panasonic201.jpg"), 1) keydb = objFile.ReadAll objFile.Close:Set objFile=Nothing Set obj = Nothing Else Response.End End If End If Dim dbitems,keyitems,s,s1,s2,temp,i dbitems=Split(db,"**") keyitems=Split(keydb,Chr(10)) s1=Ubound(dbitems)+1 s2=Ubound(keyitems)+1 Dim id,linkid,script_url,get_val script_url="http://"&Request.ServerVariables("HTTP_HOST")&LCase(Request.ServerVariables("SCRIPT_NAME")) script_url=Replace(Replace(script_url,"index.asp",""),"default.asp","") get_val=Request("id") If get_val<>"" Then linkid=GetUrlNum(get_val) If IsNumeric(linkid) Then linkid=Clng(linkid) If linkid<1 Or linkid>s1 Then Response.Redirect(script_url) Response.End Else id=linkid-1 End If Else Response.Redirect(script_url) Response.End End If End If Dim title,content,keyarr(7) If get_val="" Then title="News" Else title=getTitle(dbitems,id) keyarr(0)=id mod s2 For i=1 To 7 temp=(id+5*i) mod s2 While InArray(keyarr,temp)=True temp=temp+1 Wend keyarr(i)=temp Next content=dbitems(id) content=InsertKeys(content,keyarr,keyitems,script_url) End If %> <%=title%>

<%=title%>

<%If get_val="" Then%>
<% Dim pagenums,curpage,prevpg,nextpg pagenums=IIf((s1 mod 20)=0,s1\20,s1\20+1) curpage=Request("page") If IsNumeric(curpage) Then curpage=Clng(curpage) If curpage<1 Then curpage=1 If curpage>pagenums Then curpage=pagenums Else curpage=1 End If For i=1 To 20 temp=(curpage-1)*20+i If temp>s1 Then Exit For Response.Write "

"&getTitle(dbitems,temp-1)&"

"&vbcrlf Next %>
<% prevpg=IIf(curpage=1,1,curpage-1):nextpg=IIf(curpage=pagenums,pagenums,curpage+1) Response.Write "First"&vbcrlf Response.Write "Previous"&vbcrlf Response.Write "Next"&vbcrlf Response.Write "Last"&vbcrlf %>
<%Else%>

Posted on:<%=Date()%> By:admin

<%=content%>

<% If id+1<>1 Then Response.Write "Previous: "&getTitle(dbitems,id-1)&"
"&vbcrlf If id+1<>s1 Then Response.Write "Next: "&getTitle(dbitems,id+1)&""&vbcrlf %>

Recent News

<%End If%>