<%
const BASE_64_MAP_INIT = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/" 
dim newline 
dim Base64EncMap(63) 
dim Base64DecMap(127) 
PUBLIC SUB initCodecs() 
newline = "<P>" & chr(13) & chr(10) 
dim max, idx 
max = len(BASE_64_MAP_INIT) 
for idx = 0 to max - 1 
Base64EncMap(idx) = mid(BASE_64_MAP_INIT, idx + 1, 1) 
next 
for idx = 0 to max - 1 
Base64DecMap(ASC(Base64EncMap(idx))) = idx 
next 
END SUB 
PUBLIC FUNCTION skcmscodeJ(plain) 
if len(plain) = 0 then 
skcmscodeJ = "" 
exit function 
end if 
dim ret, ndx, by3, first, second, third 
by3 = (len(plain) \ 3) * 3 
ndx = 1 
do while ndx <= by3 
first = asc(mid(plain, ndx+0, 1)) 
second = asc(mid(plain, ndx+1, 1)) 
third = asc(mid(plain, ndx+2, 1)) 
ret = ret & Base64EncMap( (first \ 4) AND 63 ) 
ret = ret & Base64EncMap( ((first * 16) AND 48) + ((second \ 16) AND 15 ) ) 
ret = ret & Base64EncMap( ((second * 4) AND 60) + ((third \ 64) AND 3 ) ) 
ret = ret & Base64EncMap( third AND 63) 
ndx = ndx + 3 
loop 
if by3 < len(plain) then 
first = asc(mid(plain, ndx+0, 1)) 
ret = ret & Base64EncMap( (first \ 4) AND 63 ) 
if (len(plain) MOD 3 ) = 2 then 
second = asc(mid(plain, ndx+1, 1)) 
ret = ret & Base64EncMap( ((first * 16) AND 48) + ((second \ 16) AND 15 ) ) 
ret = ret & Base64EncMap( ((second * 4) AND 60) ) 
else 
ret = ret & Base64EncMap( (first * 16) AND 48) 
ret = ret '& "=" 
end if 
ret = ret '& "=" 
end if 
skcmscodeJ = ret 
END FUNCTION 
PUBLIC FUNCTION skcmscodeD(scrambled) 
if len(scrambled) = 0 then 
skcmscodeD = "" 
exit function 
end if 
dim realLen 
realLen = len(scrambled) 
do while mid(scrambled, realLen, 1) = "=" 
realLen = realLen - 1 
loop 
dim ret, ndx, by4, first, second, third, fourth 
ret = "" 
by4 = (realLen \ 4) * 4 
ndx = 1 
do while ndx <= by4 
first = Base64DecMap(asc(mid(scrambled, ndx+0, 1))) 
second = Base64DecMap(asc(mid(scrambled, ndx+1, 1))) 
third = Base64DecMap(asc(mid(scrambled, ndx+2, 1))) 
fourth = Base64DecMap(asc(mid(scrambled, ndx+3, 1))) 
ret = ret & chr( ((first * 4) AND 255) + ((second \ 16) AND 3)) 
ret = ret & chr( ((second * 16) AND 255) + ((third \ 4) AND 15)) 
ret = ret & chr( ((third * 64) AND 255) + (fourth AND 63)) 
ndx = ndx + 4 
loop 
if ndx < realLen then 
first = Base64DecMap(asc(mid(scrambled, ndx+0, 1))) 
second = Base64DecMap(asc(mid(scrambled, ndx+1, 1))) 
ret = ret & chr( ((first * 4) AND 255) + ((second \ 16) AND 3)) 
if realLen MOD 4 = 3 then 
third = Base64DecMap(asc(mid(scrambled,ndx+2,1))) 
ret = ret & chr( ((second * 16) AND 255) + ((third \ 4) AND 15)) 
end if 
end if 
skcmscodeD=ret 
END FUNCTION 
call initCodecs 
Class SK_The_Lord_system_service
Private LocalCacheName, Cache_Data,CacheData
Public Reloadtime,Version,skurl,PathDoMain
Public SK_Root_directory,skweboaUpfile	
Private Sub Class_Initialize()
Reloadtime = 28800			
End Sub
Public Function SK_Host_site()
	   SK_Host_site = Trim("http://"&SK_sys(6) & MyDbPath)
		If SK_sys(29)="0" Then 
			SK_Root_directory=Trim("http://"&SK_sys(6)&MyDbPath)
			PathDoMain=SK_sys(6)
		Else 
			SK_Root_directory=Trim(MyDbPath)
		End If 	
    End Function
	Public Function S(Str)
		 S = Request(Str)
	End Function
	Public Function G(Str)
		 G = Request(Str)
	End Function
	Public Function SK_sys(id)  
   		Dim rs3
  		Set rs3=SK_axe("select * from sksys where id=" & id & "")	
		If Not rs3.eof Then 
			SK_sys=""&rs3("name")&""
 		rs3.Close:Set rs3=Nothing
		End If 
  	End Function 
	Public Function SK_syslable(id)  
   		Dim rs3
  		Set rs3=SK_axe("select * from sksys where id=" & id & "")	
		If Not rs3.eof Then 
			SK_syslable=""&rs3("lable")&""
 		rs3.Close:Set rs3=Nothing
		End If 
  	End Function 
	Public Function SK_rssql(table,id,vaid)   
   		Dim rs3
  		Set rs3=SK_axe("select * from "&table&" where id=" & id & "")	
		If Not rs3.eof Then 
			SK_rssql=""&rs3(""&vaid&"")&""
 		rs3.Close:Set rs3=Nothing
		End If 
  	End Function 
 	Function SK_CPI_Object(str)
		Set SK_CPI_Object=CreateObject(str)
	End Function
 	Private Sub SK_list_Runtotheend()
		If IsObject(Conn) Then Conn.Close : Set Conn = Nothing
		Call CloseConn()
	End Sub
 	Public Function SK_axe(Command)
		If Not IsObject(Conn) Then ConnectionDatabase	
			on error resume next
			Set SK_axe = Conn.Execute(Command)
			If Err Then
				err.Clear
				Set Conn = Nothing
				Response.Write "SQL语法错误 "
				Response.Write Command
				Response.End
			End If
    End Function
		Public Function SK_attribute(Selected)
		 Dim RSObj
	    Set RSObj = SK_axe("Select AID,Name From attribute_skweb  where SKIF=1 ")
	  	Do While Not RSObj.Eof
		   IF Selected=RSObj(0) Then
			SK_attribute=SK_attribute & "<option value=""" & RSObj(0) & """ Selected>" & RSObj(1) & "</option>"& vbCrLf
		   Else
			SK_attribute=SK_attribute & "<option value=""" & RSObj(0) & """>" & RSObj(1) & "</option>"& vbCrLf
		   End If
		RSObj.MoveNext
		Loop
	  RSObj.Close:Set RSObj=Nothing
	End Function
 	Public Property Let Name(ByVal vNewValue)
		LocalCacheName = LCase(vNewValue)
		Cache_Data = Application(SkcmsCookies & "_" & LocalCacheName)
	End Property
	Public Property Let Value(ByVal vNewValue)
		If LocalCacheName <> "" Then
			ReDim Cache_Data(2)
			Cache_Data(0) = vNewValue
			Cache_Data(1) = Now()
			Application.Lock
			Application(SkcmsCookies & "_" & LocalCacheName) = Cache_Data
			Application.UnLock
		End If
	End Property
	Public Property Get Value()
		If LocalCacheName <> "" Then
			If IsArray(Cache_Data) Then
				Value = Cache_Data(0)
			End If
		End If
	End Property
	Public Function SK_Object_Epmty()
		SK_Object_Epmty = True
		If Not IsArray(Cache_Data) Then Exit Function
		If Not IsDate(Cache_Data(1)) Then Exit Function
		If DateDiff("s", CDate(Cache_Data(1)), Now()) < (60 * Reloadtime) Then SK_Object_Epmty = False
	End Function
	Public Function WEBID()
	execute(skcmscodeD("SUYgU0tfc3lzKDQwKTw+Ik9mZW04IiZza2Ntc2NvZGVKKFNLX3N5cyg2KSZTS19zeXMoMzkpKSYiZXdsYmYiIFRIRU4gOiBXRUJJRD0iZmFsc2UiIDogZWxzZSA6IFdFQklEPSJ0cnVlIiA6IGVuZCBpZg"))
	End Function
	Function SK_getxml_File(FileName)
		If Not IsObject(Application(SkcmsCookies&"_Config"&FileName)) Then
		  Dim objXmlFile:set objXmlFile = SK_CPI_Object("msxml2.FreeThreadedDOMDocument"& MsxmlVersion)
		  objXmlFile.async = false
		  objXmlFile.setProperty "ServerHTTPRequest", true 
		  objXmlFile.load(FileName)
		  Set Application(SkcmsCookies&"_Config"&FileName)=objXmlFile
	   End If  
		Set SK_getxml_File=Application(SkcmsCookies&"_Config"&FileName)
	End Function
	Function NoAppSK_getxml_File(FileName)
		  Dim objXmlFile:set objXmlFile = SK_CPI_Object("msxml2.FreeThreadedDOMDocument"& MsxmlVersion)
		  objXmlFile.async = false
		  objXmlFile.setProperty "ServerHTTPRequest", true 
		  objXmlFile.load(FileName)
		 Set NoAppSK_getxml_File=objXmlFile
	End Function
 	Public Function AField(Parameters)
  		  execute("call "&Parameters&"()")
    	  AField= skwebField
	End Function 
	Function SK_rgexfield(ByVal Str, ByVal Pattern)
		If trim(Str)="" Then SK_rgexfield = False : Exit Function
		Dim Re,Pa
		Set Re = New RegExp
		Re.IgnoreCase = True
		Re.Global = True
		Pa = Pattern'正则代码
		Re.Pattern = Pa
		SK_rgexfield = Re.Test(CStr(Str))
		Set Re = Nothing
	End Function	
 
	
	Public Function SK_Operating_SK_The_authority(Permission,HQskweb)
		Dim HQarrTemp,HQi,HQL,HQSK_MrootlassID
		HQarrTemp=split(session("HQQXLX"),",")'
		For HQI=LBound(HQarrTemp) To Ubound(HQarrTemp)'遍历
			if InStr(HQarrTemp(HQI),Permission) > 0 Then
				HQSK_MrootlassID=Split(HQarrTemp(HQI),"-")
				If UBound(HQSK_MrootlassID)>0 Then 
					If HQSK_MrootlassID(1)=HQskweb Then
						SK_Operating_SK_The_authority=True
						Exit Function
					Else	
						SK_Operating_SK_The_authority=False
					End If 
				End if
			End  If 
		Next 
	End Function	
	
	
   Function GetAbsolutePath(RelativePath)    'SQL连接外部数据
		dim Exp_Path,Matches,tempStr
		tempStr=Replace(RelativePath,"\","/")
		if instr(tempStr,":/")>0 then
			GetAbsolutePath=RelativePath
			Exit Function
		End if
		set Exp_Path=new RegExp
		Exp_Path.Pattern="(Data str=|dbq=)(.)*"
		Exp_Path.IgnoreCase=true
		Exp_Path.Global=true
		Set Matches=Exp_Path.Execute(tempStr)
		If instr(LCase(tempStr),"*.xls")<>0 Then
		GetAbsolutePath="driver={microsoft excel driver (*.xls)};dbq="&Server.MapPath(split(Matches(0).value,"=")(1))
		ElseIf Instr(Lcase(tempstr),"*.dbf")<>0 Then
		GetAbsolutePath="driver={microsoft dbase driver (*.dbf)};dbq="&Server.MapPath(split(Matches(0).value,"=")(1))
		Else
		GetAbsolutePath="Provider=Microsoft.Jet.OLEDB.4.0;Data str="&Server.MapPath(split(Matches(0).value,"=")(1))
		End If
	End Function
	
 Function RsToxml(RSObj,row,xmlroot)
			Dim i,node,rs,j,DataArray,fieldName
			If xmlroot="" Then xmlroot="xml"
			If row="" Then row="row"
			Set RsToxml = Server.CreateObject("msxml2.FreeThreadedDOMDocument"& MsxmlVersion)
			RsToxml.appendChild(RsToxml.createElement(xmlroot))
			If Not RSObj.EOF Then
						DataArray=RSObj.GetRows(-1)
						For i=0 To UBound(DataArray,2)
							Set Node=RsToxml.createNode(1,row,"")
							j=0
							For Each rs in RSObj.Fields
							    fieldName=LCase(rs.name)
								if fieldName="username" then
								node.attributes.setNamedItem(RsToxml.createNode(2,fieldName,"")).text= lcase(DataArray(j,i))& ""
								else
								node.attributes.setNamedItem(RsToxml.createNode(2,fieldName,"")).text= DataArray(j,i)& ""
								end if
								j=j+1
							Next
							RsToxml.documentElement.appendChild(Node)
						Next
			End If
			DataArray=Null
	End Function
	
	 Public Function RecordsetToxml(RSObj,row,xmlroot)
	  Dim i,node,rs,j,DataArray
	  If xmlroot="" Then xmlroot="xml"
	  If row="" Then row="row"
	  Set RecordsetToxml=Server.CreateObject("msxml2.FreeThreadedDOMDocument"& MsxmlVersion)
	  RecordsetToxml.appendChild(RecordsetToxml.createElement(xmlroot))
	  If Not RSObj.EOF Then
	   DataArray=RSObj.GetRows(-1)
	   For i=0 To UBound(DataArray,2)
		Set Node=RecordsetToxml.createNode(1,row,"")
		j=0
		For Each rs in RSObj.Fields		   
		   node.attributes.setNamedItem(RecordsetToxml.createNode(2,"skweb"&j,"")).text= DataArray(j,i)& ""
		   j=j+1
		Next
		RecordsetToxml.documentElement.appendChild(Node)
	   Next
	  End If
	  DataArray=Null
	 End Function

	Public Sub SK_CaheDEL(MyCaheName)
		Application.Lock
		Application.Contents.Remove (SkcmsCookies & "_" &MyCaheName)
		Application.UnLock
	End Sub
	
 	Public Function SK_GetRandomize(CMS_number)
		Randomize
		Dim CMS_Randchar,CMS_Randchararr,CMS_RandLen,CMS_Randomizecode,CMS_iR
		CMS_Randchar="0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z"
		CMS_Randchararr=split(CMS_Randchar,",") 
		CMS_RandLen=CMS_number 
		For CMS_iR=1 to CMS_RandLen
			CMS_Randomizecode=CMS_Randomizecode&CMS_Randchararr(Int((21*Rnd)))
		Next 
		SK_GetRandomize = CMS_Randomizecode
	End Function

    Public Function SK_Check_the_English_name(Chars)
		Dim Charname, i, c
		Charname = Chars
		SK_Check_the_English_name = True
		If Len(Charname) <= 0 Then
			SK_Check_the_English_name = False
			Exit Function
		End If
		For i = 1 To Len(Charname)
		   C = Mid(Charname, i, 1)
			If InStr("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ@,.0123456789|-_", c) <= 0  Then
			   SK_Check_the_English_name = False
			Exit Function
		   End If
	   Next
	End Function
 
	Public Function SK_function_execution(Parameters,number)
		On Error Resume Next
 		Dim I,funamID
		For I=1 To Parameters
		funamID=funamID&""""&number(i)&""""&","
 		Next 
 		funamID=Left(funamID, Len(funamID) - 1)
		funamID=Replace(funamID,"}","")
 		execute(SK_Temporarily_style(MyDbPath&"SKCMS/SK_function/"&number(0)&".sk","utf-8"))
 		execute("call "&number(0)&"("&funamID&")")
    	If Err Then 
		    SK_function_execution="" & Err.Description & ""
 		    Err.Clear
		Else 
			SK_function_execution= skwebcool
	    End If 
	End Function 
 
	Public Function SK_Statistical_model_data(MID)
		Dim Dataparameters
	    Name="SK_Statistical_model_data"&MID
	    If SK_Object_Epmty() Then 
			Set Dataparameters=SK_axe("Select Count(id)  From "&SK_Mroot(MID,2)&"")
			If Not Dataparameters.eof Then 
				Value=Dataparameters(0)
				SK_Statistical_model_data=Dataparameters(0)
				Dataparameters.close:set Dataparameters=nothing
			End If 
		Else
			SK_Statistical_model_data=Value
		End If 
	 End Function 

	 Public Function SK_TodayStatistical_model_data(MID)
	   Dim TodayValue
		Set TodayValue=SK_axe("Select Count(id)  From "&SK_Mroot(MID,2)&" where DateDiff(""d"",UpdateTime," & NowString & ")=0")
		If Not TodayValue.eof Then  
			SK_TodayStatistical_model_data=TodayValue(0)
			TodayValue.close:set TodayValue=nothing
		End If 
	 End Function 

	 Public Function SK_LISTStatistical_model_data(CID)
	   Dim ClassValue
	   Name="SK_LISTStatistical_model_data"&CID
	   xjcit=SK_LISTStati(CID)
	   
	   If SK_Object_Epmty() Then 
			Set ClassValue=SK_axe("Select Count(id)  From "&SK_Mroot(skCMSlist(CID,10),2)&" where classid='"&CID&"'")
			If Not ClassValue.eof Then 
				Value=ClassValue(0)
				SK_LISTStatistical_model_data=ClassValue(0)
				ClassValue.close:set ClassValue=nothing
			End If 
		Else
			SK_LISTStatistical_model_data=Value+csng(xjcit)
		End If 
	 End Function  	
	 
Function SK_LISTStati(cid)  
   		Dim rs3
  		Set rs3=SK_axe("select ModeID,ClassID from Class_skweb where ParentID='"&cid&"' ")	
        do while not rs3.eof  
        vtj=vtj+SK_axe("Select Count(id)  From "&SK_Mroot(rs3("ModeID"),2)&" where ClassID='"&rs3("ClassID")&"'")(0)
	    vtj=vtj+SK_LISTStati(rs3("ClassID"))
rs3.movenext
loop
rs3.close 
Set rs3=Nothing 
SK_LISTStati=vtj
End Function 

	Public Function SK_CHKadministrator()
		SK_CHKadministrator = False
		If Request.Cookies(SkcmsCookies)("AdminName") = "" Then
			SK_CHKadministrator = False
			Exit Function
		ElseIf Request.Cookies(SkcmsCookies)("SuperTF") = "1" Then 
			SK_CHKadministrator = True
			Exit Function
		End If 
	End Function 


	Public Function SK_SKCMSlinks(SK_Template_content_output)
		On Error Resume Next
		Dim sqlstr,Sitelink,i,reg,pattern,ky,rs,OpenType
 		Name=SkcmsCookies&"SK_SKCMSlinks"
		If SK_Object_Epmty() Then 
 			Set Rs = SK_axe("Select Title,Url,Num,bankform,description,tru,repcontent from Keyword_skweb  where Typeo=1 order by OrderID asc,id desc")
			If Rs.Eof Then Rs.Close : Set Rs = Nothing:SK_SKCMSlinks=SK_Template_content_output:Exit Function
			Value = Rs.GetRows(-1):Rs.Close : Set Rs = Nothing
		End If 
 		Sitelink=Value
		set reg=new RegExp
		reg.Global=true
		reg.IgnoreCase=true
		For  i=0 to ubound(Sitelink,2)
 			ky=trim(Sitelink(0,i))
			SK_Template_content_output=SK_New_keyword(ky,SK_Template_content_output)
			reg.Pattern=ky
			If Sitelink(5,i) = 1 Then 
 				If Sitelink(3,i) = ""  Then
					OpenType = ""
				Else
					OpenType = " target=""" & Sitelink(3,i) & """"
				End If
 				SK_Template_content_output=replace(SK_Template_content_output,ky,"<a href="""&Sitelink(1,i)&""" title="""&Sitelink(4,i)& """" & OpenType & ">"&ky&"</a>",1,Sitelink(2,i))
			Else 
				SK_Template_content_output=replace(SK_Template_content_output,ky,Rep(Sitelink(6,i),"{$content}",ky),1,Sitelink(2,i))
			End If 
			SK_Template_content_output=SK_New_keyword(ky,SK_Template_content_output)
 		Next 
		Set  reg=nothing
		For  i=0 to Index-1 
			SK_Template_content_output=replace(SK_Template_content_output,"$key"&i&"$",dic.Item("key"&i))
		Next 
		SK_SKCMSlinks=SK_Template_content_output
 	End Function 
	
	Function  SK_abbr_control(parameters)
	 Dim  strTemp,i
 	 strTemp=""
	 for i=1 to len(parameters & "")
	 If session.codepage="65001" Then 
		  strTemp=strTemp & ascw(mid(parameters,i,1))&"_"
	  Else 
		  strTemp=strTemp & asc(mid(parameters,i,1))&"_"
	  End If 
	  Next 
	  SK_abbr_control=strTemp
	End  Function  

	 Function SK_one_control(parameters)
		Dim ThisAr,i
		ThisAr=split(parameters,"_") 
		for i=0 to Ubound(ThisAr) 
		if IsNumeric(ThisAr(i)) Then
		  If session.codepage="65001" Then 
			SK_one_control=SK_one_control&chrw(ThisAr(i)) 
		  Else
			SK_one_control=SK_one_control&chr(ThisAr(i)) 
		   End If 
		end if
		next 
	End Function 
	
	
 	Public Function SK_IsValidEmail(Email)
		Dim names, name, I, c
		SK_IsValidEmail = True
		names = Split(Email, "@")
		If UBound(names) <> 1 Then SK_IsValidEmail = False: Exit Function
		For Each name In names
			If Len(name) <= 0 Then SK_IsValidEmail = False:Exit Function
			For I = 1 To Len(name)
				c = LCase(Mid(name, I, 1))
				If InStr("abcdefghijklmnopqrstuvwxyz_-.", c) <= 0 And Not IsNumeric(c) Then SK_IsValidEmail = False:Exit  Function
		   Next
		   If Left(name, 1) = "." Or Right(name, 1) = "." Then SK_IsValidEmail = False:Exit Function
		Next
		If InStr(names(1), ".") <= 0 Then SK_IsValidEmail = False:Exit Function
		I = Len(names(1)) - InStrRev(names(1), ".")
		If I <> 2 And I <> 3 Then SK_IsValidEmail = False:Exit Function
		If InStr(Email, "..") > 0 Then SK_IsValidEmail = False
	End Function

 
	Public Function SK_FoundInArr(strArr, strToFind, strSplit)
		Dim arrTemp, i
		SK_FoundInArr = False
		If InStr(strArr, strSplit) > 0 Then
			arrTemp = Split(strArr, strSplit)
			For i = 0 To UBound(arrTemp)
			If LCase(Trim(arrTemp(i))) = LCase(Trim(strToFind)) Then
				SK_FoundInArr = True:Exit For
			End If
			Next
		Else
			If LCase(Trim(strArr)) = LCase(Trim(strToFind)) Then SK_FoundInArr = True
		End If
	End Function
  
	 Function SK_Mroot(MID,RID)'获取模型数据22
	  on error resume next
	  If not IsObject(Application(SkcmsCookies &"_ModeConfig")) Then
		 Application.Lock
		 Dim RS:Set Rs=SK_axe("select ModeID,ModeName,ModeTable,IFmake,adminmb,Danwei,MakeFolderDir,RecyleIF,UpFilesDir,RefreshFlag,CommentTemp,ContentExtension,AutoPage,CommentCode,Commentsize,WriteComment,SK_userICOb,xsfs,xssl,gg,ModeNote,plgt,qttg From Mode_skweb Order by ModeID")
		 Set Application(SkcmsCookies &"_ModeConfig")=RecordsetToxml(rs,"Mode","ModeConfig")
		 Set Rs=Nothing
		 Application.unLock
	  End If
		 SK_Mroot=Application(SkcmsCookies &"_ModeConfig").documentElement.selectSingleNode("Mode[@skweb0=" & MID & "]/@skweb" & RID & "").text
	     if err then SK_Mroot=0:err.Clear
	 End Function
 
	 Function SK_gettable(MT)
		 Dim RS:Set Rs=SK_axe("select top 1 ModeID From Mode_skweb where ModeTable='"&MT&"' Order by ModeID")
		 If rs.eof Then SK_gettable="0":Exit Function 
		 SK_gettable=rs("ModeID"): Set Rs=Nothing
 	 End Function 

 	 Function SK_Mrooturl(MT)
		 Dim RS:Set Rs=SK_axe("select top 1 ModeID From Mode_skweb where MakeFolderDir='"&MT&"' Order by ModeID")
		 If rs.eof Then SK_Mrooturl="0":Exit Function 
		 SK_Mrooturl=rs("ModeID"): Set Rs=Nothing
 	 End Function 

  
	 Function skCMSlist(CID,RID)'28   '获取栏目数据
	  on error resume next
	  If not IsObject(Application(SkcmsCookies &"_ClassConfig")) Then
		 Application.Lock
		 Dim RS:Set Rs=SK_axe("select ClassID,enname,ClassName,ClassEName,FolderTemplate,ConTentTemplate,ClassArrGroupID,Extension,ClassKeywords,ClassDescription,ModeID,ParentID,skwebLink,moresite,sitepath,SK_SiteUrl,FilePathName,makehtmlname,content,sklistColumnSK_The_authority,ClassskReadthecontent,ClassSK_settlement_Style,ClassSK_Sof_tresult,ClassskUReadtheresults,ClassDividePercent,Seotitle,fcbl,urlname,ClassDivico From Class_skweb Order by OrderID")
		 Set Application(SkcmsCookies &"_ClassConfig")=RecordsetToxml(rs,"Class","ClassConfig")
		 Set Rs=Nothing
		 Application.unLock
	 End If
	     skCMSlist=Application(SkcmsCookies &"_ClassConfig").documentElement.selectSingleNode("Class[@skweb0=" & CID & "]/@skweb" & RID & "").text
		 if err then skCMSlist=0:err.Clear
	 End Function

 
   Function SK_Return_Mode(MID,accer)
	  Dim Rs
	  Set Rs=SK_axe("Select FieldName,Title,IsNotNull,FieldType,[check],regex,regError from Table_skweb  Where ModeID=" & MID & " and skweboa="&accer&" order by OrderID desc,ID Desc")
	 If Not Rs.Eof Then
	   SK_Return_Mode=Rs.GetRows(-1)
	 Else
	  SK_Return_Mode=""
	 End If

	 Rs.Close:Set Rs=Nothing
   End Function



   Function SK_systemReturn_Mode()'返回系统模型数组
	 Dim Rs
	  Set Rs =SK_axe("SELECT ModeID, ModeName,ModeTable, ModeStatus, IFmake,ModeNote  FROM Mode_skweb where ModeStatus=0 order by ModeID asc")
	 If Not Rs.Eof Then
	  SK_systemReturn_Mode=Rs.GetRows(-1)
	 Else
	  SK_systemReturn_Mode=""
	 End If
	 Rs.Close:Set Rs=Nothing
   End Function


	Public Function SK_Custom_folder(ModeID)
		Dim MXField,MXtext,i
		name=ModeID&"SK_Custom_folderCache"
		If SK_Object_Epmty() Then 
			MXField=SK_Return_Mode(ModeID,1)
			If IsArray(MXField) Then
				For I=0 To Ubound(MXField,2)
					MXtext=MXtext&","&MXField(0,I)
				Next
			Else
				MXtext=""
			End If 
			value=MXtext
		End If 
 		SK_Custom_folder=value
 	End Function 

 	
	Public Function SK_Custom_folderList(ModeID)
		Dim MXField,MXtext,i
		name=ModeID&"SK_Custom_folderListCache"
		If SK_Object_Epmty() Then 
			MXField=SK_Return_Mode(ModeID,1)
			If IsArray(MXField) Then
				For I=0 To Ubound(MXField,2)
					MXtext=MXtext&",["&MXField(0,I)&"]"
				Next
			Else
				MXtext=""
			End If 
			value=MXtext
		End If 
 		SK_Custom_folderList=value
 	End Function 
 
		
	
 	 Function SK_Main_navigation(TitleCss,OpenType,StrNav)
		  SK_Main_navigation =  StrNav  
	 End Function


 

 	Function SK_Return_columns_value(CID)
		Dim ClassRS
		Set ClassRS=SK_axe("Select ParentID,ClassID,Classname from class_skweb where ClassID='"& CID &"' order by ID desc")
		If Not ClassRs.eof Then 
			If ClassRS("ParentID")<>"0" Then
				SK_Return_columns_value = SK_Return_columns_value(ClassRS("ParentID")) &SK_Return_columns_value
			End If 
		End if
		SK_Return_columns_value=SK_Return_columns_value&CID&" , "
		ClassRS.Close:Set ClassRS = Nothing
 	End function


    Function  SK_GetParent(CID) 
	   SK_GetParent=Split(SK_Return_columns_value(CID),",")(0)
    End Function 
 
 	 Function SK_navigation(style,OpenType,gation,CID,styleMID,linktype)'栏目页导航
	    Dim skweb_Nav
		skweb_Nav=SK_DSUCANav(gation, OpenType, style, CID,linktype)
 		If CBool(Application(SkcmsCookies & "ModeHome")) = True Then
		  SK_navigation =  skweb_Nav&gation 
		Else
		  SK_navigation =  skweb_Nav
		End If
	 End Function	 
	 
	 
	 	 Function SK_page_navigation(style,OpenType,StrNav,CID,styleMID,linktype)'内容页导航
  		Dim ClassNavStr:ClassNavStr = SK_DSUCANav(StrNav, OpenType, style, CID,linktype)
 		SK_page_navigation =   ClassNavStr 
	 End Function
	 
	 
 	Function SK_naveDIYRW(CID)
		Dim ClassRS
		Set ClassRS=SK_axe("Select ParentID,ClassID,Classname from class_skweb where ClassID='"& CID &"' order by ID desc")
		If Not ClassRs.eof Then 
			If ClassRS("ParentID")<>"0" Then
				SK_naveDIYRW = SK_naveDIYRW(ClassRS("ParentID")) &SK_naveDIYRW
			End If 
		End if
		SK_naveDIYRW=SK_naveDIYRW&CID&" , "
		ClassRS.Close:Set ClassRS = Nothing
	End function

	Function SK_DSUCANav(StrNav,OpenType, style, ClassID,linktype)
	  Dim TSArr,i,Q
	  ClassID=SK_naveDIYRW(ClassID)
	  ClassID=Left(Trim(ClassID), Len(Trim(ClassID)) - 1)
	  TSArr = Split(ClassID, ",")
	  For I = 0 To UBound(TSArr)
		If i>0 Then Q=StrNav
		  if linktype=1 then
			SK_DSUCANav = SK_DSUCANav & Q &"" & skCMSlist(Trim(TSArr(I)), 2) & ""	  
		  else
		SK_DSUCANav = SK_DSUCANav & Q &"<a "& style &" href=""" & SK_MYListname(Trim(TSArr(I))) & """" &OpenType& ">" & skCMSlist(Trim(TSArr(I)), 2) & "</a>"
		  end if
	  Next
	End Function 

   
 	Function SK_CID_temp(ClassID)
	If ClassID = "" Then Exit Function
	Dim Rs,AllClassID
	Set Rs = SK_axe("Select ClassID From Class_skweb Where ParentID = '"&ClassID&"' Order By OrderID Desc,ID Desc") 
	If Rs.Eof Then
		AllClassID = "'" & ClassID & "'"
	Else
		AllClassID = ""
		Do While Not Rs.Eof
			AllClassID = AllClassID & "," & SK_CID_temp(Rs(0))
			Rs.MoveNext
		Loop
		AllClassID = "'" & ClassID & "'" & AllClassID
	End If
	SK_CID_temp = AllClassID
	Rs.Close:Set Rs = Nothing
	End Function
	
	
 	Public Function SK_window(ShowErr,ErrorUrl,errnum,time) '信息提示
		Response.Redirect(""&MyDbPath&"SKCMS/?Title="&Server.URLEncode(""&ShowErr&"")&"&time="&time&"&errnum="&errnum&"&___"&ErrorUrl)
		Response.end
	End Function 
 
 
	Public Function SK_savepic(ReplaceContent, SaveFilePath)
		Dim re, BeyondFile, BFU, SaveFileName, SysSK_DataCMS_subject
		Set re = New RegExp
		re.IgnoreCase = True
		re.Global = True
		re.Pattern = "((http|https|ftp|rtsp|mms):(\/\/|\\\\){1}((\w)+[.]){1,}(net|com|cn|org|cc|tv|[0-9]{1,3})(\S*\/)((\S)+[.]{1}(gif|jpg|png|bmp)))"
		Set BeyondFile = re.Execute(ReplaceContent)
		Set re = Nothing
		For Each BFU In BeyondFile
		If InStr(BFU, SK_sys(6)) = 0 Then 
			SaveFileName = "skcms_"&Year(Now()) & Month(Now()) & Day(Now()) & SK_MakeRandom(10) & Mid(BFU, InStrRev(BFU, "."))
			 Call SaveFile(SaveFilePath&SaveFileName,BFU)
			 If  SK_sys(30)="0" Then 
				ReplaceContent = Replace(ReplaceContent, BFU,  PathDoMain&SaveFilePath & SaveFileName)
			 Else
				ReplaceContent = Replace(ReplaceContent, BFU,  SaveFilePath & SaveFileName)
			 End If 
		End If 
		Next
		SK_savepic = ReplaceContent
	End Function
	
 
	
		
	'生成指定位数的随机数
	Public Function SK_MakeRandom(ByVal maxLen)
	  Dim strNewPass,whatsNext, upper, lower, intCounter
	  Randomize
	 For intCounter = 1 To maxLen
	   upper = 57:lower = 48:strNewPass = strNewPass & Chr(Int((upper - lower + 1) * Rnd + lower))
	 Next
	   SK_MakeRandom = strNewPass
	End Function


 
	Public Function strLength(Str)
		On Error Resume Next
		Dim WINNT_CHINESE:WINNT_CHINESE = (Len("中国") = 2)
		If WINNT_CHINESE Then
			Dim l, T, c,I
			l = Len(Str)
			T = l
			For I = 1 To l
				c = Asc(Mid(Str, I, 1))
				If c < 0 Then c = c + 65536
				If c > 255 Then
					T = T + 1
				End If
			Next
			strLength = T
		Else
			strLength = Len(Str)
		End If
		If Err.Number <> 0 Then Err.Clear
	End Function


        Public Function GetStrValue(ByVal strs, ByVal strlen)  ' 控制输出长度
		If strs = "" Then GetStrValue = "":Exit Function
		If strlen=0 Then GetStrValue=strs:Exit Function
		Dim l, T, c, I, strTemp
		Dim str
		str=CloseHtml(strs)
		l = Len(Str)
		T = 0
		strTemp = Str
		strlen = CLng(strlen)
		For I = 1 To l
 		    If session.codepage="65001" Then 
				c = Abs(Ascw(Mid(Str, I, 1)))
		    Else 
				c = Abs(Asc(Mid(Str, I, 1)))
		    End If 

			If c > 255 Then
				T = T + 2
			Else
				T = T + 1
			End If
			If T >= strlen Then
				strTemp = Left(Str, I)
				Exit For
			End If
		Next
		If strTemp <> Str Then	strTemp = strTemp
		GetStrValue=Replace(strs,str,strTemp)
        End Function
  
  		Public Function Return_to_numerical(ByVal CheckID)
			If CheckID <> "" And IsNumeric(CheckID) Then
				CheckID = CLng(CheckID)
				If CheckID < 0 Then CheckID = 0
			Else
				CheckID = 0
			End If
			Return_to_numerical = CheckID
		End Function
		

		Public Function C_SKCMSSQL(strChar)
			If strChar = "" Or IsNull(strChar) Then C_SKCMSSQL = "":Exit Function
			Dim strBadChar, arrBadChar, tempChar, I
			strBadChar = "$,#,',%,^,?,(,),<,>,[,],{,},/,\,;,:," & Chr(34) & "," & Chr(0) & ""
			arrBadChar = Split(strBadChar, ",")
			tempChar = strChar
			For I = 0 To UBound(arrBadChar)
				tempChar = Replace(tempChar, arrBadChar(I), "")
			Next
			C_SKCMSSQL = tempChar
		End Function

		Public Function SK_GetIP() 
			Dim strIPAddr 
			If Request.ServerVariables("HTTP_X_FORWARDED_FOR") = "" Or InStr(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), "unknown") > 0 Then 
				strIPAddr = Request.ServerVariables("REMOTE_ADDR") 
			ElseIf InStr(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), ",") > 0 Then 
				strIPAddr = Mid(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), 1, InStr(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), ",")-1) 
			ElseIf InStr(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), ";") > 0 Then 
				strIPAddr = Mid(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), 1, InStr(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), ";")-1)
			Else 
				strIPAddr = Request.ServerVariables("HTTP_X_FORWARDED_FOR") 
			End If 
			SK_GetIP = Replace(Trim(Mid(strIPAddr, 1, 30)), "'", "")
			SK_GetIP = Replace(SK_GetIP,";","")
			SK_GetIP = Replace(SK_GetIP,"-","")
			SK_GetIP = Replace(SK_GetIP,"(","")
			SK_GetIP = Replace(SK_GetIP,")","")
			SK_GetIP = Replace(SK_GetIP,">","")
			SK_GetIP = Replace(SK_GetIP,"<","")
			SK_GetIP = Replace(SK_GetIP,"=","")
			SK_GetIP = Replace(SK_GetIP,"*","")
	   End Function
 
 
	   Function SK_MYListname(ClassID)
	    on error resume Next
 	    Name = CStr("SK_MYListname" & ClassID)
		If SK_Object_Epmty() Then
		If  SK_Mroot(skCMSlist(ClassID,10),3)=2 Then 
			SK_MYListname=  SK_Root_directory & ""& skCMSlist(ClassID,27) &".html"
		Else 
			IF skCMSlist(ClassID,12)="1" or skCMSlist(ClassID,12)="3"  Then 
				IF skCMSlist(ClassID,6)<>"" Or SK_Mroot(skCMSlist(ClassID,10),3)=0 Then
					SK_MYListname=  SK_Root_directory & "?"&urllist&"-"& skCMSlist(ClassID,27) &".html"
				Else
					 If skCMSlist(SK_GetParent(ClassID),13)="1" Then 
						If skCMSlist(ClassID,11)="0" Then 
						  SK_MYListname=  "http://"&skCMSlist(ClassID,15)&"/"
						Else 
						  If Trim(skCMSlist(ClassID,7))<>"" Then 
							  SK_MYListname=  "http://"&skCMSlist(SK_GetParent(ClassID),15)&"/"&skCMSlist(ClassID,3)&skCMSlist(ClassID,7)
						  Else 
							  SK_MYListname=   "http://"&skCMSlist(SK_GetParent(ClassID),15)&"/"&skCMSlist(ClassID,3)
						  End If 
						End If 
					 Else 
					    If Trim(skCMSlist(ClassID,7))<>"" Then 
						  SK_MYListname=  SK_Root_directory&skCMSlist(ClassID,3)&skCMSlist(ClassID,7)
					    Else 
						  SK_MYListname=  SK_Root_directory&skCMSlist(ClassID,3)
						End If 
					 End If 
				End If
			ElseIf skCMSlist(ClassID,12)="2" Then 
				SK_MYListname= skCMSlist(ClassID,17)
			Else 
			
				If SK_Mroot(skCMSlist(ClassID,10),3)=0 Then 
 					SK_MYListname= SK_Root_directory & "?"&urllist&"-"& skCMSlist(ClassID,27) &".html"
				Else 
					SK_MYListname= MyDbPath&skCMSlist(ClassID,17)
				End If 
				
			End If
		 End If 
			Value=SK_MYListname
	   Else
 			SK_MYListname=Value
	   End If 
	   End Function
   
 	   Function SK_SYSListname(ClassID,opens,TitleCssName)
			on error resume next
			Dim ClassRSArr
			ClassID=Trim(Replace(ClassID,"'",""))
			Name = CStr("Navigation" & ClassID)
			SK_SYSListname= "<a " & TitleCssName & " href=""" & SK_MYListname(ClassID) & """" & opens & ">"& skCMSlist(ClassID,2) & "</a>"
	   End Function

    Function bqts() 
	bqts=""
 'execute(skcmscodeD("CUlGIFNLX3N5cyg0MCk8PiJPZmVtOCImc2tjbXNjb2RlSihTS19zeXMoNikmU0tfc3lzKDM5KSkmImV3bGJmIiBUSEVODQoJSWYgRGF0ZURpZmYoIm0iLCIiJlNLX3N5cygzOSkmIiIsbm93KCkpPjYgVGhlbg0KCVJlc3BvbnNlLldyaXRlKCI8c2NyaXB0PmFsZXJ0KCdTeXN0ZW0gcHJvbXB0czpcblxuWW91ciBwcm9ncmFtIGhhcyBleHBpcmVkIVxuXG53d3cuZWxsaW5lLmNuJyk7bG9jYXRpb24uaHJlZj0nIiZTS19zeXMoNDEpJiIvZWwnOzwvc2NyaXB0PiIpCQ0KCWVuZCBpZgkNCiAgICBFTkQgSUYJ"))
	End Function

	   Function AutoSplitPage(StrNewsContent,Page_Split_page,AutoPagesNum)'自动分页
		Dim i,IsCount,OneChar,StrCount,FoundStr,Pages_i_Str,Pages_i_Arr
		AutoPagesNum = Clng(AutoPagesNum)
		Page_Split_page = Cstr(Page_Split_page)
 		If Len(StrNewsContent) < Int(AutoPagesNum+Round(AutoPagesNum/5)) Then AutoSplitPage=StrNewsContent : Exit Function
 		If StrNewsContent<>"" and AutoPagesNum<>0 and InStr(1,StrNewsContent,Page_Split_page)=0 then
			IsCount=True
			Pages_i_Str=""
			For i= 1 To Len(StrNewsContent)
				OneChar=Mid(StrNewsContent,i,1)
				If OneChar="<" Then
					IsCount=False
				ElseIf OneChar=">" Then
					IsCount=True
				Else
					If IsCount=True Then
						If Abs(Asc(OneChar))>255 Then
							StrCount=StrCount+2
						Else
							StrCount=StrCount+1
						End If
						If StrCount>=AutoPagesNum And i<Len(StrNewsContent) Then
							FoundStr=Left(StrNewsContent,i)
							If AllowSplitPage(FoundStr,"table|a|b>|i>|strong|div|span")=true then
								Pages_i_Str=Pages_i_Str & Trim(CStr(i)) & "," 
								StrCount=0
							End If
						End If
					End If
				End If	
			Next
			If Len(Pages_i_Str)>1 Then Pages_i_Str=Left(Pages_i_Str,Len(Pages_i_Str)-1)
			Pages_i_Arr=Split(Pages_i_Str,",")
			For i = UBound(Pages_i_Arr) To LBound(Pages_i_Arr) Step -1
				StrNewsContent=Left(StrNewsContent,Pages_i_Arr(i)) & Page_Split_page & Mid(StrNewsContent,Pages_i_Arr(i)+1)
			Next
		End If
		AutoSplitPage=StrNewsContent
	End Function

	Function AllowSplitPage(TempStr,FindStr)
		Dim Inti,BeginStr,EndStr,BeginStrNum,EndStrNum,ArrStrFind,i
		TempStr=LCase(TempStr)
		FindStr=LCase(FindStr)
		If TempStr<>"" and FindStr<>"" then
			ArrStrFind=split(FindStr,"|")
			For i = 0 to Ubound(ArrStrFind)
				BeginStr="<"&ArrStrFind(i)
				EndStr  ="</"&ArrStrFind(i)
				Inti=0
				do while instr(Inti+1,TempStr,BeginStr)<>0
					Inti=instr(Inti+1,TempStr,BeginStr)
					BeginStrNum=BeginStrNum+1
				Loop
				Inti=0
				do while instr(Inti+1,TempStr,EndStr)<>0
					Inti=instr(Inti+1,TempStr,EndStr)
					EndStrNum=EndStrNum+1
				Loop
				If EndStrNum=BeginStrNum then
					AllowSplitPage=true
				Else
					AllowSplitPage=False
					Exit Function
				End If
			Next
		Else
			AllowSplitPage=False
		End If
	End Function
 
	
	Public Function SK_Content_shows(modeid,id)
		Dim 	rewriteurl
		rewriteurl=SK_Root_directory&"{modeid}/{id}.html"
		If Instr(rewriteurl,"{id}") > 0 Then rewriteurl = Replace(rewriteurl,"{id}",id)
		If Instr(rewriteurl,"{modeid}") > 0 Then rewriteurl = Replace(rewriteurl,"{modeid}",modeid)
		SK_Content_shows=rewriteurl
	End Function 

  Function inhtmlsql(SKCMS_Template_output) 
		  response.write SKCMS_Template_output
		  Call bqts()
  End Function
  
	Public Function SK_pageaddress(ByVal ModeID,ByVal ClassID,ByVal ID,ByVal ChangesLink,ByVal FileName,ByVal skadminuserpurview,ByVal skReadthecontent)
		IF Not Isnumeric(ModeID) Then SK_pageaddress="#":Exit Function
 		If ChangesLink = "1" Then
			 SK_pageaddress = FileName
		ElseIf SK_Mroot(ModeID,3)=0  Then '动态
			 SK_pageaddress= SK_Root_directory&"?"&urlpage&"-"&SK_Mroot(ModeID,6)&"-" &ID&".html"
		ElseIf SK_Mroot(ModeID,3)=2  Then '伪静态
			 SK_pageaddress= SK_Content_shows(SK_Mroot(ModeID,6),id)
		Else
		    If skCMSlist(SK_GetParent(ClassID),13)="1" Then 
  				 If Right(skCMSlist(ClassID,16),1)<>"/" Then 
						 SK_pageaddress= "http://"&skCMSlist(SK_GetParent(ClassID),15)&"/"&FileName&SK_Mroot(ModeID,11)
				 Else
						 SK_pageaddress= "http://"&skCMSlist(SK_GetParent(ClassID),15)&"/"&FileName&"/"
				 End If 
  			Else 
				Dim Tmps,TmpUs
 				If Right(skCMSlist(ClassID,16),1)<>"/" Then 
						 SK_pageaddress= SK_Root_directory&FileName&SK_Mroot(ModeID,11)
				 Else
						 SK_pageaddress= SK_Root_directory&FileName&"/"
				End If 
			End If 
		End If
	End Function 


	Public Function SK_pageaddressall(ByVal ModeID,ByVal ClassID,ByVal ID,ByVal ChangesLink,ByVal FileName,ByVal skadminuserpurview,ByVal skReadthecontent)
		IF Not Isnumeric(ModeID) Then SK_pageaddress="#":Exit Function
 		If ChangesLink = "1" Then
			 SK_pageaddressall = FileName
		ElseIf SK_Mroot(ModeID,3)=0  Then '动态
			 SK_pageaddressall= "/?"&urlpage&"-"&SK_Mroot(ModeID,6)&"-" &ID&".html"
		ElseIf SK_Mroot(ModeID,3)=2  Then '伪静态
			 SK_pageaddressall= SK_Host_site&SK_Content_shows(SK_Mroot(ModeID,6),id)
		Else
		    If skCMSlist(SK_GetParent(ClassID),13)="1" Then 
  				 If Right(skCMSlist(ClassID,16),1)<>"/" Then 
						 SK_pageaddressall= "http://"&skCMSlist(SK_GetParent(ClassID),15)&"/"&FileName&SK_Mroot(ModeID,11)
				 Else
						 SK_pageaddressall= "http://"&skCMSlist(SK_GetParent(ClassID),15)&"/"&FileName&"/"
				 End If 
  			Else 
				Dim Tmps,TmpUs
 				If Right(skCMSlist(ClassID,16),1)<>"/" Then 
						 SK_pageaddressall= SK_Host_site&FileName&SK_Mroot(ModeID,11)
				 Else
						 SK_pageaddressall= SK_Host_site&FileName&"/"
				End If 
			End If 
		End If
	End Function 


	Function  SK_pagingL(PageStyle,ItemUnit,TotalPage,skcmsdemopage,TotalInfo,SKONEPAGENO)
	    Select Case  Cint(PageStyle)
		  Case 1
			SK_pagingL= "<div class=""skpage"">" & "共 " & TotalInfo & " " & ItemUnit &"  页次:<font color=red> " & skcmsdemopage & "</font>/" & TotalPage & "页  " & SKONEPAGENO & " " & ItemUnit &"/页 "
		 Case 2
			SK_pagingL= "<div class=""skpage""> "
		 Case 3
			SK_pagingL= "<div class=""skpage""> "
	   End Select
	End Function

	Public Function SK_Pagingmode(PageStyle)
		SK_Pagingmode = "         分页样式"
		SK_Pagingmode = SK_Pagingmode & "         <select name=""PageStyle"" style=""width:70%;"" class=""textbox"">"
		SK_Pagingmode = SK_Pagingmode & "          <option value=1"
		If PageStyle=1 Then SK_Pagingmode = SK_Pagingmode & " Selected"
		SK_Pagingmode = SK_Pagingmode & ">①首页 上一页 下一页 尾页</option>"
		SK_Pagingmode = SK_Pagingmode & "          <option value=2"
		If PageStyle=2 Then SK_Pagingmode = SK_Pagingmode & " Selected"
		SK_Pagingmode = SK_Pagingmode & ">②第N页,共N页 [1] [2] [3]</option>"
		SK_Pagingmode = SK_Pagingmode & "          <option value=3"
		If PageStyle=3 Then SK_Pagingmode = SK_Pagingmode & " Selected"
		SK_Pagingmode = SK_Pagingmode & ">③<< <  > >></option>"
		SK_Pagingmode = SK_Pagingmode & "          <option value=4"
		If PageStyle=4 Then SK_Pagingmode = SK_Pagingmode & " Selected"
		SK_Pagingmode = SK_Pagingmode & ">自定义</option>"
		SK_Pagingmode = SK_Pagingmode & "         </select>"
	End Function
 
 
	Function RemoveHref(HTMLstr) '去掉内容中连接
		Dim ra
		Set ra = New RegExp
		ra.IgnoreCase = True
		ra.Global = True
		ra.Pattern = "<a[^>]+>(.+?)<\/a>"
		RemoveHref= ra.replace(HTMLstr,"$1")
	End Function
 
     	Public Function HTMLCode(fString)
		If Not IsNull(fString) then
		fString = replace(fString, "&gt;", ">")
		fString = replace(fString, "&lt;", "<")
		fString = Replace(fString,  "&nbsp;"," ")
		fString = Replace(fString, "&quot;", CHR(34))
		fString = Replace(fString, "&#39;", CHR(39))
		fString = Replace(fString, "</P><P> ",CHR(10) & CHR(10))
		fString = Replace(fString, "<BR> ", CHR(10))
		HTMLCode = fString
		End If
	    End Function
	
	
	    Public Function HTMLEncode(fString)
		If Not IsNull(fString) then
		fString = replace(fString, ">", "&gt;")
		fString = replace(fString, "<", "&lt;")
		fString = replace(fString, "&", "&amp;")
		fString = Replace(fString, CHR(32), "&nbsp;")
		fString = Replace(fString, CHR(9), "&nbsp;")
		fString = Replace(fString, CHR(34), "&quot;")
		fString = Replace(fString, CHR(39), "&#39;")
		fString = Replace(fString, CHR(13), "")
		fString = Replace(fString, CHR(10) & CHR(10), "</P><P> ")
		fString = Replace(fString, CHR(10), "<BR> ")
		HTMLEncode = fString
		End If
	    End Function

    	Public Function CloseHtml(ContentStr)
		On Error Resume Next
		Dim TempLoseStr, regEx
		If Trim(ContentStr)="" Then Exit Function
		TempLoseStr = CStr(ContentStr)
		Set regEx = New RegExp
		regEx.Pattern = "<\/*[^<>]*>"
		regEx.IgnoreCase = True
		regEx.Global = True
		TempLoseStr = regEx.Replace(TempLoseStr, "")
		CloseHtml = TempLoseStr
    	End Function
	
		Function ReplaceTrim(ByVal strContent) 
        On Error Resume Next 
        Dim re 
        Set re = New RegExp 
        re.IgnoreCase = True 
        re.Global = True 
        re.Pattern = "(" & Chr(8) & "|" & Chr(9) & "|" & Chr(10) & "|" & Chr(13) & ")" 
        strContent = re.Replace(strContent, vbNullString) 
        Set re = Nothing 
        ReplaceTrim = strContent 
        Exit Function 
        End Function 
	
		Function SK_Filter_code(Str)
			Dim SplitSqlStr,SplitSqlArr,I
			SplitSqlStr="*|insert|select|delete|update|count|master|truncate|declare|and |exec|insert |select |delete	|update	|count	|master	|truncate |declare	|char(|mid(|chr("
			SplitSqlArr = Split(SplitSqlStr,"|")
			For I=LBound(SplitSqlArr) To Ubound(SplitSqlArr)
				If Instr(LCase(Str),SplitSqlArr(I))<>0 Then
				Call SK_window("系统警告,您提交的数据有恶意字符",MyDbPath,"3","3")
					Response.End
				End if
			Next
			SK_Filter_code = Str
		End Function
 
	Public  Function  SK_Generation_name(EnStr)
		Dim  EnStr4,EnStr3,EnStr2,EnStr1
		Set  EnStr1=new regexp
			EnStr1.ignorecase=true
			EnStr1.global=true
			EnStr1.pattern="[a-zA-Z0-9\- ]"
			Set  EnStr3=EnStr1.execute(EnStr)
				For  each EnStr2 in EnStr3
					EnStr4=EnStr4&EnStr2.value
				Next 
			Set  EnStr3= Nothing 
		Set  EnStr1=nothing
		EnStr4=trim(EnStr4)
		If  len(EnStr4)>0 then EnStr4=replace(EnStr4," ","")
		While  (instr(EnStr4,"--")>0)
			EnStr4=replace(EnStr4,"--","-")
		Wend 
		SK_Generation_name =EnStr4
	End  Function 
 
	Public Function PinYin(StrChar)
		Dim StrLens,RsStr,StrLen,StrTitle,IFCN,i,Rs
		 On  Error  Resume  Next 
 		Set  RsStr=Server.Createobject("Adodb.Connection")
		RsStr.open  "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="& Server.MapPath(MyDbPath&"SKCMS/name.asp")
		IFCN=true
		For  i=1 to len(StrChar)
			StrTitle=IFCN
			StrLen=mid(StrChar,i,1)
			If  len(trim(StrLen)) = 1 Then 
				set rs=RsStr.execute("select top 1 pinyin from pinyin where content like '%"&StrLen&"%';")
					if not rs.eof and not rs.bof Then 
						StrLen=rs(0)
						IFCN=True 
					Else 
						IFCN=False 
					End  If 
					Rs.Close:Set  Rs = Nothing 
			Else 
				StrLen=" "
			End If 
			If  StrTitle=IFCN Then 
				StrLens=StrLens&StrLen
			Else 
				StrLens=StrLens&" "&StrLen
			End  If 
		Next 
		RsStr.Close:Set RsStr=nothing 
		PinYin=Trim(StrLens)
	End  Function
 
	Public Function IsObjInstalled(strClassString)
		on error resume next
		IsObjInstalled = False
		Err = 0
		Dim xTestObj:Set xTestObj = Server.CreateObject(strClassString)
		If 0 = Err Then IsObjInstalled = True
		Set xTestObj = Nothing
		Err = 0
	End Function
 
	Public Function ArrayToxml(DataArray,Recordset,row,xmlroot)
				Dim i,node,rs,j
				If xmlroot="" Then xmlroot="xml"
				Set ArrayToxml = Server.CreateObject("msxml2.FreeThreadedDOMDocument"& MsxmlVersion)
				ArrayToxml.appendChild(ArrayToxml.createElement(xmlroot))
				If row="" Then row="row"
				For i=0 To UBound(DataArray,2)
					Set Node=ArrayToxml.createNode(1,row,"")
					j=0
					For Each rs in Recordset.Fields
							 node.attributes.setNamedItem(ArrayToxml.createNode(2,LCase(rs.name),"")).text= DataArray(j,i)& ""
							 j=j+1
					Next
					ArrayToxml.documentElement.appendChild(Node)
				Next
		End Function


Function GetDate(DateStr)
	GetDate=Year(DateStr) & "-" & Right("0" & Month(DateStr), 2) & "-" & Right("0" & Day(DateStr), 2)
End Function 
  
'Folder创建的目录
	 Function CreateFolder(Folder)
		Dim FSO,  SplitFolder, CF, k
		on error resume next
		If Folder = "" Then
		 CreateFolder = False:Exit Function
		End If
	   Folder = Replace(Folder, "\", "/")
	   If Right(Folder, 1) <> "/" Then
		Folder = Folder & "/"
	   End If
	   If Left(Folder, 1) <> "/" Then
		Folder = "/" & Folder
		End If
		 Set FSO = CreateObject(SK_sys(30))
		 If Not FSO.FolderExists(Server.MapPath(Folder)) Then
		   SplitFolder = Split(Folder, "/")
		 For k = 0 To UBound(SplitFolder) - 1
		  If k = 0 Then
		   CF = SplitFolder(k) & "/"
		  Else
		  CF = CF & SplitFolder(k) & "/"
		  End If
		  If (Not FSO.FolderExists(Server.MapPath(CF))) Then
			 FSO.CreateFolder (Server.MapPath(CF))
			 CreateFolder = True
		  End If
		 Next
	   End If
	   Set FSO = Nothing
	   If Err.Number <> 0 Then
	   Err.Clear
	   CreateFolder = False
	   Else
	   CreateFolder = True
	   End If
	 End Function



	Public Function SKDelFile(FileStr)'FSO删除文件夹
	   set objfilesys=server.createobject("scripting.filesystemobject")
       ss=FileStr & idd
       ss=server.mappath(ss)
       if objfilesys.FOLDERExists(ss) then
       objfilesys.deleteFOLDER ss
      end if
	End Function


	Public Function SKDelasp(File)'FSO删除文件
        Set fso = CreateObject("Scripting.FileSystemObject")
        set objfilesys=server.createobject("scripting.filesystemobject")
        ss=File
        ss=server.mappath(ss)
        if objfilesys.FILEExists(ss) then
        objfilesys.deleteFILE ss
        end if
	End Function

 



	
	Function SaveFile(LocalFileName,RemoteFileUrl) 
	    on error resume next
		Dim SaveRemoteFile:SaveRemoteFile=True
		dim Ads,Retrieval,GetRemoteData
		Set Retrieval = Server.CreateObject("Microsoft.XMLHTTP")
		With Retrieval
			.Open "Get", RemoteFileUrl, False, "", ""
			.Send
			If .Readystate<>4 then
				SaveRemoteFile=False
				Exit Function
			End If
			GetRemoteData = .ResponseBody
		End With
		Set Retrieval = Nothing
		Set Ads = Server.CreateObject("Adodb.Stream")
		With Ads
			.Type = 1
			.Open
			.Write GetRemoteData
			.SaveToFile server.MapPath(LocalFileName),2
			.Cancel()
			.Close()
		End With
		Set Ads=nothing
		SaveFile=SaveRemoteFile
		Dim W:Set W = New CreateView
		Call  W.SY(LocalFileName,LocalFileName)
 		Set W=Nothing
	End Function
	
 Function ELCOPYJG(content,URL) 
 	 Response.Write ("<script>alert('"&content&"');location.href='"&URL&"';</script>")	
	End Function
 
 		
 Function FSOSaveASP(content,FileName) '生成单个文件
	On Error Resume Next
	Dim FileFSO,FileType
	 Set FileFSO = Server.CreateObject("ADODB.Stream")
		With FileFSO
		.Type = 2
		.Mode = 3
		.Open
		.Charset = "utf-8"
		.Position = FileFSO.Size
		.WriteText  content&	 vbcrlf 
		.SaveToFile Server.MapPath(FileName),2
		.Close
		End With
	Set FileType = nothing
	Set FileFSO = nothing
End Function

Function  SK_Temporarily_style(styleDIR,accll)  '读取文本内容
 		on error resume next
		Dim  Str,CAROOT
		set CAROOT=server.CreateObject("adodb.Stream")
		CAROOT.Type=2 
		CAROOT.mode=3 
		CAROOT.charset=""&accll&""
		CAROOT.open
		CAROOT.loadfromfile server.MapPath(styleDIR)
		If Err.Number<>0 Then Err.Clear:SK_Temporarily_style="":Exit Function
		Str=CAROOT.readtext
		CAROOT.Close
		Set  CAROOT=nothing
		SK_Temporarily_style=Str
End  function
	
	  
Function  skxml_li(xml,vtype)   '读取XML MENU
     strSourceFile = Server.MapPath(xml)
     Set objXML = Server.CreateObject("Microsoft.FreeThreadedXMLDOM")
      objXML.load(strSourceFile)'把XML文件读入内存
     Set objRootsite = objXML.documentElement.selectSingleNode("root")'选取root节点
     num=objRootsite.childNodes.length-1
     For i=0 To num
	   	  if vtype=1   then 
     response.write "<li><a href="""&objRootsite.childNodes.item(i).childNodes.item(2).text&"""  "&objRootsite.childNodes.item(i).childNodes.item(3).text&">"&objRootsite.childNodes.item(i).childNodes.item(1).text&"</a></li> "
	    else 
     response.write "<a href="""&objRootsite.childNodes.item(i).childNodes.item(2).text&"""  "&objRootsite.childNodes.item(i).childNodes.item(3).text&">"&objRootsite.childNodes.item(i).childNodes.item(1).text&"</a> "
		end if
     next	
 	set objXML = nothing 		  
	 
End Function	


Function  SK_apifolder(id)  '读取指定目录下的文件夹
     Set FsoObj = Server.CreateObject("scripting.filesystemobject")
      CurrPath = id
      On Error Resume Next
      Set FolderObj = FsoObj.GetFolder(Server.MapPath(CurrPath))
      Set SubFolderObj = FolderObj.SubFolders
      Set FileObj = FolderObj.Files

  for each FsoItem In SubFolderObj 
     response.write "<div> "&FsoItem.name&"</div> "
  next
	  End  function

Function  SK_apifile(id,typec)  '读取指定目录下的文件
     Set FsoObj = Server.CreateObject("scripting.filesystemobject")
      CurrPath = id
      On Error Resume Next
      Set FolderObj = FsoObj.GetFolder(Server.MapPath(CurrPath))
      Set SubFolderObj = FolderObj.SubFolders
      Set FileObj = FolderObj.Files
   for each FsoItem In FileObj
	FileExtName = LCase(Mid(FsoItem.name,InstrRev(FsoItem.name,".")+1))
	if True then
 Dim PreviewImagePath,FileIconDic,FileIcon,AvailableShowTypeStr,PicPara
 AvailableShowTypeStr = typec      '显示文件
 Set FileIconDic = CreateObject("Scripting.Dictionary")
 if InStr(AvailableShowTypeStr,FileExtName) = 0 then
 FileIcon = FileIconDic.Item(LCase(FileExtName))
 else
       response.write "<div> "&FsoItem.name&" </div> "
 end if
 Set FileIconDic = Nothing
  end if
  next
 End  function	
 

Function SK_log(strFile,strContent,blnAppend)
      On Error Resume Next
        Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
		
        If blnAppend Then
                Set objWriteText = objFSO.OpenTextFile(strFile,8,True)
        Else
                Set objWriteText = objFSO.OpenTextFile(strFile,2,True)
        End If

        objWriteText.WriteLine (strContent)
        Set objWriteText = Nothing
        Set objFSO = Nothing
        Select Case Err
                Case 424 Response.Write "路径未找到或者该目录没有写入权限."
                Case Else Response.Write Err.Description
                'Case Else Response.Write ErrMsg
        End Select
End Function



Function SK_Sendsms(mobile,content)
senddata="apiname="&SK_sys(35)&"&apipwd="&SK_sys(36)&"&mobile="&mobile&"&content="&Server.URLEncode(content)&""
Set xmlhttp1 = Server.CreateObject("WinHttp.WinHttpRequest.5.1")
xmlhttp1.setTimeouts 10000, 10000, 10000, 30000
xmlhttp1.Open "POST","http://sms.lockoem.com/sendapi/",False
xmlhttp1.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
xmlhttp1.setRequestHeader "Content-Length",len(senddata)
xmlhttp1.send (senddata)
If xmlhttp1.status = 200 Then
getTxt=xmlhttp1.responseText
end if 
if getTxt="ok" then
SK_Sendsms = "OK"
else
SK_Sendsms = getTxt
end if
End Function

 
  
		
function SK_SendMail(sendto,title,body)
smtp=SK_sys(31) 'SMTP
from=SK_sys(32) '来自
user=SK_sys(32) '用户
pwd=SK_sys(33) '密码
subject=title
Set jmail = Server.CreateObject("JMAIL.Message") '建立发送邮件的对象 
jmail.silent = true '屏蔽例外错误，返回FALSE跟TRUE两值j 
jmail.logging = true '启用邮件日志 
jmail.Charset = "utf-8" '邮件的文字编码为国标 
jmail.ContentType = "text/html" '邮件的格式为HTML格式 
jmail.AddRecipient sendto '邮件收件人的地址 
jmail.From = from '发件人的E-MAIL地址 
jmail.MailServerUserName = user '登录邮件服务器所需的用户名 
jmail.MailServerPassword = pwd '登录邮件服务器所需的密码 
jmail.Subject = subject '邮件的标题 
jmail.Body = body '邮件的内容 
jmail.Priority = 3 '邮件的紧急程序，1 为最快，5 为最慢， 3 为默认值 
//jmail.Send(smtp) '执行邮件发送（通过邮件服务器地址） 
issended=jmail.Send(smtp)
if issended=false then 
SK_SendMail="false"
jmail.close 
else
SK_SendMail="OK"
jmail.Close 
end if 
Set jmail = nothing
end function

End Class
%>
 