<script language="JScript" runat="Server">function toObject(json){eval("var o=" + json);return o;}</script>
<% 
set rs=server.CreateObject("adodb.recordset")
set rssub=server.CreateObject("adodb.recordset")
Set conn = Server.CreateObject("ADODB.Connection")
connstr="Provider=SQLOLEDB.1; Persist Security Info=True; Connect Timeout=100; Data Source=" & Application("SqlDbHost") & "; Initial Catalog="&Application("SqlDbName")&"; User ID="&Application("SqlUserName")&"; Password=" & Application("SqlUserPass")
conn.Open connstr


'导航栏url整理
thisdaohangurl=Request.ServerVariables("URL")
thisdaohangurl=replace(thisdaohangurl,".asp"," ")
thisdaohangurl=replace(thisdaohangurl,"/user/"," ")
thisdaohangurl=trim(thisdaohangurl)	

'检测手机号是否正确 yes正确 no错误
function chktelisok(Mobile) 
chktelisok="yes"
if mid(Mobile,1,3)="170" or mid(Mobile,1,3)="171" or mid(Mobile,1,3)="145" or mid(Mobile,1,3)="146" or mid(Mobile,1,3)="147" then
chktelisok="no"
end if
if mid(Mobile,1,3)="167" or mid(Mobile,1,3)="162" or mid(Mobile,1,3)="165" then
chktelisok="no"
end if
end function

'获取IP
DulIp=Request.ServerVariables("HTTP_X_FORWARDED_FOR") 
ProIP=Request.ServerVariables("REMOTE_ADDR") 
If DulIp="" Then 
userinip=ProIP 
Else
userinip=DulIp 
End If 
ipstr=split(userinip,",")
if Ubound(ipstr)>0 then
userinip=trim(ipstr(0))
end if

'检测黑名单
if request.Cookies("iphei")="" then
	rssub.open "select top 1 ayipn from ayiph where ayipn='"&trim(userinip)&"'",conn,1,1
	if not(rssub.bof and rssub.eof) then
	response.Write("IP锁定-"&userinip)
	response.end
	end if
	rssub.close
	response.Cookies("iphei")=userinip
	response.Cookies("iphei").expires=DateAdd("n",30,now())
end if

'获取GET
function getHTTPPage(url,cset) 
dim Http 
set Http=server.createobject("MSXML2.XMLHTTP") 
Http.open "GET",url,false 
Http.send() 
if Http.readystate<>4 then exit function 
getHTTPPage=bytesToBSTR(Http.responseBody,cset) 
set http=nothing 
if err.number<>0 then err.Clear  
end function 
Function BytesToBstr(body,Cset) 
dim objstream 
set objstream = Server.CreateObject("adodb.stream") 
objstream.Type = 1
objstream.Mode =3 
objstream.Open
objstream.Write body
objstream.Position = 0 
objstream.Type = 2 
objstream.Charset = Cset 
BytesToBstr = objstream.ReadText  
objstream.Close 
set objstream = nothing 
End Function 

'获取是否手机端访问
function getistel() 
'if Ubound(split(request.serverVariables("HTTP_USER_AGENT"),"Windows"))=0 then 手机访问
HTTP_ACCEPT=Request.ServerVariables("HTTP_ACCEPT")                 '获取浏览器信息
HTTP_USER_AGENT=LCase(Request.ServerVariables("HTTP_USER_AGENT"))  '获取AGENT
HTTP_X_WAP_PROFILE=Request.ServerVariables("HTTP_X_WAP_PROFILE")   'WAP特定信息 品牌机自带浏览器都会有
HTTP_UA_OS=Request.ServerVariables("HTTP_UA_OS")                   '手机系统 电脑为空
HTTP_VIA=LCase(Request.ServerVariables("HTTP_VIA"))                '网关信息
WAPstr="pc"
If ubound(split(HTTP_ACCEPT,"vnd.wap"))>0 Then WAPstr="wap"
If HTTP_USER_AGENT="" Then  WAPstr="wap"
If HTTP_X_WAP_PROFILE<>"" Then  WAPstr="wap"
If HTTP_UA_OS<>"" Then  WAPstr="wap"
IF ubound(split(HTTP_VIA,"wap"))>0 Then  WAPstr="wap"
IF ubound(split(HTTP_USER_AGENT,"netfront"))>0 Then  WAPstr="wap"
IF ubound(split(HTTP_USER_AGENT,"iphone"))>0 Then  WAPstr="wap"
IF ubound(split(HTTP_USER_AGENT,"opera mini"))>0 Then  WAPstr="wap"
IF ubound(split(HTTP_USER_AGENT,"ucweb"))>0 Then  WAPstr="wap"
IF ubound(split(HTTP_USER_AGENT,"windows ce"))>0 Then  WAPstr="wap"
IF ubound(split(HTTP_USER_AGENT,"symbianos"))>0 Then  WAPstr="wap"
IF ubound(split(HTTP_USER_AGENT,"java"))>0 Then  WAPstr="wap"
IF ubound(split(HTTP_USER_AGENT,"android"))>0 Then  WAPstr="wap"
If WAPstr="wap" Then    
getistel="wap"
else   
getistel="pc"
end if
End Function 

'特殊字符转换
Public Function ReplaceTrim(ByVal strContent) 
        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 vbsEscape(str) 
    dim i,s,c,a 
    s="" 
    For i=1 to Len(str) 
        c=Mid(str,i,1) 
        a=ASCW(c) 
        If (a>=48 and a<=57) or (a>=65 and a<=90) or (a>=97 and a<=122) Then 
            s = s & c 
        ElseIf InStr("@*_+-./",c)>0 Then 
            s = s & c 
        ElseIf a>0 and a<16 Then 
            s = s & "%0" & Hex(a) 
        ElseIf a>=16 and a<256 Then 
            s = s & "%" & Hex(a) 
        Else 
            s = s & "%u" & Hex(a) 
        End If 
    Next 
    vbsEscape = s 
End Function

'转为BGK
Function vbsUnEscape(str) 
    dim i,s,c 
    s="" 
    For i=1 to Len(str) 
        c=Mid(str,i,1) 
        If Mid(str,i,2)="%u" and i<=Len(str)-5 Then 
            If IsNumeric("&H" & Mid(str,i+2,4)) Then 
                s = s & CHRW(CInt("&H" & Mid(str,i+2,4))) 
                i = i+5 
            Else 
                s = s & c 
            End If 
        ElseIf c="%" and i<=Len(str)-2 Then 
            If IsNumeric("&H" & Mid(str,i+1,2)) Then 
                s = s & CHRW(CInt("&H" & Mid(str,i+1,2))) 
                i = i+2 
            Else 
                s = s & c 
            End If 
        Else 
            s = s & c 
        End If 
    Next 
    vbsUnEscape = s 
End Function 

'写入日志
function logadd(uid,logcon,aylogleibie,logerr)
isshow=0
if aylogleibie<>"" then
if aylogleibie=9 then isshow=1
end if
if trim(request.Cookies("rzku"))<>"" then 
conn.Execute("Insert Into "&trim(request.Cookies("rzku"))&"(ayloguserid,aylogcon,aylogip,ayipd,aylogleibie,aylogerr,isshow) values("&uid&",'"&logcon&"','"&userinip&"','"&request.Cookies("useripd")&"',"&aylogleibie&","&logerr&","&isshow&")")
else
conn.Execute("Insert Into aylog(ayloguserid,aylogcon,aylogip,ayipd,aylogleibie,aylogerr,isshow) values("&uid&",'"&logcon&"','"&userinip&"','"&request.Cookies("useripd")&"',"&aylogleibie&","&logerr&","&isshow&")")
end if 
end function

'获取扫码自收序号
'function saomaxu() 
'Const saomastr = "0123456789"
'strlength = Len(saomastr)
'For xu=1 to 10
'	saomaxuhao=""
'	Randomize timer
'	For i = 1 To 3 
'	saomaxuhao = saomaxuhao&Mid(saomastr,Int(Rnd * strlength + 1),1)  
'	Next 
'	rssub.open "select top 1 aylxid,aylogdate from aybuylx where datediff(minute,aylogdate,'"&now()&"')<=10 and aylxxuid="&saomaxuhao&" order by aylxid desc" ,conn,1,1
'	if rssub.bof and rssub.eof then
'	saomaxu=saomaxuhao
'	exit for
'	end if
'	rssub.close
'Next
'end function

'获取自收订单 加价后金额
function zishoujj(fee,shoufs,contact) 
rssub.open "select top 1 aylogdate,zishoufs,aylxjin,aydddzt,ddchaoshi,aylxid,aylxcon,jjjzj from aybuylx where datediff(minute,aylogdate,'"&now()&"')<=6 and zishoufs='"&trim(shoufs)&"' and aylxjin="&fee&" and aydddzt=0 and ddchaoshi=0 order by aylxid desc" ,conn,1,1
nextjjj=0								'下次应加价默认金额 1 单位分
if not(rssub.bof and rssub.eof) then
	if contact<>trim(rssub("aylxcon")) then
		thisjjj=rssub("jjjzj") 				'当前已加价金额 1-9 单位分
		if cint(thisjjj)=0 then nextjjj=1
		if cint(thisjjj)=1 then nextjjj=2
		if cint(thisjjj)=2 then nextjjj=3
		if cint(thisjjj)=3 then nextjjj=4
		if cint(thisjjj)=4 then nextjjj=5
		if cint(thisjjj)=5 then nextjjj=6
		if cint(thisjjj)=6 then nextjjj=7
		if cint(thisjjj)=8 then nextjjj=9
		if cint(thisjjj)=9 then nextjjj=0
	end if
end if
rssub.close
zishoujj=nextjjj
end function

'获取ID锁定状态
sub getidzhuangtai()
	rssub.open "select top 1 aynameid,ayusersuo from ayname where aynameid="&clng(request.Cookies("aynameid"))&"" ,conn,1,1
	if not(rssub.bof and rssub.eof) then
	if cint(rssub("ayusersuo"))=1 then response.Redirect "/index/exit"
	else
	response.Redirect "/index/exit"
	end if
	rssub.close
end sub

'获取买家 商家 手机号
function gettelnum(uid)
	rssub.open "select top 1 aynameid,aytel from ayname where aynameid="&uid&"" ,conn,1,1
	if not(rssub.bof and rssub.eof) then
	gettelnum=rssub("aytel")
	else
	gettelnum=""
	end if
	rssub.close
end function


'获取商品销量 - 代收
function goodbuysum(gid) 
rssub.open "select top 1 ayxlgid,ayxlz from ayxiaoliang where ayxlgid="&gid&"",conn,1,3	
if not(rssub.bof and rssub.eof) then
goodbuysum=rssub("ayxlz")
else
rssub.addnew
rssub("ayxlgid")=gid
rssub.update
goodbuysum=0
end if
rssub.close
end function

'检测买家黑名单
function chkbuyhei(blx,bmail) 
buysqldd=""
'if bmail<>"" then buysqldd=" or aybhmail='"&bmail&"'"
'rs.open "select top 1 * from aybuyhei where aybhip='"&trim(userinip)&"' or aybhlx='"&trim(blx)&"'"&buysqldd&"" ,conn,1,1
rssub.open "select top 1 aybhlx from aybuyhei where aybhlx='"&trim(blx)&"'" ,conn,1,1
if not(rssub.bof and rssub.eof) then
call logadd("0","买家被限制购买",0,1)
response.Write "{""err"":""买家被限制购买，或联系方式过于简单""}"
response.End()
end if
rssub.close
end function

'检测买家ID 全站黑名单
function chkbuyheiall(buyid) 
rssub.open "select top 1 aymaiuid from aymaiidhei where aymaiuid="&trim(buyid)&"" ,conn,1,1
if not(rssub.bof and rssub.eof) then
call logadd("0","买家被限制购买-ALL-"&buyid&"",0,1)
response.Write "{""err"":""买家被限制购买-ALL""}"
response.End()
end if
rssub.close
end function

'检测商品购买 优惠券信息
function chkbuyyouhuiquan(yhqstr,yhquid) 
rssub.open "select ayyouhuiquan,ayyouhuisuoyou,ayyouhuijiage from ayyouhuiquan where ayyouhuiquan='"&trim(yhqstr)&"' and ayyouhuisuoyou="&yhquid&"",conn,1,1	
if not(rssub.bof and rssub.eof) then
chkbuyyouhuiquan=rssub("ayyouhuijiage")
else
chkbuyyouhuiquan=0
end if
rssub.close
end function

'订单号转换订单库
function getddku(id) 
getddku="aydingdan"
	select case	mid(trim(UCase(id)),3,1)
	case "A"
	getddku="aydingdan"
	case "B"
	getddku="aydingdan01"
	case "C"
	getddku="aydingdan02"
	case "D"
	getddku="aydingdan03"
	case "E"
	getddku="aydingdan04"
	case "F"
	getddku="aydingdan05"
	end select
end function
	
'财务号转换财务库
function getcwku(id) 
getcwku="aycaiwu" 
	select case	mid(trim(UCase(id)),3,1)
	case "A"
	getcwku="aycaiwu"
	case "B"
	getcwku="aycaiwu01"
	case "C"
	getcwku="aycaiwu02"
	case "D"
	getcwku="aycaiwu03"
	case "E"
	getcwku="aycaiwu04"
	case "F"
	getcwku="aycaiwu05"
	end select
end function

'包年套餐指定 查看是否为可用级别 true  false
Function chkujb(ParaName,ayguolvcon) 
	isguolvok=false
		if trim(ayguolvcon)<>"" then
		ParaValuetemp=lcase(ParaName)
		tempvalue=ayguolvcon
		temps=split(tempvalue,",")
			for mycount=0 to ubound(temps)
				if  temps(mycount) = ParaValuetemp then
				isguolvok=true
				end if
			next
		end if
	chkujb=isguolvok
End function

'快速获取access_token
function getaccesstoken() 
	set rssite=server.CreateObject("adodb.recordset")
	rssite.open "select appid,secret from aysitesys",conn,1,1
	site_appid=trim(rssite("appid"))
	site_secret=trim(rssite("secret"))
	rssite.close
	
'getaccesstoken=getHTTPPage(""&wxtokenurl&"inc/getaccesstoken.asp","gb2312")
rssub.open "select top 1 * from aytoken" ,conn,1,3
	if not(rssub.bof and rssub.eof) then
		if DateDiff("s",rssub("tokendate"),now())>6000 then
			tokenstr=getHTTPPage("https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid="&site_appid&"&secret="&site_secret&"","gb2312")
			Set json = toObject(tokenstr)
			tokenstr = json.access_token
			Set json = Nothing 
			rssub("token")=trim(tokenstr)
			rssub("tokendate")=now()
			rssub.update
			getaccesstoken = tokenstr
		else
		getaccesstoken=trim(rssub("token"))
		end if
	else
		tokenstr=getHTTPPage("https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid="&site_appid&"&secret="&site_secret&"","gb2312")
		Set json = toObject(tokenstr)
		tokenstr = json.access_token
		Set json = Nothing 
		rssub.addnew
		rssub("token")=trim(tokenstr)
		rssub("tokendate")=now()
		rssub.update
		getaccesstoken = tokenstr
	end if
rssub.close
end function


	
'快速获取商家卡密库
function getkamikuname(id) 
rssub.open "select aynameid,kamiku from ayname where aynameid="&id&"" ,conn,1,1
if not(rssub.bof and rssub.eof) then
getkamikuname=trim(rssub("kamiku"))
else
getkamikuname="null"
end if
rssub.close
end function

'快速获取商家日志库
function getrizhikuname(id) 
rssub.open "select aynameid,rzku from ayname where aynameid="&id&"" ,conn,1,1
if not(rssub.bof and rssub.eof) then
getrizhikuname=trim(rssub("rzku"))
else
getrizhikuname="null"
end if
rssub.close
end function

'获取上次IP信息
function lastuserip(uid) 
rssub.open "select top 1 ayloguserid,aylogid,ayipd,isshow,aylogerr from "&trim(request.Cookies("rzku"))&" where ayloguserid="&uid&" and aylogerr=0 and isshow=0 and aylogleibie<>0 order by aylogid desc" ,conn,1,1
if not(rssub.bof and rssub.eof) then
lastuserip=trim(rssub("ayipd"))
else
lastuserip="null"
end if
rssub.close
end function

	
'代理卖出卡密 补全6位商户ID
function tocunid(id) 
tocunid=cstr(id)
if 6-len(tocunid)<>0 then '需要补a 最多6位
	for a=1 to 6-len(tocunid)
	tocunid="a"&tocunid
	next
end if
end function

'快速获取 订单 已分配卡密 订单号 商户ID 上级代理ID
function getddokkami(id,uid,sidku) 
	if trim(sidku)<>"" then 
	getkaku=trim(sidku)
	else
	getkaku=getkamikuname(uid)
	end if
set rskanum=conn.execute("select count(*) as num from "&getkaku&" where aykasuoyoudd='"&id&"' and aykayesno=1")
getddokkami=rskanum("num")
end function


'快速获取商户是否开启异地登录验证
function getuserydip(uid) 
rssub.open "select aynameid,isyidiip from ayname where aynameid="&uid&"" ,conn,1,1
getuserydip=rssub("isyidiip")
rssub.close
end function

'快速获取商户姓名
function totruename(id) 
rssub.open "select aynameid,aytrueuser from ayname where aynameid="&id&"" ,conn,1,1
if not(rssub.bof and rssub.eof) then
totruename=trim(rssub("aytrueuser"))
else
totruename="null"
end if
rssub.close
end function

'快速获取商家级别
function getjbname(id) 
rssub.open "select * from ayujb where ayujbgid="&id&"" ,conn,1,1
if not(rssub.bof and rssub.eof) then
getjbname=trim(rssub("ayujbname"))
else
getjbname="null"
if id=9 then getjbname="管理员"
if id=5 then getjbname="正式商家"
if id=0 then getjbname="买家"
end if
rssub.close
end function



'快速获取接口数据
function toparkey(id) 
rssub.open "select "&id&" from ayquanju" ,conn,1,1
if not(rssub.bof and rssub.eof) then
toparkey=trim(rssub(id))
else
toparkey="null"
end if
rssub.close
end function

'异步通知转换参数
Function parseURL(params)
dim xmlContent
xmlContent = ""
keys	= params.Keys()
For Each k In keys
xmlContent=xmlContent & k &"=" & params(k) & "&"
Next
parseURL= xmlContent
End Function



'快速获取短连接
function getdurl(url) 
getdurl=getHTTPPage("http://api.t.sina.com.cn/short_url/shorten.json?source=3271760578&url_long="&trim(url)&"","gb2312")
getdurl = replace(getdurl,"[","")
getdurl = replace(getdurl,"]","")
Set json = toObject(cstr(trim(getdurl)))
getdurl=trim(json.url_short)
end function

'检测来路域名
sub chkwurl()
dim ComeUrl,cUrl
ComeUrl=lcase(trim(request.ServerVariables("HTTP_REFERER")))
if ComeUrl="" then
response.write "<br><p align=center><font color='red'>对不起，禁止外部链接地址访问err1。</font></p>"
response.end
else
ComeUrl=replace(ComeUrl,"http://"," ")
ComeUrl=replace(ComeUrl,"https://"," ")
ComeUrl=replace(ComeUrl,":","/")
ComeUrl=lcase(left(ComeUrl,InStr(ComeUrl,"/")))
cURL=lcase(request.ServerVariables("SERVER_NAME"))&"/"
	if trim(ComeUrl)<>trim(cURL) then
	response.write "<br><p align=center><font color='red'>对不起，禁止外部链接地址访问err2。</font></p>"
	response.end
	end if
end if
end sub

'参数 安全检测
Function Safestr(ParaName) 
Dim ParaValue 
ParaValue=ParaName
if IsNumeric(ParaValue)  then
Safestr=ParaValue
exit Function
else
ParaValuetemp=lcase(ParaValue)
tempvalue="select |insert |delete from|count(|drop table|update |truncate  |asc(|mid(|char(|xp_cmdshell|exec master|net localgroup administrators|net user| or |'or|or'| and |script|javascript"  
temps=split(tempvalue,"|")
for mycount=0 to ubound(temps)
if  Instr(ParaValuetemp,temps(mycount)) > 0 then
	     call PopErr("字符"&temps(mycount)&"禁止使用")
		response.end
end if
next
Safestr=ParaValue
end if
End function


'传递参数 安全检测
Function SafeRequest(ParaName) 
Dim ParaValue 
ParaValue=Request.QueryString(ParaName)
if IsNumeric(ParaValue)  then
SafeRequest=ParaValue
exit Function
else
ParaValuetemp=lcase(ParaValue)
tempvalue="select |insert |delete from|count(|drop table|update |truncate  |asc(|mid(|char(|xp_cmdshell|exec master|net localgroup administrators|net user| or |'or|or'| and |script|javascript"  
temps=split(tempvalue,"|")
for mycount=0 to ubound(temps)
if  Instr(ParaValuetemp,temps(mycount)) > 0 then
	     call PopErr("字符"&temps(mycount)&"禁止使用")
		response.end
end if
next
SafeRequest=ParaValue
end if
End function

'传递参数 安全检测
Function SafeRequestform(ParaName) 
Dim ParaValue 
ParaValue=request.form(ParaName)
if IsNumeric(ParaValue)  then
SafeRequestform=ParaValue
exit Function
else
ParaValuetemp=lcase(ParaValue)
tempvalue="select |insert |delete from|count(|drop table|update |truncate  |asc(|mid(|char(|xp_cmdshell|exec master|net localgroup administrators|net user| or |'or|or'| and |script|javascript" 
temps=split(tempvalue,"|")
for mycount=0 to ubound(temps)
if  Instr(ParaValuetemp,temps(mycount)) > 0 then
	     call PopErr("字符"&temps(mycount)&"禁止使用")
		response.end
end if
next
SafeRequestform=ParaValue
end if
End function


'传递参数 安全检测 严格过滤 长度18 过滤'|)|,|(|#
Function SafeRequestyg(ParaName) 
Dim ParaValue 
ParaValue=Request.QueryString(ParaName)
if IsNumeric(ParaValue)  then
SafeRequestyg=ParaValue
exit Function
else
ParaValuetemp=lcase(ParaValue)
if len(ParaValuetemp)>18 then
call PopErr("传递参数过长")
response.end
end if
tempvalue="select |insert |delete from|count(|drop table|update |truncate  |asc(|mid(|char(|xp_cmdshell|exec master|net localgroup administrators|net user| or |'or|or'| and |script|javascript|'|)|,|(|#"  
temps=split(tempvalue,"|")
for mycount=0 to ubound(temps)
if  Instr(ParaValuetemp,temps(mycount)) > 0 then
	     call PopErr("字符"&temps(mycount)&"禁止使用")
		response.end
end if
next
SafeRequestyg=ParaValue
end if
End function

'传递参数 安全检测 严格过滤 长度18 过滤'|)|,|(|#
Function SafeRequestformyg(ParaName) 
Dim ParaValue 
ParaValue=request.form(ParaName)
if IsNumeric(ParaValue)  then
SafeRequestformyg=ParaValue
exit Function
else
ParaValuetemp=lcase(ParaValue)
if len(ParaValuetemp)>18 then
call PopErr("传递参数过长")
response.end
end if
tempvalue="select |insert |delete from|count(|drop table|update |truncate  |asc(|mid(|char(|xp_cmdshell|exec master|net localgroup administrators|net user| or |'or|or'| and |script|javascript|'|)|,|(|#" 
temps=split(tempvalue,"|")
for mycount=0 to ubound(temps)
if  Instr(ParaValuetemp,temps(mycount)) > 0 then
	     call PopErr("字符"&temps(mycount)&"禁止使用")
		response.end
end if
next
SafeRequestformyg=ParaValue
end if
End function




'传递参数 安全检测 宽松过滤
Function SafeRequestformks(ParaName) 
Dim ParaValue 
ParaValue=request.form(ParaName)
if IsNumeric(ParaValue)  then
SafeRequestformks=ParaValue
exit Function
else
ParaValuetemp=lcase(ParaValue)
tempvalue="%20|select |insert |delete from|count(|drop table|update |truncate  |asc(|mid(|char(|xp_cmdshell|exec master|net localgroup administrators|net user| or |'or|or'| and |script|javascript" 
temps=split(tempvalue,"|")
for mycount=0 to ubound(temps)
if  Instr(ParaValuetemp,temps(mycount)) > 0 then
	     call PopErr("字符"&temps(mycount)&"禁止使用")
		response.end
end if
next
SafeRequestformks=ParaValue
end if
End function







'过滤全局禁用字眼
Function guolvRequestform(ParaName,ayguolvcon) 
Dim ParaValue 
isguolvok=true
ParaValue=request.form(ParaName)
	if IsNumeric(ParaValue)  then
	guolvRequestform=isguolvok
	exit Function
	else
	ParaValuetemp=lcase(ParaValue)
	tempvalue=ayguolvcon
	temps=split(tempvalue,",")
		for mycount=0 to ubound(temps)
		if  Instr(ParaValuetemp,temps(mycount)) > 0 then
		isguolvok=false
		end if
		next
	guolvRequestform=isguolvok
	end if
End function

'HTML字符替换过滤
function filter_Str(InString)
   NewStr=Replace(InString," ","")
   NewStr=Replace(NewStr,"*","")
   NewStr=Replace(NewStr,"<","*") 
   NewStr=Replace(NewStr,">","*")
   NewStr=Replace(NewStr,"chr(60)","*") 
   NewStr=Replace(NewStr,"chr(37)","*")
   NewStr=Replace(NewStr,"""","*")
   NewStr=Replace(NewStr,";","*")
   NewStr=Replace(NewStr,"__","*")
   NewStr=Replace(NewStr,"/*","*")
   NewStr=Replace(NewStr,"%","*") 
   filter_Str=server.htmlencode(NewStr)
end function

'检查金额是否正确
Function cisnum(ParaName) 
Dim ParaValue 
ParaValuetemp=lcase(ParaName)
tempvalue="d|e|,|&|￥|(|)|（|）|+|-"
temps=split(tempvalue,"|")
for mycount=0 to ubound(temps)
if Instr(ParaValuetemp,temps(mycount)) > 0 then
	call PopErr("输入有误，请检查")
	response.end
end if
next
End function

'JS跳转
sub PopErr(Mesg)
if isnull(Mesg) then Mesg=""
Mesg=SafeReplace(Mesg,"\","")
Mesg=SafeReplace(Mesg,"/","")
Mesg=SafeReplace(Mesg,"'","")
Mesg=SafeReplace(Mesg,"&","")
Mesg=SafeReplace(Mesg,vbcrlf,"")
Mesg=SafeReplace(Mesg,vbcr,"")
Mesg=SafeReplace(Mesg,vblf,"")
Mesg=SafeReplace(Mesg,"""","")
%>
<script language='javascript'>
alert('<%=Mesg%>');
history.go(-1);
</script>     
<%
response.end
end sub

'JS跳转
sub PopErr2(Mesg,url)
if isnull(Mesg) then Mesg=""
Mesg=SafeReplace(Mesg,"/","")
Mesg=SafeReplace(Mesg,"'","")
Mesg=SafeReplace(Mesg,"&","")
Mesg=SafeReplace(Mesg,vbcrlf,"")
Mesg=SafeReplace(Mesg,vbcr,"")
Mesg=SafeReplace(Mesg,vblf,"")
Mesg=SafeReplace(Mesg,"""","")
%>
<script language='javascript'>
alert('<%=Mesg%>');
window.document.location.href="<%=url%>"
</script>     
<%
response.end
end sub

'JS跳转 字符过滤
Function SafeReplace(strName,str_c,str_d ) 
if isnull(strName) then 
	SafeReplace = ""
	exit function
end if
if strName = "" then
	SafeReplace = ""
	exit function
end if
if isnull(str_c) or isnull(str_d) then
	SafeReplace = strName
	exit function
end if
SafeReplace = Replace ( strName, str_c, str_d ) 
End Function 

'页面位置导航
sub pageye()
if pagecount=0 or page=1 then response.write "首页 上页&nbsp;":else:response.Write"<a href="&link&"&page=1>首页</a> <a href="&link&"&page="&page-1&">上页</a>&nbsp;":end if
if pagecount>20 then
	if page<=10 then 
	aa=1
	bb=20
	aabu=""
	bbbu=" … "
	elseif page>=11 then 
	aa=page-9
	bb=page+10
	aabu=" …"
	bbbu=" … "
		if bb>=pagecount then 
		aa=pagecount-20
		bb=pagecount
		aabu=" … "
		bbbu=""
		end if
	end if
	response.Write aabu
	for aa=aa to bb
	if page=aa then
	response.Write("<a href="&link&"&page="&aa&"><strong>"&aa&"</strong></a>&nbsp;")
	else
	response.Write("<a href="&link&"&page="&aa&">"&aa&"</a>&nbsp;")
	end if
	next
	response.Write bbbu
else
	for i=1 to pagecount
	if page=i then
	response.Write("<a href="&link&"&page="&i&"><strong>"&i&"</a></strong>&nbsp;")
	else
	response.Write("<a href="&link&"&page="&i&">"&i&"</a>&nbsp;")
	end if
	next
end if
if pagecount=0 or page=pagecount then response.write("下页&nbsp;尾页 "):else:response.Write"<a href="&link&"&page="&page+1&">下页</a> <a href="&link&"&page="&pagecount&">尾页 </a>":end if
if pagecount<>0 then response.Write page&"/"&pagecount
response.Write "&nbsp;共"&zongshu&"条"
end sub


%>