123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414 |
- <%@LANGUAGE="VBScript" CODEPAGE="65001"%>
- <%
- Session.CodePage=65001
- Response.Charset="utf-8"
- Response.Expires=-1
- %>
- <!--#include file="system/Md5.asp"-->
- <%
- Dim Conn
- Set Conn=Server.CreateObject("ADODB.Connection")
- Conn.Open "PROVIDER=SQLOLEDB;server=127.0.0.1,1435;uid=crm;pwd=Qweasdzxc;database=crm"
- Function Checklogin()
- if Session("employee_id")="" Then Response.Write "<script>top.location.href='index.php'</script>":Response.End
- End Function
- Function GetIp
- GetIp=Request.ServerVariables("HTTP_X_FORWARDED_FOR")
- IF GetIp="" Then GetIp=Request.ServerVariables("REMOTE_ADDR")
- IF Len(GetIp)>15 Then GetIp="UnKnow"
- GetIp=HTMLEncode(GetIp)
- End Function
- Function RemoveHTML(ByVal t0)
- IF Len(t0)=0 Or IsNull(t0) Then
- Removehtml=""
- Exit Function
- End IF
- Dim Regs,Matches,Match
- Set Regs=New Regexp
- Regs.Ignorecase=True
- Regs.Global=True
- '过滤掉JS,Iframe
- Regs.pattern ="<script.+?/script>"
- t0=Regs.Replace(t0,"")
- Regs.pattern ="<iframe.+?/iframe>"
- t0=Regs.Replace(t0,"")
- '再过滤其他
- t0=Replace(t0,"<","<")
- t0=Replace(t0,">",">")
- Regs.Pattern="<.+?>"
- Set Matches=Regs.Execute(t0)
- For Each Match In Matches
- t0=Replace(t0,Match.value,"")
- Next
- t0=Replace(t0," ","")
- t0=Replace(t0,vbCrLf,"")
- 't0=Replace(t0," ","")
- 't0=Replace(t0," ","")
- t0=Replace(t0,CHR(9),"")
- t0=Replace(t0,CHR(13),"")
- t0=Replace(t0,CHR(10),"")
- t0=Replace(t0,CHR(22),"")
- Set Regs=Nothing
- Removehtml=t0
- End Function
- Function Txt2HTML(ByVal t0)
- IF IsNull(t0) Or Len(t0)<0 Or IsArray(t0) Then Exit Function
- t0=Replace(t0,"&","&")
- t0=Replace(t0,"""",""")
- t0=Replace(t0,"<","<")
- t0=Replace(t0,">",">")
- t0=Replace(t0," "," ")
- Txt2HTML = t0
- End Function
- Function HTML2Txt(ByVal t0)
- IF IsNull(t0) Or Len(t0)<0 Or IsArray(t0) Then Exit Function
- t0=Replace(t0,""","""")
- t0=Replace(t0,"<","<")
- t0=Replace(t0,">",">")
- t0=Replace(t0," "," ")
- t0=Replace(t0,"&","&")
- HTML2Txt = t0
- End Function
- Function HTMLEnCode(ByVal t0)
- IF IsNull(t0) Or Len(t0)<0 Or IsArray(t0) Then Exit Function
- t0=Replace(t0,CHR(38),"&") '“&” 这个在第一防止重复替换下面的内容
- t0=Replace(t0,CHR(9),"	") '“tab(水平制表符)”
- t0=Replace(t0,CHR(11),"") '“tab(垂直制表符) ”
- t0=Replace(t0,CHR(10)," ") '“换行”
- t0=Replace(t0,CHR(13)," ") '“回车”
- t0=Replace(t0,CHR(32)," ") '“ ”
- t0=Replace(t0,CHR(34),""") '“"”
- t0=Replace(t0,CHR(37),"%") '“%”
- t0=Replace(t0,CHR(39),"'") '“'”
- t0=Replace(t0,CHR(40),"(") '“(”
- t0=Replace(t0,CHR(41),")") '“)”
- t0=Replace(t0,CHR(60),"<") '“<”
- t0=Replace(t0,CHR(62),">") '“>”
- t0=Replace(t0,CHR(91),"[") '“[”
- t0=Replace(t0,CHR(93),"]") '“]”
- t0=Replace(t0,CHR(94),"^") '“^”
- t0=Replace(t0,CHR(95),"_") '“_”
- t0=Replace(t0,CHR(123),"{") '“{”
- t0=Replace(t0,CHR(124),"|") '“|”
- t0=Replace(t0,CHR(125),"}") '“}”
- HTMLEnCode=t0
- End Function
- Function HTMLUnCode(ByVal t0)
- IF IsNull(t0) Or Len(t0)<0 Or IsArray(t0) Then Exit Function
- t0=Replace(t0,"	",CHR(9)) '“tab(水平制表符)”
- t0=Replace(t0,"",CHR(11)) '“tab(垂直制表符) ”
- t0=Replace(t0," ",CHR(10)) '“换行”
- t0=Replace(t0," ",CHR(13)) '“回车”
- t0=Replace(t0," ",CHR(32)) '“ ”
- t0=Replace(t0,""",CHR(34)) '“"”
- t0=Replace(t0,"%",CHR(37)) '“%”
- t0=Replace(t0,"'",CHR(39)) '“'”
- t0=Replace(t0,"(",CHR(40)) '“(”
- t0=Replace(t0,")",CHR(41)) '“)”
- t0=Replace(t0,"<",CHR(60)) '“<”
- t0=Replace(t0,">",CHR(62)) '“>”
- t0=Replace(t0,"[",CHR(91)) '“[”
- t0=Replace(t0,"]",CHR(93)) '“]”
- t0=Replace(t0,"^",CHR(94)) '“^”
- t0=Replace(t0,"_",CHR(95)) '“_”
- t0=Replace(t0,"{",CHR(123)) '“{”
- t0=Replace(t0,"|",CHR(124)) '“|”
- t0=Replace(t0,"}",CHR(125)) '“}”
- t0=Replace(t0,"&",CHR(38)) '“&”
- HTMLUnCode=t0
- End Function
- Function TextEncode(ByVal t0)
- IF IsNull(t0) Or Len(t0)<0 Or IsArray(t0) Then Exit Function
- t0=Trim(t0)
- t0=Replace(t0,CHR(8),"") '“回格”
- t0=Replace(t0,CHR(9),"") '“tab(水平制表符)”
- t0=Replace(t0,CHR(11),"") '“tab(垂直制表符) ”
- t0=Replace(t0,CHR(12),"") '“换页”
- t0=Replace(t0,CHR(10),"") '“换行”
- t0=Replace(t0,CHR(13),"") '“回车”
- t0=Replace(t0,CHR(38),"&") '“&”
- t0=Replace(t0,CHR(47),"/") '“/”
- t0=Replace(t0,CHR(32)," ") '“ ”
- t0=Replace(t0,CHR(34),""") '“"”
- t0=Replace(t0,CHR(37),"%") '“%”
- t0=Replace(t0,CHR(39),"'") '“'”
- t0=Replace(t0,CHR(40),"(") '“(”
- t0=Replace(t0,CHR(41),")") '“)”
- t0=Replace(t0,"(","(") '“(”
- t0=Replace(t0,")",")") '“)”
- t0=Replace(t0,CHR(60),"<") '“<”
- t0=Replace(t0,CHR(62),">") '“>”
- t0=Replace(t0,CHR(91),"[") '“[”
- t0=Replace(t0,CHR(93),"]") '“]”
- t0=Replace(t0,CHR(94),"^") '“^”
- t0=Replace(t0,CHR(95),"_") '“_”
- t0=Replace(t0,CHR(123),"{") '“{”
- t0=Replace(t0,CHR(124),"|") '“|”
- t0=Replace(t0,CHR(125),"}") '“}”
- TextEncode=t0
- End Function
- Function NumFormat(ByVal t0)
- IF IsNull(t0) Or Len(t0)<0 Or IsArray(t0) Then Exit Function
- t0=Trim(t0)
- t0=Replace(t0,"-","") '“-”
- t0=Replace(t0,"+","") '“+”
- t0=Replace(t0," ","") '“ ”
- t0=Replace(t0,"&","") '“&”
- t0=Replace(t0," ","") '“空格”
- t0=Replace(t0,CHR(34),"") '”
- t0=Replace(t0,"*","") '“%”
- t0=Replace(t0,"%","") '“%”
- t0=Replace(t0,"'","") '“'”
- t0=Replace(t0,"(","") '“(”
- t0=Replace(t0,")","") '“)”
- t0=Replace(t0,"<","") '“<”
- t0=Replace(t0,">","") '“>”
- t0=Replace(t0,"[","") '“[”
- t0=Replace(t0,"]","") '“]”
- t0=Replace(t0,"^","") '“^”
- t0=Replace(t0,"_","") '“_”
- t0=Replace(t0,"{","") '“{”
- t0=Replace(t0,"\","") '“\”
- t0=Replace(t0,"/","") '“/”
- t0=Replace(t0,"|","") '“|”
- t0=Replace(t0,"}","") '“}”
- t0=Replace(t0,"(","") '“|”
- t0=Replace(t0,")","") '“}”
- NumFormat=t0
- End Function
- Function TextUncode(ByVal t0)
- IF IsNull(t0) Or Len(t0)<0 Or IsArray(t0) Then Exit Function
- t0=Replace(t0," ",CHR(32)) '“ ”
- t0=Replace(t0,""",CHR(34)) '“"”
- t0=Replace(t0,"%",CHR(37)) '“%”
- t0=Replace(t0,"'",CHR(39)) '“'”
- t0=Replace(t0,"(",CHR(40)) '“(”
- t0=Replace(t0,")",CHR(41)) '“)”
- t0=Replace(t0,"<",CHR(60)) '“<”
- t0=Replace(t0,">",CHR(62)) '“>”
- t0=Replace(t0,"[",CHR(91)) '“[”
- t0=Replace(t0,"]",CHR(93)) '“]”
- t0=Replace(t0,"^",CHR(94)) '“^”
- t0=Replace(t0,"_",CHR(95)) '“_”
- t0=Replace(t0,"{",CHR(123)) '“{”
- t0=Replace(t0,"|",CHR(124)) '“|”
- t0=Replace(t0,"}",CHR(125)) '“}”
- t0=Replace(t0,"/",CHR(47)) '“/”
- t0=Replace(t0,"&",CHR(38)) '“&”
- TextUncode=t0
- End Function
- Function HTMLUnCode1(ByVal t0)
- IF IsNull(t0) Or Len(t0)<0 Or IsArray(t0) Then Exit Function
- t0=Replace(t0,"	",CHR(9)) '“tab(水平制表符)”
- t0=Replace(t0,"",CHR(11)) '“tab(垂直制表符) ”
- t0=Replace(t0," ","<br />") '“换行”
- t0=Replace(t0," ","<br />") '“换行”
- t0=Replace(t0," ","<br />") '“回车”
- t0=Replace(t0," "," ") '“ ”
- t0=Replace(t0,"&",CHR(38)) '“&”
- HTMLUnCode1=t0
- End Function
- Function FormatTime(ttime,tparam)
- If Not IsDate(ttime) Then Exit Function
- tsrt = tparam
- tsrt = Replace(tsrt,"yyyy",Year(ttime))
- tsrt = Replace(tsrt,"yy",Right(Year(ttime),2))
- tsrt = Replace(tsrt,"mm",Right("0"&Month(ttime),2))
- tsrt = Replace(tsrt,"dd",Right("0"&Day(ttime),2))
- tsrt = Replace(tsrt,"hh",Right("0"&Hour(ttime),2))
- tsrt = Replace(tsrt,"ff",Right("0"&Minute(ttime),2))
- tsrt = Replace(tsrt,"ss",Right("0"&Second(ttime),2))
- tsrt = Replace(tsrt,"m",Month(ttime))
- tsrt = Replace(tsrt,"d",Day(ttime))
- tsrt = Replace(tsrt,"h",Hour(ttime))
- tsrt = Replace(tsrt,"f",Minute(ttime))
- tsrt = Replace(tsrt,"s",Second(ttime))
- FormatTime = tsrt
- End Function
- Function EnMonth(m)
- Select case m
- Case "1"
- m="Jan"
- Case "2"
- m="Feb"
- Case "3"
- m="Mar"
- Case "4"
- m="Apr"
- Case "5"
- m="May"
- Case "6"
- m="Jun"
- Case "7"
- m="Jul"
- Case "8"
- m="Aug"
- Case "9"
- m="Sep"
- Case "10"
- m="Oct"
- Case "11"
- m="Nov"
- Case ELSE
- m="Dec"
- End Select
- EnMonth=m
- End Function
- Function StrLeft(Str, StrLen)
- Dim L, T, I, C
- If Str = "" Then
- StrLeft = ""
- Exit Function
- End If
- L = Len(Str)
- T = 0
- For i = 1 To L
- C = Abs(AscW(Mid(Str, i, 1)))
- If C>255 Then
- T = T + 2
- Else
- T = T + 1
- End If
- If T> StrLen Then
- StrLeft = Left(Str, i) & ".."
- Exit For
- Else
- StrLeft = Str
- End If
- Next
- End Function
- Function StrLen(Str)
- If Str = "" Or IsNull(Str) Then
- StrLen = 0
- Exit Function
- Else
- Dim regex
- Set regex = New regexp
- regEx.Pattern = "[^\x00-\xff]"
- regex.Global = True
- Str = regEx.Replace(Str, "^^")
- Set regex = Nothing
- StrLen = Len(Str)
- End If
- End Function
- Function IsValidEmail(email)
- dim names, name, i, c
- 'Check for valid syntax in an email address.
- IsValidEmail = true
- names = Split(email, "@")
- If UBound(names) <> 1 then
- IsValidEmail = false
- exit Function
- end If
- for each name in names
- If Len(name) <= 0 then
- IsValidEmail = false
- exit Function
- end If
- for i = 1 to Len(name)
- c = Lcase(Mid(name, i, 1))
- If InStr("abcdefghijklmnopqrstuvwxyz_-.", c) <= 0 and not IsNumeric(c) then
- IsValidEmail = false
- exit Function
- end If
- next
- If Left(name, 1) = "." or Right(name, 1) = "." then
- IsValidEmail = false
- exit Function
- end If
- next
- If InStr(names(1), ".") <= 0 then
- IsValidEmail = false
- exit Function
- end If
- i = Len(names(1)) - InStrRev(names(1), ".")
- If i <> 2 and i <> 3 then
- IsValidEmail = false
- exit Function
- end If
- If InStr(email, "..") > 0 then
- IsValidEmail = false
- end If
- end Function
- 't0 内容,t1将什么,t2,替换成什么,t3替换的次数
- function sitelink_replace(byval t0,byval t1,byval t2,byval t3)
- If t0="" Or IsNull(t0) Then Exit Function
- dim t4:t4=t0
- reg.pattern="(\<a[^<>]+\>.+?\<\/a\>)|(\<img[^<>]+\>)|(\<h[1-6]+[\s]*\>.+?\<\/h[1-6]+\>)"
- set matches=reg.execute(t4)
- dim i:i=0
- dim myarray()
- if matches.count>0 then
- for each match in matches
- redim preserve myarray(i)
- myarray(i)=mid(match.value,1,len(match.value))
- t4=replace(t4,match.value,"["&i&"]",1,t3)
- i=i+1
- next
- end if
- if i=0 Then
- t0=replace(t0,t1,t2,1,t3)
- sitelink_replace=t0
- 'Set reg=Nothing
- exit function
- end if
- t4=replace(t4,t1,t2,1,t3)
- for i=0 to ubound(myarray)
- t4=replace(t4,"["&i&"]",myarray(i),1,t3)
- next
- sitelink_replace=t4
- end function
- %>
-
|