答案: str被检测的
'stypes被检测的字符的类型 1为数字检测
'RturnStr 如果此参数为空,则可以为空。否则此参数就是否返回的错误信息提示
'checkstrin(request("id"),1,"ID号码不能为空,请返回")
Function checkstrin(str,types,ReturnStr)
if str<>"" then
if cstr(types)="1" then
if isnumeric(str) then
str=clng(str)
else
%>
<script language="javascript"> alert("错误链接,请返回! ");history.back();</script>
<%
response.End()
end if
else
str=trim(str)
Fy_In = "exec|insert|select|delete|update|chr|master|truncate|declare|script|'"
Fy_in_a=split(Fy_In,"|")
for i=0 to (ubound(fy_in_a))
pos=instr(lcase(str),lcase(fy_in_a(i)))
if pos <> 0 then
%>
<script language="javascript"> alert('您提交的信息包含非法字符!\n\n');history.back();</script>
<%
response.End()
end if
next
end if
else
if ReturnStr<>"" then
%>
<script language="javascript"> alert("<%=ReturnStr%>");history.back();</script>
<%
response.End()
end if
end if
checkstrin=str
end function
上一个:asp验证第一个字符是否为字母
下一个:asp注销登陆