<%
Response.Buffer = True
Dim Startime
Dim Conn,ConnStr
ConnStr = "DRIVER={SQL Server};Server=192.168.10.118;Database=sun0769;UID=sun0769;PWD=aabbccdd123;"
'Startime = Timer()
'打开数据库连接--------------------------------------------------------
Sub OpenConnection
On Error Resume Next
Set conn = Server.CreateObject("ADODB.Connection")
conn.open ConnStr
If Err Then
err.Clear
Set Conn = Nothing
Response.Write "数据库维护中,请稍后访问。客服电话:(0769)22481988 转分机 750 或 788"
Response.End
End If
End Sub
'关闭数据库连接--------------------------------------------------------
Sub CloseConnection
If IsObject(Conn) Then Conn.Close : Set Conn = Nothing
End Sub
'BadRequest 写入数据库-------
Function LogBadRequest(strMethod,strPra)
Set rs = Server.CreateObject("ADODB.Recordset")
OpenConnection
strSql="select * from SunBadRequest"
rs.open strSql,conn,2,2
rs.addnew
rs("IP")=Request.ServerVariables("REMOTE_ADDR")
rs("url")=Request.ServerVariables("URL")
rs("rmethod")=strMethod
rs("pra")=strPra
rs("pvalue")=Request(strPra)
rs("dat_Time")=now()
rs.update
rs.close
set rs=nothing
CloseConnection
End Function
'--------定义部份------------------
Dim strBadWord,arrBadWord,iRequest,itemRequest
'自定义需要过滤的字串,用 "|" 分隔
'******************edit by 赖春江 2007-9-7 10:35 阳光热线管理后台action字段存在相关字符*************
strBadWord = "and|exec|insert|select|delete|create|drop|update|master|truncate|declare|xp_|sysobjects"
'strBadWord = "select|and|exec|insert|delete|create|drop|update|count|master|truncate|declare|xp_"
'*******************end ****************************
arrBadWord = split(strBadWord,"|")
'--------POST部份------------------
If Request.Form<>"" Then
For Each itemRequest In Request.Form
For iRequest=0 To Ubound(arrBadWord)
If Instr(LCase(Request.Form(itemRequest)),arrBadWord(iRequest))<>0 Then
Call LogBadRequest("post",itemRequest)
Response.Write "打开网页错误。"
'Response.Write "非法操作!系统做了如下记录↓ "
'Response.Write "操作IP:"&Request.ServerVariables("REMOTE_ADDR")&" "
'Response.Write "操作时间:"&Now&" "
'Response.Write "操作页面:"&Request.ServerVariables("URL")&" "
'Response.Write "提交方式:POST "
'Response.Write "提交参数:"&item&" "
'Response.Write "提交数据:"&Request.Form(item)&" "
Response.Write "如有其他疑问请给管理员留言:点击这里>>"
Response.End
End If
Next
Next
End If
'----------------------------------
'--------GET部份-------------------
If Request.QueryString<>"" Then
For Each itemRequest In Request.QueryString
For iRequest=0 To Ubound(arrBadWord)
If Instr(LCase(Request.QueryString(itemRequest)),arrBadWord(iRequest))<>0 Then
Call LogBadRequest("get",itemRequest)
Response.Write "打开网页错误。"
'Response.Write "非法操作!系统做了如下记录↓ "
'Response.Write "操作IP:"&Request.ServerVariables("REMOTE_ADDR")&" "
'Response.Write "操作时间:"&Now&" "
'Response.Write "操作页面:"&Request.ServerVariables("URL")&" "
'Response.Write "提交方式:GET "
'Response.Write "提交参数:"&item&" "
'Response.Write "提交数据:"&Request.QueryString(item)&" "
Response.Write "如有其他疑问请给管理员留言:点击这里>>"
Response.End
End If
Next
Next
End If
'----------------------------------
%>
<%
dim sitename,siteurl,siteemail,adminname,logourl,bannerurl
dim SMTPserver,EmailSuport,SiteTitle
Rem 过滤SQL非法字符
function checkStr(str)
if isnull(str) then
checkStr = ""
exit function
end if
checkStr=replace(str,"'","''")
end function
function getHtmlPath(folder,Ffile)
getHtmlPath="..\htmlContent\"&folder&"\"&Ffile
end function
Rem 判断数字是否整形
function isInteger(para)
on error resume next
dim str
dim l,i
if isNUll(para) then
isInteger=false
exit function
end if
str=cstr(para)
if trim(str)="" then
isInteger=false
exit function
end if
l=len(str)
for i=1 to l
if mid(str,i,1)>"9" or mid(str,i,1)<"0" then
isInteger=false
exit function
end if
next
isInteger=true
if err.number<>0 then err.clear
end function
sub showpage(sfilename,totalnumber,maxperpage,ShowTotal,ShowAllPages,strUnit)
dim n, i,strTemp,strUrl
if totalnumber mod maxperpage=0 then
n= totalnumber \ maxperpage
else
n= totalnumber \ maxperpage+1
end if
strTemp= "
"
if ShowTotal=true then
strTemp=strTemp & "共 " & totalnumber & " " & strUnit & " "
end if
strUrl=JoinChar(sfilename)
if CurrentPage<2 then
strTemp=strTemp & "首页 上一页 "
else
strTemp=strTemp & "首页 "
strTemp=strTemp & "上一页 "
end if
if n-currentpage<1 then
strTemp=strTemp & "下一页 尾页"
else
strTemp=strTemp & "下一页 "
strTemp=strTemp & "尾页"
end if
strTemp=strTemp & " 页次:" & CurrentPage & "/" & n & "页 "
'strTemp=strTemp & " " & maxperpage & "" & strUnit & "/页"
if ShowAllPages=True then
strTemp=strTemp & " 转到:"
end if
strTemp=strTemp & "
"
response.write strTemp
end sub
Rem 过滤HTML代码
function HTMLEncode(fString)
if not isnull(fString) then
fString = replace(fString, ">", ">")
fString = replace(fString, "<", "<")
fString = Replace(fString, CHR(32), " ")
fString = Replace(fString, CHR(9), " ")
fString = Replace(fString, CHR(34), """)
fString = Replace(fString, CHR(39), "'")
fString = Replace(fString, CHR(13), "")
fString = Replace(fString, CHR(10) & CHR(10), "
")
fString = Replace(fString, CHR(10), " ")
'fString=ChkBadWords(fString)
HTMLEncode = fString
else
HTMLEncode=fstring
end if
end function
Rem 过滤表单字符
function HTMLcode(fString)
if not isnull(fString) then
fString = Replace(fString, CHR(13), "")
fString = Replace(fString, CHR(10) & CHR(10), "
")
fString = Replace(fString, CHR(10), " ")
HTMLcode = fString
end if
end function
Function FilterHTML(strToFilter)
Dim strTemp
strTemp = strToFilter
While Instr(1,strTemp,"<") AND Instr(1, strTemp, ">")
strTemp = Left(strTemp, Instr(1, strTemp, "<")-1) & Right(strTemp, Len(strTemp)-Instr(1,strTemp, ">"))
WEnd
FilterHTML = strTemp
End Function
function JoinChar(strUrl)
if strUrl="" then
JoinChar=""
exit function
end if
if InStr(strUrl,"?")1 then
if InStr(strUrl,"&")alert('"&txt&"');"
if go<>1 then
response.write "history.go(-1);"
else
response.write "document.location.href='"&url&"';"
end if
response.write ""
response.end
end sub
'\\\\判断输入是否含有为中文
function getStr(str,i)
dim text
text=trim(str)
if len(str)>i then
text=mid(str,1,i)&"..."
end if
getStr=text
end function
function changechr(str)
changechr=replace(replace(replace(replace(str,"<","<"),">",">"),chr(13)," ")," "," ")
changechr=replace(replace(replace(replace(changechr,"[sayyes]",""),"[red]",""),"[big]","")
changechr=replace(replace(replace(replace(changechr,"[/sayyes]",">"),"[/b]",""),"[/red]",""),"[/big]","")
end function
function cnDate(datetime)
if datetime<>"" then
cnDate=cstr(year(datetime)) + "年" + cstr(month(datetime)) + "月" + cstr(day(datetime)) + "日"
else
cnDate="00-00-00"
end if
end function
function cnSmallDate(datetime)
if datetime<>"" then
cnSmallDate=cstr(month(datetime)) + "月" + cstr(day(datetime)) + "日"
else
cnSmallDate="00-00-00"
end if
end function
'------------------------------------------------------------------------------------
function divisor(tablename,column,max_height)
'取得设置投票结果柱状图最大高度的除法因数(divisor 整型),参数column为数据表中对应投票项的字段(字符型),max_height为要设置的最大高度(整型)
dim rs_div
set rs_div=server.CreateObject("adodb.recordset")
dim str
str="select max("&column&") from "&tablename
rs_div.open str,conn,3,2
divisor=rs_div(0)/max_height
if divisor=0 then divisor=1 end if
rs_div.close
set rs_div=nothing
end function
'检查字符是否为null值。NULL值时设为""
function CheckStrNull(str)
if str="" and str=null then
str=""
else
str=checkStr(trim(str))
end if
CheckStrNull=str
end function
function CheckNumNull(isNum)
if isNum="" and isNum=null then
call mb("Sorry! 没有此项类内","",2)
response.end
else
CheckNumNull=isNum
end if
end function
Function FormatName(FileExt)
Dim RanNum
Randomize
RanNum = Int(90000*rnd)+10000
FormatName = Year(now)&Month(now)&Day(now)&Hour(now)&Minute(now)&Second(now)&RanNum&"."&FileExt
End Function
'读出文件名不带扩搌
Function GetFormatName()
Dim RanNum
Randomize
RanNum = Int(90000*rnd)+10000
GetFormatName= Year(now)&Month(now)&Day(now)&Hour(now)&Minute(now)&Second(now)&RanNum
End Function
function getStrNum(str,num)
str=trim(str)
if len(str)>cint(num) then
str=left(str,cint(num)-2)&"..."
end if
getStrNum=str
end function
function GetStringContent(str,num)
str=trim(str)
str=replace(replace(str," ","")," ","")
if len(str)>cint(num) then
str=left(str,cint(num)-2)&"..."
end if
GetStringContent=str
end function
%>
<%
function getImage(str)
if str="" or isnull(str) or isempty(str) then
getImage="../images/Route01.jpg"
else
getImage="/upload/tour/hanxing/"&str
end if
end function
IF Not isObject(rs) Then
set rs=server.CreateObject("adodb.recordset")
End IF
IF Not isObject(conn) Then
openconnection
End IF
%>
<%
rs.open "select * from SunPhoto where publish_flag=1 and PhotoGroup_id=30 order by Photo_ID desc",conn,1,1
IF Not(rs.eof) Then
%>
<%
rs.open "select top 8 R.*,A.AgencyName from SunTourRoute as R,SunTourAgency as A where A.AgencyID=R.AgencyID and R.Publishflag=1 and R.VouchFlag=1 order by R.Addtime desc",conn,1,1
IF Not(rs.eof) Then
%>
<%
rs.open "select top 1 * from SunTourUpload where PublishFlag=1 and UploadType=1 and SmallPicFlag=1 order by Addtime desc",conn,1,1
IF Not(rs.eof) Then
%>
<%
End IF
rs.close
%>
<%
rs.open "select top 4 * from SunTourUpload where PublishFlag=1 and UploadType=1 and SmallPicFlag<>1 order by Addtime desc",conn,1,1
IF Not(rs.eof) Then
%>